当在Android应用程序上本机初始化crashlytics时,我遇到以下异常
12-12 10:55:54.104 15540 15621 E CrashlyticsCore: java.util.concurrent.ExecutionException: java.lang.NullPointerException: Attempt to get length of null array
12-12 10:55:54.104 15540 15621 E CrashlyticsCore: at java.util.concurrent.FutureTask.report(FutureTask.java:94)
12-12 10:55:54.104 15540 15621 E CrashlyticsCore: at java.util.concurrent.FutureTask.get(FutureTask.java:164)
12-12 10:55:54.104 15540 15621 E CrashlyticsCore: at com.crashlytics.android.core.CrashlyticsBackgroundWorker.submitAndWait(CrashlyticsBackgroundWorker.java:43)
12-12 10:55:54.104 15540 15621 E CrashlyticsCore: at com.crashlytics.android.core.CrashlyticsController.finalizeNativeReport(CrashlyticsController.java:967)
12-12 10:55:54.104 15540 15621 E CrashlyticsCore: at com.crashlytics.android.core.CrashlyticsCore.doInBackground(CrashlyticsCore.java:346)
12-12 10:55:54.104 15540 15621 E CrashlyticsCore: at com.crashlytics.android.core.CrashlyticsCore.doInBackground(CrashlyticsCore.java:45)
12-12 10:55:54.104 15540 15621 E CrashlyticsCore: at io.fabric.sdk.android.InitializationTask.doInBackground(InitializationTask.java:63)
12-12 10:55:54.104 15540 15621 E CrashlyticsCore: at io.fabric.sdk.android.InitializationTask.doInBackground(InitializationTask.java:28)
12-12 10:55:54.104 15540 15621 E CrashlyticsCore: at io.fabric.sdk.android.services.concurrency.AsyncTask$2.call(AsyncTask.java:311)
12-12 10:55:54.104 15540 15621 E CrashlyticsCore: at java.util.concurrent.FutureTask.run(FutureTask.java:237)
12-12 10:55:54.104 15540 15621 E CrashlyticsCore: at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:428)
--
--
12-12 10:55:54.104 15540 15621 E CrashlyticsCore: at java.util.concurrent.FutureTask.run(FutureTask.java:237)
12-12 10:55:54.104 15540 15621 E CrashlyticsCore: at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1133)
12-12 10:55:54.104 15540 15621 E CrashlyticsCore: at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:607)
12-12 10:55:54.104 15540 15621 E CrashlyticsCore: at java.lang.Thread.run(Thread.java:761)
12-12 10:55:54.104 15540 15621 E CrashlyticsCore: Caused by: java.lang.NullPointerException: Attempt to get length of null array
12-12 10:55:54.104 15540 15621 E CrashlyticsCore: at com.crashlytics.android.core.NativeFileUtils.filter(NativeFileUtils.java:43)
12-12 10:55:54.104 15540 15621 E CrashlyticsCore: at com.crashlytics.android.core.NativeFileUtils.minidumpFromDirectory(NativeFileUtils.java:53)
12-12 10:55:54.104 15540 15621 E CrashlyticsCore: at com.crashlytics.android.core.CrashlyticsController.finalizeMostRecentNativeCrash(CrashlyticsController.java:903)
12-12 10:55:54.104 15540 15621 E CrashlyticsCore: at com.crashlytics.android.core.CrashlyticsController.access$1700(CrashlyticsController.java:69)
12-12 10:55:54.104 15540 15621 E CrashlyticsCore: at com.crashlytics.android.core.CrashlyticsController$16.call(CrashlyticsController.java:977)
12-12 10:55:54.104 15540 15621 E CrashlyticsCore: at com.crashlytics.android.core.CrashlyticsController$16.call(CrashlyticsController.java:967)
12-12 10:55:54.104 15540 15621 E CrashlyticsCore: at java.util.concurrent.FutureTask.run(FutureTask.java:237)
12-12 10:55:54.104 15540 15621 E CrashlyticsCore: at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1133)
12-12 10:55:54.104 15540 15621 E CrashlyticsCore: at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:607)
12-12 10:55:54.104 15540 15621 E CrashlyticsCore: at io.fabric.sdk.android.services.common.ExecutorUtils$1$1.onRun(ExecutorUtils.java:75)
12-12 10:55:54.104 15540 15621 E CrashlyticsCore: at io.fabric.sdk.android.services.common.BackgroundPriorityRunnable.run(BackgroundPriorityRunnable.java:30)
--
--
12-12 10:55:54.104 15540 15621 E CrashlyticsCore: at io.fabric.sdk.android.services.common.ExecutorUtils$1$1.onRun(ExecutorUtils.java:75)
12-12 10:55:54.104 15540 15621 E CrashlyticsCore: at io.fabric.sdk.android.services.common.BackgroundPriorityRunnable.run(BackgroundPriorityRunnable.java:30)
12-12 10:55:54.104 15540 15621 E CrashlyticsCore: ... 1 more
12-12 10:55:54.124 15540 15621 E CrashlyticsCore: Crashlytics encountered a problem during asynchronous initialization.
12-12 10:55:54.124 15540 15621 E CrashlyticsCore: java.lang.NullPointerException: Attempt to invoke virtual method 'boolean java.lang.Boolean.booleanValue()' on a null object reference
12-12 10:55:54.124 15540 15621 E CrashlyticsCore: at com.crashlytics.android.core.CrashlyticsController.finalizeNativeReport(CrashlyticsController.java:967)
12-12 10:55:54.124 15540 15621 E CrashlyticsCore: at com.crashlytics.android.core.CrashlyticsCore.doInBackground(CrashlyticsCore.java:346)
12-12 10:55:54.124 15540 15621 E CrashlyticsCore: at com.crashlytics.android.core.CrashlyticsCore.doInBackground(CrashlyticsCore.java:45)
12-12 10:55:54.124 15540 15621 E CrashlyticsCore: at io.fabric.sdk.android.InitializationTask.doInBackground(InitializationTask.java:63)
12-12 10:55:54.124 15540 15621 E CrashlyticsCore: at io.fabric.sdk.android.InitializationTask.doInBackground(InitializationTask.java:28)
12-12 10:55:54.124 15540 15621 E CrashlyticsCore: at io.fabric.sdk.android.services.concurrency.AsyncTask$2.call(AsyncTask.java:311)
12-12 10:55:54.124 15540 15621 E CrashlyticsCore: at java.util.concurrent.FutureTask.run(FutureTask.java:237)
12-12 10:55:54.124 15540 15621 E CrashlyticsCore: at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:428)
我的配置如下:
在Application.java上
final Fabric fabric = new Fabric.Builder(this)
.kits(new Crashlytics(), new CrashlyticsNdk())
.debuggable(true)
.build();
Fabric.with(fabric);
在build.gradle上
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
crashlytics {
enableNdk true
// If using the Android plugin for Gradle version 2.2.0+ with the externalNativeBuild DSL,
// you should remove the androidNdkOut and androidNdkLibsOut properties, as these paths will
// automatically be detected by the Fabric plugin.
androidNdkOut 'src/main/obj'
androidNdkLibsOut 'src/main/libs'
manifestPath 'src/main/AndroidManifest.xml'
}
我尝试在本机代码上造成类似的崩溃:
throw std::runtime_error {"Please crash"} ;
崩溃多次发生,并且未报告本机崩溃。
PS:我正在使用crashlytics 2.9.6和crashlytics_ndk 2.0.5。 PSS:Java崩溃正常运行。
我想念什么吗?
答案 0 :(得分:0)
请确保您根据crashlytics-ndk的说明安装了正确的版本。
在02.14.2019:
implementation 'com.google.firebase:firebase-core:16.0.9'
implementation 'com.crashlytics.sdk.android:crashlytics:2.10.1'
implementation 'com.crashlytics.sdk.android:crashlytics-ndk:2.1.0'
在内容提供者的帮助下,还有火力发源initialize automatically! 因此,您应该从代码中删除Fabric初始化!