Android之error: void value not ignored as it ought to be(In function 'callMethod2')解决办法
2017-05-13 23:30
1406 查看
1、问题
chenyu@chenyu:~/Android_dev/Test/app/jni$ ndk-build[armeabi] Compile thumb : FirstJni <= JniClient.c
/home/chenyu/Android_dev/Test/app/jni/JniClient.c: In function 'callMethod2':
/home/chenyu/Android_dev/Test/app/jni/JniClient.c:74:18: error: void value not ignored as it ought to be
int result = (*env)->CallVoidMethod(env, jobj, method2, 5, 5);
^
make: *** [/home/chenyu/Android_dev/Test/app/obj/local/armeabi/objs/FirstJni/JniClient.o] Error 1
2、原因
因为我写得callMethod2方法里面是这样写的int result = (*env)->CallVoidMethod(env, jobj, method2, 5, 5);
特码很明显啊,我有返回值了,还调用(*env)->CallVoidMethod(env, jobj , method2, 5, 5);
自己傻逼啊,这个本地方法明显没有返回值
3、解决办法
(*env)->CallVoidMethod(env, jobj , method2, 5, 5);改成
int result = (*env)->CallIntMethod(env, obj, method2, 3,5);
相关文章推荐
- error: void value not ignored as it ought to be
- error: void value not ignored as it ought to be
- error: void value not ignored as it ought to be
- cpp:104:11: error: void value not ignored as it ought to be
- 编译内核模块 error: void value not ignored as it ought to be
- error: void value not ignored as it ought to be
- error: void value not ignored as it ought to be .
- 解决:void value not ignored as it ought to be
- void value not ignored as it ought to be
- void value not ignored as it ought to be
- void value not ignored as it ought to be
- void value not ignored as it ought to be
- void value not ignored as it ought to be
- void value not ignored as it ought to be
- void value not ignored as it ought to be
- Android之ndk-build出现c:28:51: error: 'get_string' undeclared here (not in a function)解决办法
- 解决‘tools.jar’ seems to be not in android studio classpath 问题
- build-essential : Depends: libc6-dev but it is not going to be installed or libc-dev 解决办法
- Value '0000-00-00' can not be represented as java.sql.Date解决办法
- Error running app: Instant Run requires 'Tools | Android | Enable ADB integration' to be enabled.解决办法