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

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

问题描述

我有一个完成的科尔多瓦项目,我想使用 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文件."但是我找不到这样的文件.那么如何将 proguard 应用到我的应用中?

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?

谢谢

推荐答案

您需要从 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

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

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 *;
}

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

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