JNI WARNING: CallObjectMethod expected return type 'L'


初学C调用java代码,出错如下:
07-14 10:36:15.028 27654-27654/study.jnidemo W/dalvikvm:            JNI WARNING: CallObjectMethod expected return type 'L'
07-14 10:36:15.028 27654-27654/study.jnidemo W/dalvikvm:              calling Lstudy/jnidemo/JniDemoActivity;.importCert ()V
07-14 10:36:15.028 27654-27654/study.jnidemo W/dalvikvm:              in Lstudy/jnidemo/JniDemoActivity;.jniImportCert:()V (CallObjectMethod)

仔细检查C代码发现问题:
void Java_study_jnidemo_JniDemoActivity_jniImport  ( JNIEnv * env , jobject thiz ){
           jclass cls =(* env )-> GetObjectClass ( env , thiz );
           if ( cls != NULL ){
                    jstring str ;
                    jmethodID method3 =(* env )-> GetMethodID ( env , cls , "import" , "()V" );
                    if ( method3 != NULL ){
                             (* env )-> CallObjectMethod ( env , thiz , method3 );
                             
                   }
          }
}
                             (* env )-> CallObjectMethod ( env , thiz , method3 );
改成
 
                             (* env )-> CallVoidMethod ( env , thiz , method3 );
智能推荐

注意!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系我们删除。



 
© 2014-2019 ITdaan.com 粤ICP备14056181号  

赞助商广告