问题描述
今天,我将我的 Android Studio 更新到了 3.5.更新后,当我尝试运行该应用程序时,我发现以下警告.
Today, I updated my Android Studio to 3.5. After updated, I found below warning when I try to run the app.
规则 -keep public class * extendsandroidx.versionedparcelable.VersionedParcelable {();} 使用扩展但实际上匹配工具.
我知道警告与我的 proguard 规则有关.所以,我仔细检查了我的 proguard 规则文件,但我确定我没有添加该规则,它也不在我的 proguard 规则文件中.
I know warning is related with my proguard rules. So, I double checked my proguard rule file, but I am sure I didn't add that rule and it is not in my proguard rule file.
以下是我构建项目时的警告.
Below is the warning when I build the project.
我的项目使用的是 AndroidX.谁能知道可以跳过警告或警告来自哪里?任何想法或替代方式将不胜感激..
My project is using AndroidX. Can anyone know that warning can be skipped or where that warning came from? Any ideas or alternative ways will be appreciating..
推荐答案
这是 versionedparcelable.aar 1.0.0 版.这在 1.1.0 版中已修复,但是,如果您不使用依赖于新版本的库,您将在 Android Studio 3.5 中收到此警告.
It's a bug in the proguard.txt file in the versionedparcelable.aar version 1.0.0. This was fixed in version 1.1.0, however, if you're not using libraries that depends on the new version you'll get this warning in Android Studio 3.5.
在 1.0.0 版本中,proguard.txt 文件包含以下行:
In version 1.0.0 the proguard.txt file includes the following line:
-keep public class * extends androidx.versionedparcelable.VersionedParcelable
此问题已在 1.1.0 版中修复:
This was fixed in version 1.1.0:
-keep public class * implements androidx.versionedparcelable.VersionedParcelable
要绕过此问题,您可以通过在 build.gradle 中添加以下行来强制使用最新版本:
To bypass this issue you can force using the latest version by adding the following line to your build.gradle:
implementation "androidx.versionedparcelable:versionedparcelable:1.1.0"
这篇关于android studio 3.5 警告:规则`-keep public class * extends androidx.versionedparcelable.VersionedParcelable { <init>();}` 使用扩展的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!