3

I am truly at a loss, my app randomly now has this crash report on crashlytics and I can't seem to duplicate it or even figure out where it would be crashing because it doesn't tell me. It just started giving me these crashes last week. My min sdk is 24, I have tried to target 29 & 30 and the crashes still appear. Can anyone hint how I can actually track this down since it doesn't appear on my device directly or where I could maybe start to look? No where in my project do I use WorkManagerInitializer unless it is part of a library that I don't know about.

Fatal Exception: java.lang.RuntimeException: Unable to get provider androidx.work.impl.WorkManagerInitializer: java.lang.ClassNotFoundException: Didn't find class "androidx.work.impl.WorkManagerInitializer" on path: DexPathList[[zip file "/data/app/com.myapp-TEzM5SrnhKhfsdQ-sNWHsQ==/base.apk"],nativeLibraryDirectories=[/data/app/com.myapp-TEzM5SrnhKhfsdQ-sNWHsQ==/lib/arm64, /system/lib64]]
   at android.app.ActivityThread.installProvider(ActivityThread.java:7462)
   at android.app.ActivityThread.installContentProviders(ActivityThread.java:7002)
   at android.app.ActivityThread.handleBindApplication(ActivityThread.java:6890)
   at android.app.ActivityThread.access$1300(ActivityThread.java:269)
   at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2010)
   at android.os.Handler.dispatchMessage(Handler.java:107)
   at android.os.Looper.loop(Looper.java:237)
   at android.app.ActivityThread.main(ActivityThread.java:7860)
   at java.lang.reflect.Method.invoke(Method.java)
   at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1075)

Caused by java.lang.ClassNotFoundException: Didn't find class "androidx.work.impl.WorkManagerInitializer" on path: DexPathList[[zip file "/data/app/com.myapp-TEzM5SrnhKhfsdQ-sNWHsQ==/base.apk"],nativeLibraryDirectories=[/data/app/com.myapp-TEzM5SrnhKhfsdQ-sNWHsQ==/lib/arm64, /system/lib64]]
   at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:196)
   at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
   at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
   at android.app.AppComponentFactory.instantiateProvider(AppComponentFactory.java:147)
   at androidx.core.app.CoreComponentFactory.instantiateProvider(CoreComponentFactory.java:67)
   at android.app.ActivityThread.installProvider(ActivityThread.java:7446)
   at android.app.ActivityThread.installContentProviders(ActivityThread.java:7002)
   at android.app.ActivityThread.handleBindApplication(ActivityThread.java:6890)
   at android.app.ActivityThread.access$1300(ActivityThread.java:269)
   at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2010)
   at android.os.Handler.dispatchMessage(Handler.java:107)
   at android.os.Looper.loop(Looper.java:237)
   at android.app.ActivityThread.main(ActivityThread.java:7860)
   at java.lang.reflect.Method.invoke(Method.java)
   at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1075)
Jayce
  • 781
  • 3
  • 16
  • 35
  • Possible duplicate: https://stackoverflow.com/questions/64588254/classnotfoundexception-androidx-work-impl-workmanagerinitializer – sagis Dec 07 '20 at 06:36

2 Answers2

3

The solution is to add this line to your proguard file:

-keep class androidx.work.** { *; }
Justin
  • 17,670
  • 38
  • 132
  • 201
0

The problem was caused by multiDexEnabled true which I had in defaultConfig for unknown reasons. I found it out after some digging and this issue

If the above doesn't help then try this

Gradle

multiDexEnabled true

Java

public class MyApp extends Application {

@Override
protected void attachBaseContext(Context base) {
    super.attachBaseContext(base);
    MultiDex.install(this);
}
Shoaib Kakal
  • 1,090
  • 2
  • 16
  • 32
  • I seen that tracker issue, but I do not use `multiDexEnabled ` so I find it would be very strange to all of a sudden appear. – Jayce Dec 03 '20 at 12:53