1

I have been successfully generating signed apk for my application and distributing it locally within my team. But suddenly two days before I couldnt generate signed apk. When I change the build variable to "release" the gradle invocation finished without any error or warning. But when creating signed apk I get the following error:

Information:Compilation completed with 1 error and 0 warnings in 11 sec
Information:1 error
Information:0 warnings
Error:Gradle: Execution failed for task ':module_name:proguardRelease'.
    > java.io.IOException: Please correct the above warnings first.

build.gradle:

apply plugin: 'android'

android {
    compileSdkVersion 19
    buildToolsVersion '19.1.0'
    defaultConfig {
        minSdkVersion 17
        targetSdkVersion 19
        versionCode 1
        versionName '1.0'
    }
    signingConfigs {
        release {
            storeFile file('release.keystore')
            storePassword '*************'
            keyAlias '*********'
            keyPassword '**************'
        }
    }
    buildTypes {
        release {
            runProguard true
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
        }
    }
    productFlavors {
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile files('libs/volley.jar')
    compile files('libs/StarIOPort3.1.jar')
    compile files('libs/logentries-android-2.1.2.jar')
    compile 'com.android.support:appcompat-v7:19.1.0'
    compile 'com.android.support:support-v4:19.1.0'
    compile 'com.google.android.gms:play-services:+'
    compile 'com.wrapp.floatlabelededittext:library:0.0.3'
}

Where can I see the warnings? There are no warnings in the "Messages". Also in the gradle console.

What is causing this? How can I fix this?

LoveMeSomeFood
  • 3,137
  • 7
  • 30
  • 53
  • What does your gradle file look like? Are you using android studio to build or what's your ide? Try disabling pro-guard in your build.gradle file. – Seth Oct 03 '14 at 19:12
  • I'm using Android Studio. Disabling pro-guard for the release build is not a good idea. – LoveMeSomeFood Oct 03 '14 at 19:41
  • Disabling it isn't the best idea maybe but if progaurd is causing the problem then you'll want to know. – Seth Oct 03 '14 at 19:57
  • try running `gradlew build --stacktrace` cmd line in your project root. – ashoke Oct 03 '14 at 20:11
  • @Seth disabling pro-gaurd worked. So the problem is with that.? – LoveMeSomeFood Oct 03 '14 at 20:47
  • The problem is when the compiler (gradle) runs pro-guard. You need to read the pro-guard docs to see if your missing anything. I found that the documentation provided by Google is suficiant for most cases. http://developer.android.com/tools/help/proguard.html I'll be honest and say up front that i don't know a whole lot about it but i'm just trying to help. – Seth Oct 03 '14 at 21:02
  • @ashoke how should I do that? – LoveMeSomeFood Oct 04 '14 at 16:57

1 Answers1

1

If you use windows, open a cmd prompt, and cd to the root of your project. There should be gradlew.bat in it (automatically created by Android Studio). Try and run gradlew.bat clean assembleRelease -d to see the proguard warnings.

You will need to fix these proguard warnings before it lets you do a successful build. You can fix them by adding -dontwarn org.apache.* (or similar related to your warnings) to your project proguard file release section.

Community
  • 1
  • 1
ashoke
  • 6,441
  • 2
  • 26
  • 25
  • `Warning:Gradle: com/google/android/gms/gcm/GoogleCloudMessaging.class(com/google/android/gms/gcm:GoogleCloudMessaging.class): major version 51 is newer than 50, the highest major version supported by this compiler.` How can I fix this? – LoveMeSomeFood Oct 07 '14 at 13:14
  • @Rani please try with compile 'com.google.android.gms:play-services:5.0.+' – ashoke Oct 08 '14 at 00:26