Android Studio中的混淆 [英] Obfuscation in Android Studio
问题描述
Android Studio 是否可以使用混淆工具? Studio已声明IntelliGuard插件被声明支持,但由于缺少AntSupport插件,该插件实际上不起作用.我无法在存储库中找到一个.有什么想法吗?
Is there any obfuscation tool to use with Android Studio? IntelliGuard plugin is declared to be supported by the Studio, but it doesn't work actually due to missing AntSupport plugin. I wan't able to find one in the repository. Any ideas?
P.S. Android Studio的构建过程基于Gradle,因此我完全不希望看到Ant的支持.可能是我错了.
P.S. Android Studio build process is based on Gradle, so I wouldn't expect to see Ant support there at all. May be I'm wrong.
推荐答案
- 基本混淆
- 正常混淆:
要在Android Studio中混淆代码,只需转到Android Studio项目中的build.gradle文件:
To obfuscate code in Android studio just go to your build.gradle file in your Android Studio project:
将minifyEnabled属性从false更改为true
Change the minifyEnabled property from false to true
这是基本问题.
生成apk后,您可以看到使用任何软件反编译apk的混淆结果,例如,此页面可以为您提供帮助:
After generating the apk you can see the obfuscation result decompilating the apk with any software, for example this page could help you:
http://www.decompileandroid.com/
在混淆结果中,您将看到名称为:a,b,c ...的类.
In the obfuscation result you will see classes with name: a,b,c....
混淆变量和方法的名称也将像aa,c,ac ...
And the obfuscation variables and methods will have also names like aa,c,ac...
要以更复杂的形式混淆代码,您可以转到根目录应用程序并创建一个.pro文件,例如,在下图中,我已经在同一目录中创建了文件:proguard-rules-new.pro您应该在目录中看到一个名为proguard-rules.pro
To obfuscate the code in a more complex form you could go to your root directory app and create a .pro file, for example in the following picture I have create the file: proguard-rules-new.pro, in the same directory you should see a file called proguard-rules.pro
现在将您创建的文件添加到build.gradle文件中
Now add the file you have created to the build.gradle file
并使用自己的自定义proguard规则编辑已创建的.pro文件
And edit the .pro file you have create with your own custom proguard rules
这篇关于Android Studio中的混淆的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!