AppLovin / AppLovin-MAX-SDK-Android

Other
233 stars 104 forks source link

Unable to get provider androidx.startup.InitializationProvider: androidx.startup.StartupException: #671

Closed jesphinpt closed 2 weeks ago

jesphinpt commented 6 months ago

MAX SDK Version

12.5.0

Device/Platform Info

Android

Current Behavior

AppOpen crashes the app with the below error

Process: com.example.test_environment, PID: 14782
java.lang.RuntimeException: Unable to get provider androidx.startup.InitializationProvider: androidx.startup.StartupException: java.lang.ClassNotFoundException: androidx.startup
at android.app.ActivityThread.installProvider(ActivityThread.java:7467)
at android.app.ActivityThread.installContentProviders(ActivityThread.java:6973)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:6744)

Expected Behavior

it needs to show the appopen ads

How to Reproduce

Add the AppOpen and the LifeCycle recycler it will crash on launching the app.

Additional Info

No response

Vedant-Mehta39 commented 6 months ago

Hi @jesphinpt ,

Could you provide additional steps to reproduce this error? Additionally if you could provide some logs leading up to the crash, that would be helpful too.

jesphinpt commented 6 months ago

@Vedant-Mehta39 Error log for the above

 Process: com.exmple.test_environment, PID: 2544
java.lang.RuntimeException: Unable to get provider androidx.startup.InitializationProvider: androidx.startup.StartupException: androidx.startup.StartupException: java.lang.NoClassDefFoundError: Failed resolution of: Landroidx/lifecycle/ReportFragment$ActivityInitializationListener;at android.app.ActivityThread.installProvider(ActivityThread.java:7467)at android.app.ActivityThread.installContentProviders(ActivityThread.java:6973)at android.app.ActivityThread.handleBindApplication(ActivityThread.java:6744)at android.app.ActivityThread.-$$Nest$mhandleBindApplication(Unknown Source:0)at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2133)at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loopOnce(Looper.java:201)
at android.os.Looper.loop(Looper.java:288)
 at android.app.ActivityThread.main(ActivityThread.java:7872)
 at java.lang.reflect.Method.invoke(Native Method)
 at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:936)
 Caused by: androidx.startup.StartupException: androidx.startup.StartupException: java.lang.NoClassDefFoundError: Failed resolution of: Landroidx/lifecycle/ReportFragment$ActivityInitializationListener;
at androidx.startup.AppInitializer.doInitialize(AppInitializer.java:187)
at androidx.startup.AppInitializer.discoverAndInitialize(AppInitializer.java:238)
 at androidx.startup.AppInitializer.discoverAndInitialize(AppInitializer.java:206)
 at androidx.startup.InitializationProvider.onCreate(InitializationProvider.java:45)
 at android.content.ContentProvider.attachInfo(ContentProvider.java:2451)
 at android.content.ContentProvider.attachInfo(ContentProvider.java:2421)
 at android.app.ActivityThread.installProvider(ActivityThread.java:7462)
at android.app.ActivityThread.installContentProviders(ActivityThread.java:6973) 
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:6744) 
at android.app.ActivityThread.-$$Nest$mhandleBindApplication(Unknown Source:0) 
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2133) 
 at android.os.Handler.dispatchMessage(Handler.java:106) 
at android.os.Looper.loopOnce(Looper.java:201) 
at android.os.Looper.loop(Looper.java:288) 
at android.app.ActivityThread.main(ActivityThread.java:7872) 
at java.lang.reflect.Method.invoke(Native Method) 
 at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:936) 
Caused by: androidx.startup.StartupException: java.lang.NoClassDefFoundError: Failed resolution of: Landroidx/lifecycle/ReportFragment$ActivityInitializationListener;
     by: java.lang.ClassNotFoundException: Didn't find class "androidx.lifecycle.ReportFragment$ActivityInitializationListener" on path: DexPathList[[zip file "/data/app/~~GYvWUX26cCs1WuwDNjzF2g==/com.example.test_environment-b15gNCqSdNKLQQcZ4WxnBQ==/base.apk"],nativeLibraryDirectories=[/data/app/~~GYvWUX26cCs1WuwDNjzF2g==/com.example.test_environment-b15gNCqSdNKLQQcZ4WxnBQ==/lib/arm64, /data/app/~~GYvWUX26cCs1WuwDNjzF2g==/com.example.test_environment-b15gNCqSdNKLQQcZ4WxnBQ==/base.apk!/lib/arm64-v8a, /system/lib64, /system_ext/lib64]]
                                                                                                        at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:259)
                                                                                                        at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
Vedant-Mehta39 commented 6 months ago

@jesphinpt Based on the stack trace, the issue seems to be related to the androidx.startup library.

There is an open issue regarding this error here. You may follow that issue tracker for more guidance.

Some people found that removing android:hasCode="false" from the merged manifest fixed the issue, so you could try that if you encounter it.

jesphinpt commented 6 months ago

@Vedant-Mehta39 Unable to access the link which you have updated above. here is an open issue regarding this error [here](https://issuetracker.google.com/issues/209387755).

I don't have the android:hasCode="false" value in the AndroidManifest file.

Any other solution would be helpful.

Vedant-Mehta39 commented 5 months ago

@jesphinpt Interesting, that link does open for me.

Another thing they mention is to ensure that InitializationProvider from android.startup is in the primary dex (classes.dex file). Their latest version androidx.startup:startup-runtime:1.1.1 should have a fix for that, but do note that some users still report an issue with the latest version.

If you still see the error, it would be worth opening an issue with them.

github-actions[bot] commented 3 weeks ago

This issue is stale because it has been open for 30 days with no activity.

github-actions[bot] commented 2 weeks ago

This issue was closed because it has been inactive for 5 days since being marked as stale.