首页 > 解决方案 > 不推荐使用 Progruard 和 R8 - Android Studio 3.6

问题描述

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

'android.enableR8' 选项已弃用,不应再使用。它将在未来版本的 Android Gradle 插件中删除,并且不再允许您禁用 R8。受影响的模块:等

标签: androidgradleproguardobfuscation

解决方案


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

No. You can use obfuscation and optimization tooling.

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

If you have android.enableR8 = true in your gradle.properties, remove it as R8 it the default tooling and the android.enableR8 setting itself is deprecated, causing these deprecation warnings.

If you have android.enableR8 = false to use proguard for optimiation and obfuscation, consider migrating to R8 instead.


推荐阅读