Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android Studio ProGuard does not appear to run

I switched over from Eclipse to Android Studio in the last few days and have gotten most everything working. However, when I generate a signed APK it appears as though ProGuard is never running.

I am using the Generate Signed APK Wizard, selecting 'Run ProGuard' and specifying my proguard.cfg as the config file. The build process runs without errors and generates a functional apk, but that apk is 65% larger than the one generated by Eclipse. When I generate the apk through Android Studio's APK Wizard and do not select 'Run Proguard' the resulting apk is the same size as the one that should have had ProGuard run on it. No mapping.txt, seeds.txt, or usage.txt is generated anywhere in my project directory. I have tried adding

buildTypes {
    release {
        runProguard true
        proguardFile file('proguard.cfg')
        proguardFile getDefaultProguardFile('project-android.txt')
    }
}

and variations to my build.gradle file but that has had no effect either.

This is occurring on Android Studio 0.2.0, though I was seeing the same behavior on 0.1.9. I am working on Windows 7.

Can anyone tell me what might be going on? I would be happy if I could find the logs ProGuard is supposed to generate.

like image 697
mjanes Avatar asked Jul 15 '13 06:07

mjanes


People also ask

Where can I find ProGuard-Android TXT?

The getDefaultProguardFile('proguard-android. txt') method obtains the default ProGuard settings from the Android SDK tools/proguard/ folder. The proguard-android-optimize. txt file is also available in this Android SDK folder with the same rules but with optimizations enabled.

How do I get ProGuard mapping?

It should be located at build/outputs/proguard/release/mapping. txt in your application module's directory. In the latest version of ProGuard and Android Studio, the file is located at build/outputs/mapping/release/mapping. txt .


1 Answers

Just update your build.gradle

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

Details Reference. I hope it will helps you

like image 94
IntelliJ Amiya Avatar answered Oct 15 '22 07:10

IntelliJ Amiya