Android Studio 构建签名的Android应用程序捆绑包文件时出错,任务“:app:signReleaseBundle”>“other”具有不同的根目录,执行失败

nimxete2  于 2023-08-07  发布在  Android
关注(0)|答案(6)|浏览(184)

我正试图生成签名的Android应用程序捆绑在Google Play发布它,但我在这个过程中得到错误.当我尝试生成签名的Android应用程序包时,出现以下错误。
如果我尝试构建签名APK,则不会发生此错误。这仅发生在Android App Bundle的情况下。
注意:在我将Android Studio 3.6.3更新到4.0版本并将Gradle build更新到6.1.1之后发生错误。
这里有一个解决方案:Generate Signed Bundle: Errors while building Bundle file. 'other' has different root
我也尝试过保持密钥库路径和释放目标路径相同的解决方案,但一次又一次地没有运气。
任何帮助将不胜感激。请帮助所有可能的答案。

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

字符串
以下是我的应用级build.gradle文件:

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"
}

a1o7rhls

a1o7rhls1#

我有办法解决这个问题。Android Studio 4.0有一个奇怪的bug,你必须选择KeyStore路径,并在根目录(C:/或D:/或E:/,无论是什么)中的释放目标文件夹,与你的项目所在的位置相同,以便生成签名的应用程序包。
例如,假设你在C:/目录中有你的项目。然后,在为签名的应用程序包选择密钥库和发布目标文件夹的路径时,必须确保这些路径的根目录应为C:/。
他们为什么要这样做,没有人知道。但是,Android Studio 4.0中存在此错误,尽管仅适用于Signed App Bundles。有了签名的APK,它工作得很正常。

3xiyfsfu

3xiyfsfu2#

将其添加到gradle构建一个无效并重新启动缓存(文件->无效缓存/重新启动)使用以前的解决方案(在与密钥相同的目录中生成bundle)

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
    }
....
}

字符串
.....

6g8kf2rb

6g8kf2rb3#

在APK构建之前尝试此命令:
删除raw + drawable-..文件夹
不要删除mipmap文件夹!

kmpatx3s

kmpatx3s4#

在我的例子中,当我迁移项目时,我错过了从root/android内部复制key.properties文件。

bqujaahr

bqujaahr5#

100%正确解决方案

1.将您的密钥存储路径更改为C:\Users\yourUsername\Documents\abc.jks
1.单击下一步-将目标文件夹更改为驱动器C
这两个文件夹都应位于驱动器C中。就是这样如果它解决了你的问题,就投赞成票。

63lcw9qa

63lcw9qa6#

只需重写您的密码,工程每次

相关问题