Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

android bundleRelease does not sign the aab

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?

like image 632
tbeernot Avatar asked Jun 08 '19 08:06

tbeernot


3 Answers

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.

like image 146
inder_gt Avatar answered Oct 04 '22 08:10

inder_gt


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
        }
    }
like image 25
spiraldev Avatar answered Oct 04 '22 08:10

spiraldev


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.

like image 30
tbeernot Avatar answered Oct 04 '22 09:10

tbeernot