升级到androidX后,PlayStore崩溃ClassNotFoundException

时间:2020-05-09 01:19:10

标签: android gradle proguard classnotfoundexception androidx

使用以下堆栈跟踪升级到androidX后,我在playstore中崩溃了

java.lang.RuntimeException: 
  at android.app.ActivityThread.handleReceiver (ActivityThread.java:3960)
  at android.app.ActivityThread.access$1400 (ActivityThread.java:268)
  at android.app.ActivityThread$H.handleMessage (ActivityThread.java:1993)
  at android.os.Handler.dispatchMessage (Handler.java:107)
  at android.os.Looper.loop (Looper.java:237)
  at android.app.ActivityThread.main (ActivityThread.java:7811)
  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:1068)

Caused by: java.lang.ClassNotFoundException: 
  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.instantiateReceiver (AppComponentFactory.java:110)
  at androidx.core.app.CoreComponentFactory.instantiateReceiver (CoreComponentFactory.java:54)
  at android.app.ActivityThread.handleReceiver (ActivityThread.java:3953)
  at android.app.ActivityThread.access$1400 (ActivityThread.java:268)
  at android.app.ActivityThread$H.handleMessage (ActivityThread.java:1993)
  at android.os.Handler.dispatchMessage (Handler.java:107)
  at android.os.Looper.loop (Looper.java:237)
  at android.app.ActivityThread.main (ActivityThread.java:7811)
  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:1068)

这些是我崩溃的设备

Galaxy A30 (a30)
moto g(6) plus (evert_n)
OnePlus 7 (OnePlus7)
Galaxy Note9 (crownlte)
OnePlus 7T Pro 5G (OnePlus7TProNR)

gradle-wrapper.properties中的分发URL为5.6.4

我已通过在gradle.properties中添加以下内容进行升级

android.useAndroidX=true
android.enableJetifier=true

我已经尝试在Proguard中直接使用以下所有androidX类

-keep class androidx.core.** { *; }
-keep interface androidx.core.** { *; }

-keep class androidx.annotation.** { *; }
-keep interface androidx.annotation.** { *; }

-keep class androidx.fragment.** { *; }
-keep interface androidx.fragment.** { *; }

-keep class androidx.appcompat.** { *; }
-keep interface androidx.appcompat.** { *; }

-keep class androidx.core.** { *; }
-keep interface androidx.core.** { *; }

-keep class androidx.recyclerview.** { *; }
-keep interface androidx.recyclerview.** { *; }

-keep class androidx.drawerlayout.** { *; }
-keep interface androidx.drawerlayout.** { *; }

-keep class androidx.loader.** { *; }
-keep interface androidx.loader.** { *; }

编辑:我将此添加到了我的proguard文件

-keep class * { public private *; }

但是我仍然看到错误

0 个答案:

没有答案