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";
}
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.
As workaround I set debuggable to true in the defaultConfig and in release I override the configuration and set debuggable to false.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With