Android Studio 中的混淆 [英] Obfuscation in Android Studio

查看:30
本文介绍了Android Studio 中的混淆的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有任何混淆工具可用于 Android Studio?IntelliGuard 插件被 Studio

在混淆结果中,您将看到名称为:a,b,c....

混淆变量和方法的名称也将像 aa,c,ac...

  • 普通混淆:

要以更复杂的形式混淆代码,您可以转到根目录应用程序并创建一个 .pro 文件.例如在下图中我创建了文件:proguard-rules-new.pro.在同一目录中,您应该会看到一个名为 proguard-rules.pro 的文件

现在将您创建的文件添加到 build.gradle 文件中

并使用您自己的自定义 proguard 规则编辑您创建的 .pro 文件

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 build process is based on Gradle, so I wouldn't expect to see Ant support there at all. May be I'm wrong.

解决方案

  • Basic Obfuscation

To obfuscate code in Android studio just go to your build.gradle file in your Android Studio project:

Change the minifyEnabled property from false to true

This is a basic Obfuscation.

After generating the apk you can see the obfuscation result by decompiling the apk with any software. This page could help you:

http://www.decompileandroid.com/

In the obfuscation result you will see classes with name: a,b,c....

And the obfuscation variables and methods will have also names like aa,c,ac...

  • Normal obfuscation:

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 created the file: proguard-rules-new.pro. In the same directory you should see a file called proguard-rules.pro

Now add the file you have created to the build.gradle file

And edit the .pro file you have create with your own custom proguard rules

这篇关于Android Studio 中的混淆的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆