如何禁用proguard来构建我的Android应用程序?

时间:2013-02-22 19:03:52

标签: android

过去,proguard是由project.properties控制的,但现在不再是这种情况了,Android文档还没有更新。 project.properties文件现在清楚地表明它是由Android Tools生成的,并且更改将被删除。我已经尝试注释了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

5 个答案:

答案 0 :(得分:16)

设置此

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'
        }

    }

答案 1 :(得分:9)

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

答案 2 :(得分:9)

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

-dontobfuscate

答案 3 :(得分:4)

 useProguard false
你的app build.gradle

中的

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

答案 4 :(得分:1)

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

convenience init(baseGeometry: SCNGeometry?,              //character
                 bones: [SCNNode],                        //array of bones
                 boneInverseBindTransforms: [NSValue]?,   //ibt of matrix4
                 boneWeights: SCNGeometrySource,          //influence on geometry
                 boneIndices: SCNGeometrySource           //index mapping
                 )