Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I disable proguard for building my Android app?

Tags:

android

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 
like image 843
piusvelte Avatar asked Feb 22 '13 19:02

piusvelte


People also ask

Is ProGuard enabled by default?

When you create a new module using Android Studio, the IDE creates a proguard-rules.pro file in the root directory of that module. By default, this file does not apply any rules. So, include your own ProGuard rules here, such as your custom keep rules.

Do I need ProGuard?

Why Proguard for Android? Android apps are quite easy to reverse engineer, so if you want to prevent this from happening, you should use Proguard for its main function: Obfuscation. The other two important functions of Proguard are Shrinking and Optimization. Shrinking eliminates unused codes and it is highly useful.

Why do we use ProGuard in Android?

ProGuard is a tool to help minify, obfuscate, and optimize your code. It is not only especially useful for reducing the overall size of your Android application as well as removing unused classes and methods that contribute towards the intrinsic 64k method limit of Android applications.

What is ProGuard in APK?

Proguard is a java tool that is present in Android and it is used to reduce your app size. It is a free tool that will help you to reduce your app size by 8.5 %. Proguard will convert your app's code into optimized Dalvik bytecode.


2 Answers

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'         }      } 
like image 88
ahmadalibaloch Avatar answered Oct 05 '22 23:10

ahmadalibaloch


set

 useProguard false 

in your app build.gradle

like

  buildTypes {     release {         minifyEnabled false         useProguard false         proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'     } } 
like image 32
Alex Avatar answered Oct 06 '22 00:10

Alex