I have migrated my app to AndroidX. Everything works normally if I disable proguard. If I enable proguard, the app can build successfully but crashed when I open app.
Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'int java.lang.String.length()' on a null object reference at com.app.example.utils.da.a(Unknown Source:15) at com.app.exampler.utils.da.b(Unknown Source:10) at com.app.example.utils.da.a(Unknown Source:9) at com.app.example.base.MyApplication.onCreate(Unknown Source:2) at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1162) at android.app.ActivityThread.handleBindApplication(ActivityThread.java:6636) at android.app.ActivityThread.access$2000(ActivityThread.java:268) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1995) at android.os.Handler.dispatchMessage(Handler.java:109) at android.os.Looper.loop(Looper.java:207) at android.app.ActivityThread.main(ActivityThread.java:7539) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:524) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:958) 2019-07-25 07:14:46.903 1437-1437/? E/LoadedApk: Unable to instantiate appComponentFactory java.lang.ClassNotFoundException: Didn't find class "androidx.core.app.CoreComponentFactory" on path: DexPathList[[]
I tried some solution below but they didn't help.
proguard-rules.pro
-keep class androidx.core.app.CoreComponentFactory { *; }
manifest.xml
tools:replace="android:appComponentFactory"
android:appComponentFactory="whatevestring"
Anyone got the same issue like me? And how you resolve it? Thank you.
I got the same issue after enabling proguard. In my case the issue got resolved by cleaning the project. Try to run the app after cleaning.
Android Studio -> Build -> Clean Project
No need to add additional proguard rule or anything additional in manifest file.
Hope it helps!!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With