編譯JNI的錯誤日誌: android
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
ui
緣由是 日誌
你代碼中使用的C風格訪問Env 而 你的文件是 cpp code
test.cpp xml
jsize len = (*env)->GetArrayLength(env, pattern);
io
解決方案 編譯
1.改爲test.c function
2.改爲 class
int* patternArray = env->GetIntArrayElements(pattern, NULL);
test