Android NDK errors

  • Post author:
  • Post category:其他


1.make: *** No rule to make target `~/test.c’, needed by `~/test.o’.  Stop.

找不到文件test.c,最后发现文件名与后缀名之间多了一个空格

2.使用so时,app闪退,调试方法

adb logcat | ndk-stack -sym ~/app/src/main/obj/local/armeabi-v7a

more information:

http://stackoverflow.com/questions/17840521/android-fatal-signal-11-sigsegv-at-0x636f7d89-code-1-how-can-it-be-tracked

3.java.lang.UnsatisfiedLinkError: Native method not found: com.xx.xx.nativeInit:()V

根据网上的方法检查了一遍,依然找不到问题,后来发现是自己编译的库名可能与系统某个库名相同,冲突了。修改即可。

4.use of undeclared identifier ‘fseeko’; did you mean ‘fseek’?

Remove -D_FILE_OFFSET_BITS=64

5.java.lang.UnsatisfiedLinkError: dlopen failed: library “libc++_shared.so” not found

defaultConfig {
         ...

        externalNativeBuild {
            cmake {
                ...
                arguments "-DANDROID_STL=c++_shared"
                ...
            }
        }
    }

6.NDK error:

ModelCache.safeGet(androidProjectResult.androidProject::getNdkVersion, "") must not be null

fix:

android {
    ndkVersion "major.minor.build" // e.g.,  ndkVersion "21.3.6528147"
}



版权声明:本文为hhbgk原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。