xamarin / AndroidSupportComponents

Xamarin bindings for Android Support libraries - For AndroidX see https://github.com/xamarin/AndroidX
MIT License
146 stars 56 forks source link

Activity hangs after java.lang.NoClassDefFoundError #207

Open sdebruyn opened 5 years ago

sdebruyn commented 5 years ago

OS & SDK version info

https://github.com/bitrise-io/bitrise.io/blob/e99ae1dac2792fdbff55b6e4d1d5268f1195d5da/system_reports/osx-vs4mac-stable.log

Support Libraries Version (eg: 23.3.0): 28.0.0.1

Describe your Issue

We have a Xamarin.Android app with MvvmCross 6.3.1, no Xamarin.Forms. Sometimes (probably race condition or lifecycle/memory related) our app hangs on the SplashActivity.

The SplashActivity does nothing more than continue to the next activity (let's call it LoginActivity) using the MvvmCross engine (AppStarter etc.).

About 95% of the time this works without issues. The issue never occurs when the app is completely closed (or when you force close it using the OS settings).

Sometimes the app does not continue from the SplashActivity and LoginActivity does not become visible. However, we notice in logcat that the views on LoginActivity are constructed as the MvvmCross bindings also output some logging information.

Steps to Reproduce (with link to sample solution if possible): not found yet, any help for finding a repro is welcome

Include any relevant Exception Stack traces, build logs, adb logs:

We have been able to capture the logs only once on a device with ADB enabled. We noticed that every time we tried to launch the app, the logs below were outputted.

  Rejecting re-init on previously-failed class java.lang.Class<android.support.v4.view.ViewCompat$OnUnhandledKeyEventListenerWrapper>: java.lang.NoClassDefFoundError: Failed resolution of: Landroid/view/View$OnUnhandledKeyEventListener;
    at void android.support.v4.view.ViewCompat.setOnApplyWindowInsetsListener(android.view.View, android.support.v4.view.OnApplyWindowInsetsListener) (ViewCompat.java:2203)
    at android.view.ViewGroup android.support.v7.app.AppCompatDelegateImpl.createSubDecor() (AppCompatDelegateImpl.java:637)
    at void android.support.v7.app.AppCompatDelegateImpl.ensureSubDecor() (AppCompatDelegateImpl.java:518)
    at void android.support.v7.app.AppCompatDelegateImpl.onPostCreate(android.os.Bundle) (AppCompatDelegateImpl.java:299)
    at void android.support.v7.app.AppCompatActivity.onPostCreate(android.os.Bundle) (AppCompatActivity.java:98)
    at void android.app.Instrumentation.callActivityOnPostCreate(android.app.Activity, android.os.Bundle) (Instrumentation.java:1293)
    at android.app.Activity android.app.ActivityThread.performLaunchActivity(android.app.ActivityThread$ActivityClientRecord, android.content.Intent) (ActivityThread.java:2956)
    at void android.app.ActivityThread.handleLaunchActivity(android.app.ActivityThread$ActivityClientRecord, android.content.Intent, java.lang.String) (ActivityThread.java:3059)
    at void android.app.ActivityThread.-wrap11(android.app.ActivityThread, android.app.ActivityThread$ActivityClientRecord, android.content.Intent, java.lang.String) (ActivityThread.java:-1)
    at void android.app.ActivityThread$H.handleMessage(android.os.Message) (ActivityThread.java:1724)
    at void android.os.Handler.dispatchMessage(android.os.Message) (Handler.java:106)
    at void android.os.Looper.loop() (Looper.java:164)
    at void android.app.ActivityThread.main(java.lang.String[]) (ActivityThread.java:7000)
    at java.lang.Object java.lang.reflect.Method.invoke(java.lang.Object, java.lang.Object[]) (Method.java:-2)
    at void com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run() (RuntimeInit.java:441)
    at void com.android.internal.os.ZygoteInit.main(java.lang.String[]) (ZygoteInit.java:1408)
  Caused by: java.lang.ClassNotFoundException: Didn't find class "android.view.View$OnUnhandledKeyEventListener" on path: DexPathList[[zip file "/data/app/be.belgianrail.btr.edrive.acceptance-IpwuVT9BKa64GRGdPHEq8Q==/base.apk"],nativeLibraryDirectories=[/data/app/be.belgianrail.btr.edrive.acceptance-IpwuVT9BKa64GRGdPHEq8Q==/lib/arm, /data/app/be.belgianrail.btr.edrive.acceptance-IpwuVT9BKa64GRGdPHEq8Q==/base.apk!/lib/armeabi-v7a, /system/lib, /system/vendor/lib]]
    at java.lang.Class dalvik.system.BaseDexClassLoader.findClass(java.lang.String) (BaseDexClassLoader.java:125)
    at java.lang.Class java.lang.ClassLoader.loadClass(java.lang.String, boolean) (ClassLoader.java:379)
    at java.lang.Class java.lang.ClassLoader.loadClass(java.lang.String) (ClassLoader.java:312)
    at void android.support.v4.view.ViewCompat.setOnApplyWindowInsetsListener(android.view.View, android.support.v4.view.OnApplyWindowInsetsListener) (ViewCompat.java:2203)
    at android.view.ViewGroup android.support.v7.app.AppCompatDelegateImpl.createSubDecor() (AppCompatDelegateImpl.java:637)
    at void android.support.v7.app.AppCompatDelegateImpl.ensureSubDecor() (AppCompatDelegateImpl.java:518)
    at void android.support.v7.app.AppCompatDelegateImpl.onPostCreate(android.os.Bundle) (AppCompatDelegateImpl.java:299)
    at void android.support.v7.app.AppCompatActivity.onPostCreate(android.os.Bundle) (AppCompatActivity.java:98)
    at void android.app.Instrumentation.callActivityOnPostCreate(android.app.Activity, android.os.Bundle) (Instrumentation.java:1293)
    at android.app.Activity android.app.ActivityThread.performLaunchActivity(android.app.ActivityThread$ActivityClientRecord, android.content.Intent) (ActivityThread.java:2956)
    at void android.app.ActivityThread.handleLaunchActivity(android.app.ActivityThread$ActivityClientRecord, android.content.Intent, java.lang.String) (ActivityThread.java:3059)
    at void android.app.ActivityThread.-wrap11(android.app.ActivityThread, android.app.ActivityThread$ActivityClientRecord, android.content.Intent, java.lang.String) (ActivityThread.java:-1)
    at void android.app.ActivityThread$H.handleMessage(android.os.Message) (ActivityThread.java:1724)
    at void android.os.Handler.dispatchMessage(android.os.Message) (Handler.java:106)
    at void android.os.Looper.loop() (Looper.java:164)
    at void android.app.ActivityThread.main(java.lang.String[]) (ActivityThread.java:7000)
    at java.lang.Object java.lang.reflect.Method.invoke(java.lang.Object, java.lang.Object[]) (Method.java:-2)
    at void com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run() (RuntimeInit.java:441)
    at void com.android.internal.os.ZygoteInit.main(java.lang.String[]) (ZygoteInit.java:1408)
sdebruyn commented 5 years ago

In the meantime, I'm updating to 28.0.0.3 in the hope that this might fix the issue. However, as this is very hard to reproduce or even capture the logs (99% of userbase has a very strict MDM), please give me some feedback if that might fix the issue or not :)

Redth commented 5 years ago

Unfortunately I highly doubt 28.0.0.3 vs 28.0.0.1 will fix anything here.

This looks like some issue on Google's end after a bit of searching.

What settings are you using for your TargetFrameworkVersion, and are you using multidex?

JensSchadron commented 5 years ago

We're using <TargetFrameworkVersion>v9.0</TargetFrameworkVersion> in our csproj and have multidex enabled.

Al1-0x3a commented 5 years ago

Almost the same here. SplashScreenActivity doesn't show anything because of some exception during "SetContentView". We're using v9.0 in our csproj and have multidex enabled like @JensSchadron.



10-22 15:15:31.967 I/art     (13938):   at void android.support.v4.view.ViewCompat.setOnApplyWindowInsetsListener(android.view.View, android.support.v4.view.OnApplyWindowInsetsListener) (ViewCompat.java:2203)
10-22 15:15:31.967 I/art     (13938):   at android.view.ViewGroup android.support.v7.app.AppCompatDelegateImpl.createSubDecor() (AppCompatDelegateImpl.java:637)
10-22 15:15:31.967 I/art     (13938):   at void android.support.v7.app.AppCompatDelegateImpl.ensureSubDecor() (AppCompatDelegateImpl.java:518)
10-22 15:15:31.967 I/art     (13938):   at void android.support.v7.app.AppCompatDelegateImpl.setContentView(int) (AppCompatDelegateImpl.java:466)
10-22 15:15:31.967 I/art     (13938):   at void android.support.v7.app.AppCompatActivity.setContentView(int) (AppCompatActivity.java:140)
10-22 15:15:31.967 I/art     (13938):   at void md50383f13e0a1cc8aa728bd0434ce54f15.SplashScreenActivity.n_onCreate(android.os.Bundle) (SplashScreenActivity.java:-2)
10-22 15:15:31.967 I/art     (13938):   at void md50383f13e0a1cc8aa728bd0434ce54f15.SplashScreenActivity.onCreate(android.os.Bundle) (SplashScreenActivity.java:39)
10-22 15:15:31.967 I/art     (13938):   at void android.app.Activity.performCreate(android.os.Bundle) (Activity.java:6679)
10-22 15:15:31.967 I/art     (13938):   at void android.app.Instrumentation.callActivityOnCreate(android.app.Activity, android.os.Bundle) (Instrumentation.java:1118)
10-22 15:15:31.967 I/art     (13938):   at android.app.Activity android.app.ActivityThread.performLaunchActivity(android.app.ActivityThread$ActivityClientRecord, android.content.Intent) (ActivityThread.java:2618)
10-22 15:15:31.967 I/art     (13938):   at void android.app.ActivityThread.handleLaunchActivity(android.app.ActivityThread$ActivityClientRecord, android.content.Intent, java.lang.String) (ActivityThread.java:2726)
10-22 15:15:31.967 I/art     (13938):   at void android.app.ActivityThread.-wrap12(android.app.ActivityThread, android.app.ActivityThread$ActivityClientRecord, android.content.Intent, java.lang.String) (ActivityThread.java:-1)
10-22 15:15:31.967 I/art     (13938):   at void android.app.ActivityThread$H.handleMessage(android.os.Message) (ActivityThread.java:1477)
10-22 15:15:31.967 I/art     (13938):   at void android.os.Handler.dispatchMessage(android.os.Message) (Handler.java:102)
10-22 15:15:31.967 I/art     (13938):   at void android.os.Looper.loop() (Looper.java:154)
10-22 15:15:31.967 I/art     (13938):   at void android.app.ActivityThread.main(java.lang.String[]) (ActivityThread.java:6119)
10-22 15:15:31.967 I/art     (13938):   at java.lang.Object java.lang.reflect.Method.invoke!(java.lang.Object, java.lang.Object[]) (Method.java:-2)
10-22 15:15:31.967 I/art     (13938):   at void com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run() (ZygoteInit.java:886)
10-22 15:15:31.967 I/art     (13938):   at void com.android.internal.os.ZygoteInit.main(java.lang.String[]) (ZygoteInit.java:776)
10-22 15:15:31.968 I/art     (13938): Caused by: java.lang.ClassNotFoundException: Didn't find class "android.view.View$OnUnhandledKeyEventListener" on path: DexPathList[[zip file "/data/app/com.<app package>-1/base.apk"],nativeLibraryDirectories=[/data/app/com.<app package>-1/lib/x86, /data/app/com.<app package>-1/base.apk!/lib/x86, /system/lib, /vendor/lib]]
10-22 15:15:31.968 I/art     (13938):   at java.lang.Class dalvik.system.BaseDexClassLoader.findClass(java.lang.String) (BaseDexClassLoader.java:56)
10-22 15:15:31.968 I/art     (13938):   at java.lang.Class java.lang.ClassLoader.loadClass(java.lang.String, boolean) (ClassLoader.java:380)
10-22 15:15:31.968 I/art     (13938):   at java.lang.Class java.lang.ClassLoader.loadClass(java.lang.String) (ClassLoader.java:312)
10-22 15:15:31.968 I/art     (13938):   at void android.support.v4.view.ViewCompat.setOnApplyWindowInsetsListener(android.view.View, android.support.v4.view.OnApplyWindowInsetsListener) (ViewCompat.java:2203)
10-22 15:15:31.968 I/art     (13938):   at android.view.ViewGroup android.support.v7.app.AppCompatDelegateImpl.createSubDecor() (AppCompatDelegateImpl.java:637)
10-22 15:15:31.968 I/art     (13938):   at void android.support.v7.app.AppCompatDelegateImpl.ensureSubDecor() (AppCompatDelegateImpl.java:518)
10-22 15:15:31.968 I/art     (13938):   at void android.support.v7.app.AppCompatDelegateImpl.setContentView(int) (AppCompatDelegateImpl.java:466)
10-22 15:15:31.968 I/art     (13938):   at void android.support.v7.app.AppCompatActivity.setContentView(int) (AppCompatActivity.java:140)
10-22 15:15:31.968 I/art     (13938):   at void md50383f13e0a1cc8aa728bd0434ce54f15.SplashScreenActivity.n_onCreate(android.os.Bundle) (SplashScreenActivity.java:-2)
10-22 15:15:31.968 I/art     (13938):   at void md50383f13e0a1cc8aa728bd0434ce54f15.SplashScreenActivity.onCreate(android.os.Bundle) (SplashScreenActivity.java:39)
10-22 15:15:31.968 I/art     (13938):   at void android.app.Activity.performCreate(android.os.Bundle) (Activity.java:6679)
10-22 15:15:31.968 I/art     (13938):   at void android.app.Instrumentation.callActivityOnCreate(android.app.Activity, android.os.Bundle) (Instrumentation.java:1118)
10-22 15:15:31.968 I/art     (13938):   at android.app.Activity android.app.ActivityThread.performLaunchActivity(android.app.ActivityThread$ActivityClientRecord, android.content.Intent) (ActivityThread.java:2618)
10-22 15:15:31.968 I/art     (13938):   at void android.app.ActivityThread.handleLaunchActivity(android.app.ActivityThread$ActivityClientRecord, android.content.Intent, java.lang.String) (ActivityThread.java:2726)
10-22 15:15:31.968 I/art     (13938):   at void android.app.ActivityThread.-wrap12(android.app.ActivityThread, android.app.ActivityThread$ActivityClientRecord, android.content.Intent, java.lang.String) (ActivityThread.java:-1)
10-22 15:15:31.968 I/art     (13938):   at void android.app.ActivityThread$H.handleMessage(android.os.Message) (ActivityThread.java:1477)
10-22 15:15:31.968 I/art     (13938):   at void android.os.Handler.dispatchMessage(android.os.Message) (Handler.java:102)
10-22 15:15:31.968 I/art     (13938):   at void android.os.Looper.loop() (Looper.java:154)
10-22 15:15:31.968 I/art     (13938):   at void android.app.ActivityThread.main(java.lang.String[]) (ActivityThread.java:6119)
10-22 15:15:31.968 I/art     (13938):   at java.lang.Object java.lang.reflect.Method.invoke!(java.lang.Object, java.lang.Object[]) (Method.java:-2)
10-22 15:15:31.968 I/art     (13938):   at void com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run() (ZygoteInit.java:886)
10-22 15:15:31.968 I/art     (13938):   at void com.android.internal.os.ZygoteInit.main(java.lang.String[]) (ZygoteInit.java:776)
10-22 15:15:31.968 I/art     (13938):