如何使用proguard在cordova android应用程序 [英] How to use proguard in cordova android App

查看:786
本文介绍了如何使用proguard在cordova android应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个完成cordova项目,我想使用proguard,以防止其他人反向工程APK。但我有麻烦这样做。

I have a finished cordova project and i want to use proguard inorder to prevent others from reverse engineering the APK.But i have trouble doing this.


http://developer.android.com/tools/help/proguard.html

它说:当你创建一个Android项目时,proguard.cfg文件会自动生成在项目的根目录下。但我找不到这样的文件。

It says that "When you create an Android project, a proguard.cfg file is automatically generated in the root directory of the project. " But i cannot find a such file. So how do i apply proguard to my app?

谢谢

推荐答案

p>您需要从您的project.properties文件中取消注释以下行。

You need to uncomment below lines from your project.properties file

要启用ProGuard缩减和模糊化您的代码,请取消注释(可用属性:sdk.dir,user .home):

To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home):

proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt

此外,如果您使用Webview with JS,请取消注释proguard-project中的以下行.txt并指定JavaScript接口的完全限定类名
class:

Also, if you are using Webview with JS, uncomment following lines in proguard-project.txt and specify the fully qualified class name to the JavaScript interface class:

-keepclassmembers class com.your.package.YourJSInterfaceClass {
   public *;
}

这篇关于如何使用proguard在cordova android应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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