简体   繁体   English

如何使用android studio使用proguard来混淆android .apk文件?

[英]How to obfuscate android .apk file using proguard using android studio?

I want to obfuscate my android apk file using proguard or any other method. 我想使用proguard或任何其他方法混淆我的android apk文件。 tried many ways including :- 尝试了很多方法,包括: -

  • copy-pasting proguard.txt and proguard-optimise.txt file from sdk folder (sdk-tools-progurad) to my app module within the project directory 从sdk文件夹(sdk-tools-progurad)复制粘贴proguard.txt和proguard-optimise.txt文件到项目目录中的app模块
  • I have written minifyEnabled=true in gradle file of app. 我在app的gradle文件中写了minifyEnabled = true。

After doing so facing further issue of some proguard errors giving warnings for external library class files. 在这样做之后,面临一些proguard错误的进一步问题,给出外部库类文件的警告。
Error : -Error:Execution failed for task ':app:transformClassesAndResourcesWithProguardForRelease'. 错误 :-Error:任务':app:transformClassesAndResourcesWithProguardForRelease'的执行失败。

java.io.IOException: Please correct the above warnings first. java.io.IOException:请先纠正上面的警告。

Even I am unable to generate signed apk. 即使我无法生成签名的apk。

It is strongly advised to investigate the warnings that ProGuard prints to the console and try to fix them. 强烈建议调查ProGuard打印到控制台并尝试修复它们的警告。 For this you will have to either include additional libraries or add -dontwarn directives to your proguard-project.txt file. 为此,您必须在proguard-project.txt文件中包含其他库或添加-dontwarn指令。

As a last resort, you can also use -ignorewarnings which will instruct ProGuard to continue regardless of any remaining warning. 作为最后的手段,您还可以使用-ignorewarnings来指示ProGuard继续,无论任何剩余警告。

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

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