'Errors while building Signed Android App Bundle file. Execution failed for task ':app:signReleaseBundle' > 'other' has different root

I'm trying to generate Signed Android App Bundle to publish it on Google Play but I'm getting error in the process. The following error occurs when I try to Generate Signed Android App Bundle.

This error doesn't happen if I try to build Signed APK. This only occurs in case of Android App Bundle.

Note: Error occurs after I updated my android studio 3.6.3 to version 4.0 and Gradle build to 6.1.1.

There is a solution here : Generate Signed Bundle: Errors while building Bundle file. 'other' has different root

I tried that solution too of keeping the keystore path and release destination path same but with no luck again and again.

Any help will be much appreciated. Please help with all possible answers.

Executing tasks: [:app:bundleRelease] in project C:\Users\apoor\AndroidStudioProjects\SAID

> 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:createReleaseCompatibleScreenManifests UP-TO-DATE
> Task :app:extractDeepLinksRelease UP-TO-DATE
> Task :app:processReleaseManifest UP-TO-DATE
> Task :app:checkReleaseDuplicateClasses UP-TO-DATE
> Task :app:generateReleaseBuildConfig UP-TO-DATE
> Task :app:javaPreCompileRelease UP-TO-DATE
> Task :app:compileReleaseAidl NO-SOURCE
> Task :app:processReleaseResources
> Task :app:bundleReleaseResources
> Task :app:compileReleaseJavaWithJavac UP-TO-DATE
> Task :app:dexBuilderRelease UP-TO-DATE
> Task :app:desugarReleaseFileDependencies UP-TO-DATE
> Task :app:mergeExtDexRelease UP-TO-DATE
> Task :app:mergeDexRelease UP-TO-DATE
> Task :app:mergeReleaseShaders UP-TO-DATE
> Task :app:compileReleaseShaders NO-SOURCE
> Task :app:generateReleaseAssets UP-TO-DATE
> Task :app:mergeReleaseAssets UP-TO-DATE
> Task :app:processReleaseJavaRes NO-SOURCE
> Task :app:mergeReleaseJavaResource UP-TO-DATE
> Task :app:mergeReleaseJniLibFolders UP-TO-DATE
> Task :app:mergeReleaseNativeLibs UP-TO-DATE
> Task :app:stripReleaseDebugSymbols NO-SOURCE
> Task :app:buildReleasePreBundle
> Task :app:collectReleaseDependencies UP-TO-DATE
> Task :app:configureReleaseDependencies UP-TO-DATE
> Task :app:parseReleaseIntegrityConfig UP-TO-DATE
> Task :app:validateSigningRelease UP-TO-DATE
> Task :app:packageReleaseBundle
> Task :app:signReleaseBundle FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:signReleaseBundle'.
> A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
   > 'other' has different root

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 4s
27 actionable tasks: 5 executed, 22 up-to-date

Here is my app level build.gradle file :

apply plugin: 'com.android.application'

android {
    compileSdkVersion 29
    buildToolsVersion "29.0.3"

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }

    defaultConfig {
        applicationId "com.application.said"
        minSdkVersion 21
        targetSdkVersion 29
        multiDexEnabled true
        versionCode 1
        versionName "1.0"
        resConfig "en"

        bundle {
            language {
                enableSplit = false
            }
            density {
                enableSplit = true
            }
            abi {
                enableSplit = true
            }
        }

        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }

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

}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])

    implementation 'androidx.appcompat:appcompat:1.1.0'
    implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'androidx.test.ext:junit:1.1.1'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'

    //Google Material Design Library
    implementation 'com.google.android.material:material:1.2.0-beta01'

    //Android Jetpack Navigation
    def nav_version = "2.3.0-beta01"
    implementation "androidx.navigation:navigation-fragment:$nav_version"
    implementation "androidx.navigation:navigation-ui:$nav_version"

    //Third Party Libraries
    implementation 'com.shreyaspatil:MaterialDialog:2.1'
    implementation 'com.airbnb.android:lottie:3.4.0'
    implementation 'com.github.hajiyevelnur92:intentanimation:1.0'
    implementation "com.github.skydoves:powermenu:2.1.3"
}


Solution 1:[1]

Well, I've got the solution to this problem. Android Studio 4.0 has this weird bug that you've to select the KeyStore path and release destination folder in the root directory (C:/ or D:/ or E:/, whatever) same as where your project resides in order to generate the Signed App Bundle.

Like suppose you've got your project in the C:/ directory. Then, during selecting path for keystore and release destination folder for your signed app bundle, you've to be sure that the root directory for these paths should be C:/.

Why they have done this, there's no idea about that. But, this error is there in Android Studio 4.0, although only in case of Signed App Bundles. With Signed APKs, it is working pretty normal.

Solution 2:[2]

Add this to the gradle build an invalidate and restart cache (File -> Invalidate Caches / Restart) Use the previous solution (generating the bundle in the same directory as the key)

android {
lintOptions {
        checkReleaseBuilds false
        // Or, if you prefer, you can continue to check for errors in release builds,
        // but continue the build even when errors are found:
        abortOnError false
    }
....
}

.....

Solution 3:[3]

try this command before your APK build:

delete the raw + drawable-.. folders.

dont delete mipmap folders!

Solution 4:[4]

In my case I had missed to copy over the key.properties file from inside root/android when I migrated the project.

Solution 5:[5]

Just Rewrite your password, works everytime

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 2apoorva5
Solution 2 Lukas Novicky
Solution 3 slobodan
Solution 4 harlekintiger
Solution 5 kamal bundhoo