How do I disable proguard for building my Android app?-ThrowExceptions

Exception or error:

It used to be that proguard was controlled by project.properties, but that’s no longer the case, and the Android documentation has not been updated. The project.properties file now clearly states that the it is generated by Android Tools and changes will be erased. I’ve tried commenting out the proguard.config line, but when I compile, it rewrites the project.properties, and continues to use proguard. What is the current method of disabling proguard? Thanks!

# 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
How to solve:

Try to delete the proguard directory in your project. So proguard will forget its mapping.

###

set this

minifyEnabled false

in your app build.gradle

Like this:

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

    }

###

Have you tried to add the next line to your proguard configuration file (to the beginning of the file) :

-dontobfuscate

?

###

set

 useProguard false

in your app build.gradle

like

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

###

According to the React-Native Docs, To disable Proguard, set def enableProguardInReleaseBuilds to false in your android/app/build.gradle:

/**
* Run Proguard to shrink the Java bytecode in release builds.
*/
def enableProguardInReleaseBuilds = false // Instead of true

Leave a Reply

Your email address will not be published. Required fields are marked *