12

I've written an Android app, but the final step in the release process is still eluding me. I assume that when I run gradle bundleRelease it will generate the aab file I can upload in the play store. But the play store says the bundle is unsigned. However, the build process says it is signing:

> Task :app:preBuild UP-TO-DATE
> Task :app:preReleaseBuild UP-TO-DATE
> Task :app:compileReleaseRenderscript NO-SOURCE
> Task :app:generateReleaseResValues UP-TO-DATE
> Task :app:generateReleaseResources UP-TO-DATE
> Task :app:mergeReleaseResources UP-TO-DATE
> Task :app:checkReleaseManifest UP-TO-DATE
> Task :app:createReleaseCompatibleScreenManifests UP-TO-DATE
> Task :app:mainApkListPersistenceRelease UP-TO-DATE
> Task :app:processReleaseManifest UP-TO-DATE
> Task :app:bundleReleaseResources UP-TO-DATE
> Task :app:checkReleaseDuplicateClasses UP-TO-DATE
> Task :app:mergeExtDexRelease UP-TO-DATE
> Task :app:compileReleaseAidl NO-SOURCE
> Task :app:generateReleaseBuildConfig UP-TO-DATE
> Task :app:prepareLintJar UP-TO-DATE
> Task :app:generateReleaseSources UP-TO-DATE
> Task :app:javaPreCompileRelease UP-TO-DATE
> Task :app:processReleaseResources UP-TO-DATE
> Task :app:compileReleaseJavaWithJavac UP-TO-DATE
> Task :app:transformClassesWithDexBuilderForRelease UP-TO-DATE
> Task :app:mergeDexRelease UP-TO-DATE
> Task :app:mergeReleaseShaders UP-TO-DATE
> Task :app:compileReleaseShaders UP-TO-DATE
> Task :app:generateReleaseAssets UP-TO-DATE
> Task :app:mergeReleaseAssets UP-TO-DATE
> Task :app:mergeReleaseJniLibFolders UP-TO-DATE
> Task :app:transformNativeLibsWithMergeJniLibsForRelease UP-TO-DATE
> Task :app:processReleaseJavaRes NO-SOURCE
> Task :app:transformResourcesWithMergeJavaResForRelease UP-TO-DATE
> Task :app:buildReleasePreBundle UP-TO-DATE
> Task :app:collectReleaseDependencies UP-TO-DATE
> Task :app:configureReleaseDependencies UP-TO-DATE
> Task :app:packageReleaseBundle UP-TO-DATE
> Task :app:signingConfigWriterRelease UP-TO-DATE
> Task :app:signReleaseBundle
> Task :app:bundleRelease

There is a signing section in the gradle build script:

android {
    ...
    signingConfigs {
        release {
            storeFile file(...)
            storePassword '...' 
            keyAlias '...'
            keyPassword '...'
        }
    }

If I delete all aab files prior to running the build, an app.aab is generated in

..\app\build\outputs\bundle\release

Seems all in order, except the play store won't accept the aab:

The Android App Bundle was not signed.

How do I build a releasable aab?

tbeernot
  • 2,473
  • 4
  • 24
  • 31
  • Did you click Generate Signed APK /Bundle? – A P Jun 09 '19 at 09:04
  • 2
    This is building from Gradle, not in the studio. But yes, I also attempted that as well, it also generated an aab (on a different location) and it also was not signed. However, that is how I released the 1.0.0 (now I was attempting the 1.1.0 release). – tbeernot Jun 09 '19 at 13:53
  • How did you manage to solve this? – Anton Shkurenko May 22 '20 at 10:36

5 Answers5

14

If anyone is still looking for a solution - Set debuggable to false in release config. Your app build gradle file should have following -

buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
            signingConfig signingConfigs.release
            debuggable = false
        }
    }
spiraldev
  • 171
  • 1
  • 3
  • 1
    make sure that `signingConfigs{...}` is before `buildTypes {...}` in your android/app/build.gradle – simUser Sep 02 '22 at 12:42
5

It seems I found the solution here How to create a release signed apk file using Gradle?, apparently an signingConfig entry is needed in the buildType. Below is how that blocks looks in my build file after adding it.

android {
    ...
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
            signingConfig signingConfigs.release
        }
    }
}

Is it weird that I expected that to already be there? Since I'm not a fan of either IntelliJ or Gradle, I'll chalk my feelings about the whole build and release process up to inexperience with the toolchain. Important is that the app is in the play store.

tbeernot
  • 2,473
  • 4
  • 24
  • 31
  • 1
    This does not work for me. Been trying varios ways, but when uploading AAB, Play Console still shows the package is not signed. – HX_unbanned Sep 18 '19 at 16:54
  • @Anton Shkurenko yes. Just enabled zipAlign in gradle.build and Built with v1 and v2 signing un Android Studio. – HX_unbanned Jun 03 '20 at 09:03
1

I had a similar issue where my flavor was being signed incorrectly. I had signing defaults specified in buildTypes and then overrides in productFlavors.

buildTypes { 
    stage { 
        signingConfig ... 
     } 
    release { 
        signingConfig ...
    }  
}

 productFlavors {
    myFlavor {
        signingConfig ...
    }

Running ./gradlew bundleMyFlavorStage was grabbing the wrong signingConfig from buildTypes.stage instead of the product flavor override. My solution was to remove signingConfig from buildTypes.stage and buildTypes.release and keep the override in the productFlavors.

inder_gt
  • 492
  • 1
  • 7
  • 9
-1

You can use ./gradlew :app:bundleRelease instead of ./gradlew bundleRelease

starball
  • 20,030
  • 7
  • 43
  • 238
TimLu
  • 1
-1

You can use ./gradlew signReleaseBundle instead of ./gradlew bundleRelease.

Zsolt Meszaros
  • 21,961
  • 19
  • 54
  • 57
  • As it’s currently written, your answer is unclear. Please [edit] to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Oct 28 '21 at 08:39