标签:
编译JNI的错误日志:
D:\TVMao\WorkSpace\DramaApp\TestJni>ndk-build
Android NDK: WARNING: APP_PLATFORM android-19 is larger than android:minSdkVersi
on 14 in ./AndroidManifest.xml
[armeabi] Compile++ thumb: test <= test.cpp
jni/test.cpp: In function ‘void Java_com_example_testjni_Decoder_sendIr(JNIEnv*,
jclass, jint, jintArray)‘:
jni/test.cpp:27:20: error: base operand of ‘->‘ has non-pointer type ‘JNIEnv {ak
a _JNIEnv}‘
jni/test.cpp:28:28: error: base operand of ‘->‘ has non-pointer type ‘JNIEnv {ak
a _JNIEnv}‘
jni/test.cpp:47:8: error: base operand of ‘->‘ has non-pointer type ‘JNIEnv {aka
_JNIEnv}‘
make.exe: *** [obj/local/armeabi/objs/test/test.o] Error 1
原因是
你代码中使用的C风格访问Env 而 你的文件是 cpp
test.cpp
jsize len = (*env)->GetArrayLength(env, pattern);
解决方案
1.改成test.c
2.改成
int* patternArray = env->GetIntArrayElements(pattern, NULL);
错误: operand of ‘->‘ has non-pointer type ‘JNIEnv
标签:
原文地址:http://my.oschina.net/sfshine/blog/495146