在调试模式下是否可以使用proguard? [英] Is it possible to use proguard in debug mode?

查看:135
本文介绍了在调试模式下是否可以使用proguard?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我不需要真正的调试它,但我想要proguard当我撞上日食时跑跑。我不想每次导出二进制(所以在发布模式下)并保存为apk,并将其存入设备进行测试。



有没有办法以这种方式运行proguard?



更新:



看起来像这样如果您使用 Eclipse 作为问题标题不包括Eclipse,有这个问题的多个正确答案。

解决方案

旧答案:



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



ProGuard仅在您在发布模式下构建应用程序时运行,因此在构建应用程序时不需要处理模糊的代码在调试模式下。



当您以释放模式构建应用程序时,无论是通过运行ant版本还是通过使用Eclipse中的导出向导,构建系统自动检查proguard.config属性是否设置。如果是这样,ProGuard会在将所有内容打包成.apk文件之前自动处理应用程序的字节码。



更新:13-3-2016

strong>



可以使用新的gradle构建系统。您需要在build.gradle文件中将minifyenabled设置为true。一般来说,你的防守在发布模式下运行。还有其他选项可用,如缩减资源。你可以找到一些有用的信息@ http://tools.android.com/tech-docs/new-build - 系统



另外看看@



  android {
...
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile proguard-android.txt'),'proguard-rules.pro'
}
调试{

minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt' ),'proguard-rules.pro'
}
}
}


In my android app, i want to test some features with proguard on.

I don't need to really "debug" it, but i want proguard to run when i hit run in eclipse. I don't want to export the binary every time (so, in release mode) and save as apk and get it to the device to test.

Is there any way to run proguard in this way?

Update:

It seems like this is possible if you are not using Eclipse; as question title does not include Eclipse, there are multiple correct answers to this question.

解决方案

Old Answer :

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

ProGuard runs only when you build your application in release mode, so you do not have to deal with obfuscated code when you build your application in debug mode.

When you build your application in release mode, either by running ant release or by using the Export Wizard in Eclipse, the build system automatically checks to see if the proguard.config property is set. If it is, ProGuard automatically processes the application's bytecode before packaging everything into an .apk file. Building in debug mode does not invoke ProGuard, because it makes debugging more cumbersome.

Update: 13-3-2016

It is possible with the new gradle build system. You need to set minifyenabled to true in your build.gradle file. Generally you have pro-guard running in release mode. There are other options available like shrinking resources. You can find some useful info @ http://tools.android.com/tech-docs/new-build-system

Also do have a look @

http://developer.android.com/tools/building/configuring-gradle.html

 android {
   ...
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
     debug {

        minifyEnabled true
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
   }
 }

这篇关于在调试模式下是否可以使用proguard?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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