我的 android 应用程序需要在客户端安装一个项目模板,所以一旦用户点击生成 APK,它会修改该模板并创建一个 android 应用程序,APK 是使用 ANT 生成的,我担心的是我不想要客户端为了能够浏览项目并查看代码,我需要一种方法使该模板至少加密具有类的 SRC 文件夹,一旦用户单击生成 APK,它将在运行时解密,直到生成 APK ,那么它会再次被加密,有没有办法做到这一点?
注意:它将安装在 Windows 操作系统中
Enable ProGuard is release mode
To enable ProGuard so that it runs as part of an Ant or Eclipse build, set the proguard.config property in the /project.properties file. The path can be an absolute path or a path relative to the project's root.
The ProGuard tool shrinks, optimizes, and obfuscates your code by removing unused code and renaming classes, fields, and methods with semantically obscure names. The result is a smaller sized .apk file that is more difficult to reverse engineer. Because ProGuard makes your application harder to reverse engineer, it is important that you use it when your application utilizes features that are sensitive to security like when you are Licensing Your Applications.
Check the link below under the topic Enabling Proguard
http://developer.android.com/tools/help/proguard.html
Some useful links
http://proguard.sourceforge.net/index.html#manual/examples.html
您只需启用 proguard:http: //developer.android.com/tools/help/proguard.html
这是 ant 的示例:ANT build for Android Proguard obfuscation
这是一个很好的 tut:http ://www.androidengineer.com/2010/07/optimizing-obfuscating-and-shrinking.html
希望这可以帮助。
您实际上无法对其进行加密,因为这意味着在运行时更改 apk 文件以对其进行解密。谷歌可以阻止你的申请。您可以做的一件事是混淆您的代码,使其更难逆转。
ProGuard 不能加密 APK,但 DexGuard 可以。
它还更彻底地混淆了 APK。您可以在此处找到 ProGuard 和 DexGuard 之间差异的概述:。
(全面披露:我在开发 ProGuard 和 DexGuard 的公司 GuardSquare 工作。)