8

I have the following code on my build.gradle:

productFlavors {
        juridico {
            applicationId "br.com.eit.appprovaconcursos"
        }
        enem {
            applicationId "com.ioasys.appprova"
        }
    }

    buildTypes {
        defaultConfig {
            debuggable false
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
        debug {
            debuggable true
            testCoverageEnabled true
        }
        release {
            debuggable false
            testCoverageEnabled true
            //noinspection GroovyAssignabilityCheck
            signingConfig signingConfigs.release
        }
    }

To generate de release APK I use the following command:

./gradlew assembleEnemRelease

When uploading the generated APK (app-enem-release.apk) on the Google Play I got the following error:

You uploaded a debuggable APK. For security reasons you need to disable debugging before it can be published in Google Play. Learn more about debuggable APKs.

I was able to generated a non-debuggable APK by hard coding on android Manifest android:debuggable="false". But the build config still acting like a debuggable build, as you can see in the generate Build.config (I double check and this build config is from the release folder, also I am not receiving any data on Crashlytics, and I disable it from Debug builds).

public final class BuildConfig {
  public static final boolean DEBUG = Boolean.parseBoolean("true");
  public static final String APPLICATION_ID = "com.ioasys.appprova";
  public static final String BUILD_TYPE = "release";
  public static final String FLAVOR = "enem";
  public static final int VERSION_CODE = 20135;
  public static final String VERSION_NAME = "3.0.1";
}
4
  • Same problem here... Apr 11, 2016 at 19:04
  • @Guiherme Torres Castro : Can you please try replacing your gradle file with this ideone.com/c376gt
    – dex
    Apr 11, 2016 at 19:12
  • I am giving the link because I am too not sure of answer but in this way I solved my problem.
    – dex
    Apr 11, 2016 at 19:12
  • @dex Thanks for the tip, unfortunately it didn't worked Apr 11, 2016 at 19:58

2 Answers 2

14

I found out this weird result comes from testCoverageEnabled true.

If your release build enabled test coverage, it generates coverage reports then your APK becomes debuggable APK.

Set testCoverageEnabled to false solve the problem, and it also make sense to not generating coverage reports on release build.

2
  • Lifesaver! Thank you! Oct 22, 2020 at 13:21
  • it would be better if You will report it to Google
    – murt
    Apr 1, 2021 at 20:34
3

As workaround I set debuggable to true in the defaultConfig and in release I override the configuration and set debuggable to false.

1
  • not sure it is a good idea to set debuggable true into release mode. It does not seem right Mar 17, 2020 at 17:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.