java.lang.IollegalAccessError由于类androidx.appcompat.widget.Ap



我最近将Android目标SDK版本从29更改为30。现在我得到了一个新的崩溃,上面写着以下

Fatal Exception: java.lang.IllegalAccessError: Interface androidx.core.widget.l implemented by class androidx.appcompat.widget.AppCompatImageView is inaccessible (declaration of 'androidx.appcompat.widget.AppCompatImageView' appears in /data/app/co.udhaar.app-aPVvUdO7b4lt8gLmAiy5kA==/base.apk)

堆栈跟踪:

Fatal Exception: java.lang.IllegalAccessError: Interface androidx.core.widget.l implemented by class androidx.appcompat.widget.AppCompatImageView is inaccessible (declaration of 'androidx.appcompat.widget.AppCompatImageView' appears in /data/app/co.udhaar.app-aPVvUdO7b4lt8gLmAiy5kA==/base.apk)
at androidx.appcompat.app.AppCompatDelegateImpl.createView(AppCompatDelegateImpl.java:1527)
at androidx.appcompat.app.AppCompatDelegateImpl.onCreateView(AppCompatDelegateImpl.java:1602)
at android.view.LayoutInflater.tryCreateView(LayoutInflater.java:1061)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:997)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:961)
at android.view.LayoutInflater.inflate(LayoutInflater.java:659)
at android.view.LayoutInflater.inflate(LayoutInflater.java:534)
at android.view.LayoutInflater.inflate(LayoutInflater.java:481)
at com.android.internal.policy.DecorView.onResourcesLoaded(DecorView.java:2757)
at com.android.internal.policy.PhoneWindow.generateLayout(PhoneWindow.java:2791)
at com.android.internal.policy.PhoneWindow.installDecor(PhoneWindow.java:2858)
at com.android.internal.policy.PhoneWindow.getDecorView(PhoneWindow.java:2167)
at androidx.appcompat.app.AppCompatDelegateImpl.createSubDecor(AppCompatDelegateImpl.java:864)
at androidx.appcompat.app.AppCompatDelegateImpl.ensureSubDecor(AppCompatDelegateImpl.java:806)
at androidx.appcompat.app.AppCompatDelegateImpl.setContentView(AppCompatDelegateImpl.java:693)
at androidx.appcompat.app.AppCompatActivity.setContentView(AppCompatActivity.java:170)
at androidx.databinding.DataBindingUtil.setContentView(DataBindingUtil.java:303)
at androidx.databinding.DataBindingUtil.setContentView(DataBindingUtil.java:284)
at co.udhaar.app.ui.splashScreen.SplashActivity.onCreate(SplashActivity.java:78)
at android.app.Activity.performCreate(Activity.java:7955)
at android.app.Activity.performCreate(Activity.java:7944)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1307)
at androidx.test.runner.MonitoringInstrumentation.callActivityOnCreate(MonitoringInstrumentation.java:2)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3531)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3703)
at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:83)
at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2216)
at android.os.Handler.dispatchMessage(Handler.java:107)
at android.os.Looper.loop(Looper.java:237)
at android.app.ActivityThread.main(ActivityThread.java:7948)
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)

渐变版本:

6.5

Gradle插件

4.0.0

以下是我的项目中的androidx依赖项

implementation "androidx.legacy:legacy-support-v4:1.0.0"
implementation "androidx.recyclerview:recyclerview:1.1.0"
implementation "androidx.appcompat:appcompat:1.1.0"
implementation "androidx.cardview:cardview:1.0.0"
implementation "androidx.constraintlayout:constraintlayout:1.1.3"
implementation "androidx.work:work-runtime-ktx:2.3.2"
implementation "androidx.annotation:annotation:1.1.0"
implementation "androidx.lifecycle:lifecycle-extensions:2.2.0"
implementation "androidx.multidex:multidex:2.0.1"
annotationProcessor "androidx.lifecycle:lifecycle-common-java8:2.2.0"

我在这个问题上左右为难。如果你们能给我们一些启示,那就太好了。提前感谢。。。

我不确定这个问题是否已经解决。我刚刚将这行代码添加到proguard-rules.pro文件中:

-保持类androidx.appcompat.**{*;}

最新更新