Search code examples
androidandroid-studioandroid-gradle-pluginbuild.gradleandroid-studio-2.0

Android Studio: Why is Release Build debuggable?


I've been trying for hours to generate a release build with Android Studio that is not debuggable so that I can upload it to Google Play. But sadly this is not working. When I try to upload the apk I get the following error:

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

This is not a duplicate. I have tried everything suggested in related questions...

Update

I have decoded the generated apk. The BuildConfig.class looks like this:

public final class BuildConfig
{
  public static final String APPLICATION_ID = "com.myapplication.packagename";
  public static final String BUILD_TYPE = "release";
  public static final boolean DEBUG = false;
  public static final String FLAVOR = "";
  public static final int VERSION_CODE = 2;
  public static final String VERSION_NAME = "1.0.1";
}

So the build type is actually release and debug is set to false!

But inside the AndroidManifest.xml, gradle has put

<application android:debuggable="true"...

Debuggable is set to true! How come!?


Solution

  • I could finally find the reason and solve the issue!

    The reason was that I had library modules referenced which had an AndroidManifest.xml with debuggable="true" tag present. I have changed those to "false" and it works now!

    I have no idea why Android Studio chooses this "info" over the gradle settings... Anyway I'm very glad that it works now!