cocos2dx2.1.4FATAL EXCEPTION: GLThread 10, Class doesn't implement Cloneable解决

阅读更多
cocos2dx2.1.4FATAL EXCEPTION: GLThread 10, Class doesn't implement Cloneable

错误出现场景:
点击按钮,通过jni方式调用sina android api,logcat错误信息如下

04-19 09:29:06.191: W/dalvikvm(10190): threadid=8: thread exiting with uncaught exception (group=0x4001d888)
04-19 09:29:06.254: E/AndroidRuntime(10190): FATAL EXCEPTION: GLThread 10
04-19 09:29:06.254: E/AndroidRuntime(10190): java.lang.CloneNotSupportedException: Class doesn't implement Cloneable
04-19 09:29:06.254: E/AndroidRuntime(10190): 	at java.lang.Object.clone(Object.java:79)
04-19 09:29:06.254: E/AndroidRuntime(10190): 	at org.cocos2dx.lib.Cocos2dxRenderer.nativeTouchesEnd(Native Method)
04-19 09:29:06.254: E/AndroidRuntime(10190): 	at org.cocos2dx.lib.Cocos2dxRenderer.handleActionUp(Cocos2dxRenderer.java:129)
04-19 09:29:06.254: E/AndroidRuntime(10190): 	at org.cocos2dx.lib.Cocos2dxGLSurfaceView$9.run(Cocos2dxGLSurfaceView.java:257)
04-19 09:29:06.254: E/AndroidRuntime(10190): 	at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1295)
04-19 09:29:06.254: E/AndroidRuntime(10190): 	at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1116)


查找资料后,定位到jni的调用函数
void SinaJni::doLogin()
{
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
    {
        JniMethodInfo mInfo;
        
        //判断是否存在doSinaLogin
        bool isHave = JniHelper::getStaticMethodInfo(mInfo,JNI_CALL_CLASS,"doSinaLogin","(Ljava/lang/String;Ljava/lang/String;)V");
            
            if (!isHave)
            {
                CCLog("doSinaLogin native method does not exist");

            }else
            {
                jstring jAppKey = mInfo.env->NewStringUTF(mAppKey.c_str());
                jstring jRedirect_Url = mInfo.env->NewStringUTF(mAppRedirectURI.c_str());
                mInfo.env->CallVoidMethod(mInfo.classID,mInfo.methodID,jAppKey,jRedirect_Url);
                mInfo.env->DeleteLocalRef(jAppKey);
                mInfo.env->DeleteLocalRef(jRedirect_Url);
            }
        }
#endif
}


修改成:
mInfo.env->CallStaticVoidMethod(mInfo.classID,mInfo.methodID,jAppKey,jRedirect_Url);

问题解决了,喝杯水休息下。今天体检报告出来,中度脂肪肝,it男身体伤不起啊。

你可能感兴趣的:(jni,android)