如何启用ProGuard的混淆Android Studio中? [英] How to Enabling ProGuard obfuscation in Android Studio?

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

问题描述

我必须让Proguard的混淆Android Studio中,以保护我的应用程序。我已经寻找如何应用它的进程,但我没有得到任何明确的解决方案。当我尝试它,我总是得到一个错误。因此,谁能告诉我明确的步骤,在我的应用程序应用它?

我通过以下步骤执行此操作:


  1. 在Android Studio中,打开一个Android项目。


  2. 切换到项目视图。


  3. 更​​改以下行:

    minifyEnable假 minifyEnable真正


  4. 设置ProGuard的规则(可选)

    4.1项目视图,选择proguard-rules.pro文件。

    4.2中添加以下行来告诉ProGuard的不要混淆某些类。

      -keepclassmembers类com.dom925.xxxx
    {
      上市 *
    }


错误,我按照获取步骤搜索


  

错误:执行失败的任务:应用程序:packageRelease。
  无法计算的D散列:\\ Android的\\ Pojectname \\程序\\编译\\中间体\\班,proguard的\\发布\\ classes.jar



解决方案

我想通了这个问题:

开拓proguard-rules.pro为您的项目,将其添加到底部:

  -dontwarn java.nio.file.Files
-dontwarn java.nio.file.Path
-dontwarn java.nio.file.OpenOption
-dontwarn组织。codehaus.mojo.animal_sniffer.IgnoreJRERequirement

我基本上是怎么解决的,这是我试图运行我的'释放'模式的应用程序,并得到了一堆类似这样的家伙在这里的错误:的 https://github.com/square/okio/issues/144

我pretty多跟着他所说的和固定的。

希望这可以帮助别人产生自己的APK的!

点击这里查看更多详细信息:

<一个href=\"http://stackoverflow.com/questions/31643339/errorexecution-failed-for-task-apppackagerelease-unable-to-compute-hash\">Error:Execution失败的任务:应用程序:packageRelease。 &GT;无法计算/../AndroidStudioProjects/../classes.jar哈希

I have to protect my app by enabling Proguard obfuscation in Android Studio. I have searched for the process of how to apply it but i did not get any clear solution. When i try it, i always get an error. So can anyone tell me the clear steps to apply it in my app?

I am doing this by the following steps:

  1. In Android Studio, open up an Android project.

  2. Change to Project View.

  3. Change the following line:

    minifyEnable false to minifyEnable true

  4. Set ProGuard Rules(optional)

    4.1 In Project View, select the proguard-rules.pro file.

    4.2 Add in the following lines to tell ProGuard not to obfuscate certain classes.

    -keepclassmembers class com.dom925.xxxx 
    {
      public *
    }
    

Error that I am getting by following the steps are

Error:Execution failed for task ':app:packageRelease'. Unable to compute hash of D:\Android\Pojectname\app\build\intermediates\classes-proguard\release\classes.jar

解决方案

I figured out the problem:

Open up the proguard-rules.pro for your project and add this to the bottom:

-dontwarn java.nio.file.Files
-dontwarn java.nio.file.Path
-dontwarn java.nio.file.OpenOption
-dontwarn org.codehaus.mojo.animal_sniffer.IgnoreJRERequirement

Basically how I solved it was this I tried to run my app in 'release' mode and got a bunch of errors similar to this guy here: https://github.com/square/okio/issues/144

I pretty much followed what he said and fixed it.

Hope this can help others with generating their APK's!

visit more detail here :

Error:Execution failed for task ':app:packageRelease'. > Unable to compute hash of /../AndroidStudioProjects/../classes.jar

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

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