Progruard 和 R8 被弃用 - Android Studio 3.6

Progruard and R8 being deprecated - Android Studio 3.6

将我的 Android Studio 升级到 3.6 后,我收到了关于 Proguard 和 R8 的弃用警告。这是否意味着我们不应该在我们的项目中使用混淆,或者在发布模式下构建时我们应该考虑另一个等效选项?

The option 'android.enableR8' is deprecated and should not be used anymore. It will be removed in a future version of the Android Gradle plugin, and will no longer allow you to disable R8. Affected Modules: etc

Does that mean we shouldn't use obfuscation in our projects

没有。您可以使用混淆和优化工具。

is there another equivalent option we should consider while building in release mode

如果您的 gradle.properties 中有 android.enableR8 = true,请将其作为默认工具 R8 删除,并且 android.enableR8 设置本身已被弃用,从而导致这些弃用警告。

如果您 android.enableR8 = false 使用混淆器进行优化和混淆,请考虑迁移到 R8。