简体   繁体   English

如何仅关闭 Android R8 中的混淆?

[英]How to turn off only the obfuscation in Android R8?

I use Android Studio 3.3 Canary 5, Gradle 4.9, gradle plugin 3.3.0-alpha05我使用 Android Studio 3.3 Canary 5、Gradle 4.9、gradle 插件 3.3.0-alpha05

minifyEnabled true
useProguard false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'

Does't work.不起作用。


Edit:编辑:

@JakeWharton: "You use ProGuard configurations for this, not a Gradle DSL. Disable shrinking with -dontshrink, disable obfuscation with -dontobfuscate, and disable optimization with -dontoptimize." @JakeWharton:“您为此使用 ProGuard 配置,而不是 Gradle DSL。使用 -dontshrink 禁用收缩,使用 -dontobfuscate 禁用混淆,并使用 -dontoptimize 禁用优化。”

TLDL低密度脂蛋白

proguard-rules.pro proguard-rules.pro

-dontshrink
-dontobfuscate
-dontoptimize

In your gradle.properties file, add this line在您的gradle.properties文件中,添加这一行

 android.enableR8=false

This worked for me.这对我有用。

Following this answer , I was able to solve this issue.按照这个答案,我能够解决这个问题。 Instead of editing the build.gradle file, I added -dontobfuscate to the proguard-rules.pro file.相反编辑的build.gradle文件,我添加-dontobfuscateproguard-rules.pro文件。 (You can configure a different proguard rules file for debug and release builds.) This skipped the obfuscation step and allowed me to make shrink'd debug builds with R8. (您可以为调试和发布版本配置不同的proguard规则文件。)这跳过了混淆步骤,并允许我使用 R8 进行收缩的调试版本。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM