浏览 2251 次
精华帖 (0) :: 良好帖 (0) :: 新手帖 (0) :: 隐藏帖 (0)
|
|
---|---|
作者 | 正文 |
发表时间:2013-12-12
错误出现场景: 点击按钮,通过jni方式调用sina android api,logcat错误信息如下 <pre name="code" class="java"> 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) </pre> 查找资料后,定位到jni的调用函数 <pre name="code" class="cpp"> 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 } </pre> 修改成: mInfo.env->CallStaticVoidMethod(mInfo.classID,mInfo.methodID,jAppKey,jRedirect_Url); 问题解决了,喝杯水休息下。今天体检报告出来,中度脂肪肝,it男身体伤不起啊。 声明:ITeye文章版权属于作者,受法律保护。没有作者书面许可不得转载。
推荐链接
|
|
返回顶楼 | |