Xamarin.Android.Crashlytics 2.9.4.1-CrashlyticsCore上的NoClassDefFoundError

时间:2018-09-26 15:12:44

标签: visual-studio xamarin xamarin.forms xamarin.android crashlytics-android

我正在尝试构建Xamarin.Forms应用程序的Android发行版,但输出Apk在Crashlytics初始化时始终崩溃。 看来找不到com.crashlytics.android.core.CrashlyticsCore类。

调试版本的主要(可能是唯一的)区别是启用了Multidex。

我已经尝试解决添加这两行的问题:

com/crashlytics/android/Crashlytics.class
com/crashlytics/android/core/CrashlyticsCore.class

将构建操作设置为multidex.keep的{​​{1}}文件,但结果没有改变。

我正在通过MultiDexMainDexList MainAcvitity方法初始化Crashlytics:

OnCreate

堆栈跟踪:

Fabric.Fabric.With(this, new Crashlytics.Crashlytics());
Crashlytics.Crashlytics.HandleManagedExceptions();

Visual Studio for Mac版本:

[MonoDroid] UNHANDLED EXCEPTION:
[MonoDroid] Java.Lang.NoClassDefFoundError: com.crashlytics.android.core.CrashlyticsCore
[MonoDroid]   at Java.Interop.JniEnvironment+InstanceMethods.CallNonvirtualVoidMethod (Java.Interop.JniObjectReference instance, Java.Interop.JniObjectReference type, Java.Interop.JniMethodInfo method, Java.Interop.JniArgumentValue* args) [0x00089] in <34f201f6cca4421387fe7278a4375940>:0 
[MonoDroid]   at Java.Interop.JniPeerMembers+JniInstanceMethods.FinishCreateInstance (System.String constructorSignature, Java.Interop.IJavaPeerable self, Java.Interop.JniArgumentValue* parameters) [0x0004f] in <34f201f6cca4421387fe7278a4375940>:0 
[MonoDroid]   at Crashlytics.Crashlytics..ctor () [0x00054] in <114e650c181c4522b75b2d021c6a77a9>:0 
[MonoDroid]   at FollowFun.Droid.MainActivity.OnCreate (Android.OS.Bundle savedInstanceState) [0x00026] in <6c170c583d7f4be9a657f0283b3a6d04>:0 
[MonoDroid]   at Android.App.Activity.n_OnCreate_Landroid_os_Bundle_ (System.IntPtr jnienv, System.IntPtr native__this, System.IntPtr native_savedInstanceState) [0x00011] in <16a97b0d1e0a45cc9db76f74432e8848>:0 
[MonoDroid]   at (wrapper dynamic-method) System.Object.16(intptr,intptr,intptr)
[MonoDroid]   --- End of managed Java.Lang.NoClassDefFoundError stack trace ---
[MonoDroid] java.lang.NoClassDefFoundError: com.crashlytics.android.core.CrashlyticsCore
[MonoDroid]     at com.crashlytics.android.Crashlytics.<init>(Crashlytics.java:29)
[MonoDroid]     at md509b0a614f9e78774f77a51d8579dfa9f.MainActivity.n_onCreate(Native Method)
[MonoDroid]     at md509b0a614f9e78774f77a51d8579dfa9f.MainActivity.onCreate(MainActivity.java:38)
[MonoDroid]     at android.app.Activity.performCreate(Activity.java:5231)
[MonoDroid]     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
[MonoDroid]     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2148)
[MonoDroid]     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2233)
[MonoDroid]     at android.app.ActivityThread.access$800(ActivityThread.java:135)
[MonoDroid]     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196)
[MonoDroid]     at android.os.Handler.dispatchMessage(Handler.java:102)
[MonoDroid]     at android.os.Looper.loop(Looper.java:136)
[MonoDroid]     at android.app.ActivityThread.main(ActivityThread.java:5001)
[MonoDroid]     at java.lang.reflect.Method.invokeNative(Native Method)
[MonoDroid]     at java.lang.reflect.Method.invoke(Method.java:515)
[MonoDroid]     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:785)
[MonoDroid]     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601)
[MonoDroid]     at dalvik.system.NativeStart.main(Native Method)
[AndroidRuntime] Shutting down VM
[AndroidRuntime] FATAL EXCEPTION: main
[AndroidRuntime] Process: my.app, PID: 1441
[AndroidRuntime] java.lang.NoClassDefFoundError: com.crashlytics.android.core.CrashlyticsCore
[AndroidRuntime]    at com.crashlytics.android.Crashlytics.<init>(Crashlytics.java:29)
[AndroidRuntime]    at md509b0a614f9e78774f77a51d8579dfa9f.MainActivity.n_onCreate(Native Method)
[AndroidRuntime]    at md509b0a614f9e78774f77a51d8579dfa9f.MainActivity.onCreate(MainActivity.java:38)
[AndroidRuntime]    at android.app.Activity.performCreate(Activity.java:5231)
[AndroidRuntime]    at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
[AndroidRuntime]    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2148)
[AndroidRuntime]    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2233)
[AndroidRuntime]    at android.app.ActivityThread.access$800(ActivityThread.java:135)
[AndroidRuntime]    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196)
[AndroidRuntime]    at android.os.Handler.dispatchMessage(Handler.java:102)
[AndroidRuntime]    at android.os.Looper.loop(Looper.java:136)
[AndroidRuntime]    at android.app.ActivityThread.main(ActivityThread.java:5001)
[AndroidRuntime]    at java.lang.reflect.Method.invokeNative(Native Method)
[AndroidRuntime]    at java.lang.reflect.Method.invoke(Method.java:515)
[AndroidRuntime]    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:785)
[AndroidRuntime]    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601)
[AndroidRuntime]    at dalvik.system.NativeStart.main(Native Method)
[Process] Sending signal. PID: 1441 SIG: 9

Xamarin.Android版本:

Visual Studio Community 2017 for Mac
Version 7.6.7 (build 49)
Installation UUID: [...]
Runtime:
    Mono 5.12.0.301 (2018-02/4fe3280bba1) (64-bit)
    GTK+ 2.24.23 (Raleigh theme)
    Xamarin.Mac 4.4.1.178 (master / eeaeb7e6)

    Package version: 512000301

我已经通过NuGet在我的项目中安装了这些软件包:  -Xamarin.Android.Crashlytics 2.9.4.1  -Xamarin.Android.Crashlytics.Answers 1.4.2  -Xamarin.Android.Crashlytics.Beta 1.2.9  -Xamarin.Firebase.Core 60.1142.1

我已经尝试在Mac OS和Windows 10上都构建项目,结果是相同的崩溃。

我觉得我已经尽了一切,任何人有任何建议可以帮助我解决此问题?

1 个答案:

答案 0 :(得分:4)

不幸的是,poscorr=$("li").attr('id'); NuGet软件包依赖项似乎有问题。

您需要手动将Xamarin.Android.Crashlytics添加到项目中。

请参见this GitHub issue