26

以前是proguard是由project.properties控制的,现在已经不是这样了,Android文档也没有更新。project.properties 文件现在清楚地表明它是由 Android 工具生成的,并且更改将被删除。我试过注释掉 proguard.config 行,但是当我编译时,它会重写 project.properties,并继续使用 proguard。当前禁用proguard的方法是什么?谢谢!

# This file is automatically generated by Android Tools.
# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
#
# This file must be checked in Version Control Systems.
#
# To customize properties used by the Ant build system edit
# "ant.properties", and override values to adapt the script to your
# project structure.
#
# 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:proguard-google-api-client.txt

# Project target.
target=android-17
android.library.reference.1=../../../../android-sdk-linux/extras/google/google_play_services/libproject/google-play-services_lib
4

5 回答 5

32

设置这个

minifyEnabled false

在您的应用中build.gradle

像这样:

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

    }
于 2016-08-20T06:44:19.850 回答
24

 useProguard false

在您的应用程序 build.gradle

喜欢

  buildTypes {
    release {
        minifyEnabled false
        useProguard false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
}
于 2017-12-27T09:55:04.540 回答
11

您是否尝试将下一行添加到您的 proguard 配置文件(到文件的开头):

-dontobfuscate

?

于 2013-02-22T20:24:14.630 回答
9

尝试删除项目中的 proguard 目录。所以proguard会忘记它的映射。

于 2013-02-22T19:29:34.570 回答
0

根据React-Native Docs,要禁用 Proguard,请在 android/app/build.gradle 中将 def enableProguardInReleaseBuilds 设置为 false

/**
* Run Proguard to shrink the Java bytecode in release builds.
*/
def enableProguardInReleaseBuilds = false // Instead of true
于 2017-12-30T11:33:37.670 回答