4

我正在尝试根据此处的说明配置 crashlytics ndk:https ://fabric.io/downloads/gradle/ndk

将 ndk 部分添加到 build.gradle 后,特别是以下几行:

// NDK Kit
compile('com.crashlytics.sdk.android:crashlytics-ndk:1.1.2@aar') {
    transitive = true
}

我的应用程序因以下堆栈跟踪而崩溃:

11-11 18:48:36.779  28757-28757/com.example.myProj E/MyApp﹕ CustomExceptionHandler.uncaughtException: FATAL
    java.lang.UnsatisfiedLinkError: Couldn't load stlport_shared from loader dalvik.system.PathClassLoader[dexPath=/data/app/com.example.myProj-1.apk,libraryPath=/data/app-lib/com.example.myProj-1]: findLibrary returned null
            at java.lang.Runtime.loadLibrary(Runtime.java:365)
            at java.lang.System.loadLibrary(System.java:535)
            at net.sqlcipher.database.SQLiteDatabase.loadLibs(SQLiteDatabase.java:118)
            at net.sqlcipher.database.SQLiteDatabase.loadLibs(SQLiteDatabase.java:113)
            at com.example.myProj.Controller.AppWrapper.onCreate(AppWrapper.java:102)
            at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1000)
            at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4510)
            at android.app.ActivityThread.access$1300(ActivityThread.java:146)
            at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1300)
            at android.os.Handler.dispatchMessage(Handler.java:99)
            at android.os.Looper.loop(Looper.java:137)
            at android.app.ActivityThread.main(ActivityThread.java:5171)
            at java.lang.reflect.Method.invokeNative(Native Method)
            at java.lang.reflect.Method.invoke(Method.java:511)
            at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:797)
            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:564)
            at dalvik.system.NativeStart.main(Native Method)
11-11 18:48:36.779  28757-28757/com.example.myProj E/AndroidRuntime﹕ FATAL EXCEPTION: main
    java.lang.UnsatisfiedLinkError: Couldn't load stlport_shared from loader dalvik.system.PathClassLoader[dexPath=/data/app/com.example.myProj-1.apk,libraryPath=/data/app-lib/com.example.myProj-1]: findLibrary returned null
            at java.lang.Runtime.loadLibrary(Runtime.java:365)
            at java.lang.System.loadLibrary(System.java:535)
            at net.sqlcipher.database.SQLiteDatabase.loadLibs(SQLiteDatabase.java:118)
            at net.sqlcipher.database.SQLiteDatabase.loadLibs(SQLiteDatabase.java:113)
            at com.example.myProj.Controller.AppWrapper.onCreate(AppWrapper.java:102)
            at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1000)
            at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4510)
            at android.app.ActivityThread.access$1300(ActivityThread.java:146)
            at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1300)
            at android.os.Handler.dispatchMessage(Handler.java:99)
            at android.os.Looper.loop(Looper.java:137)
            at android.app.ActivityThread.main(ActivityThread.java:5171)
            at java.lang.reflect.Method.invokeNative(Native Method)
            at java.lang.reflect.Method.invoke(Method.java:511)
            at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:797)
            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:564)
            at dalvik.system.NativeStart.main(Native Method)

似乎 crashlytics 改变了类加载器路径。

有任何想法吗?

4

1 回答 1

7

通过删除其他架构解决了我的问题。

参考:https ://docs.fabric.io/android/crashlytics/ndk.html#universal-aar

指的是:http ://tools.android.com/tech-docs/new-build-system/user-guide/apk-splits#TOC-ABIs-Splits

将此特定部分添加到 build.gradle 解决了我的问题:

splits {
        abi {
            enable true
            reset()
            include 'armeabi'
            universalApk true
        }
    }
于 2015-11-12T17:03:14.207 回答