【问题标题】:Unable to build a Release Signed Bundle(.aab) even though release.keystore file is exists即使存在 release.keystore 文件,也无法构建 Release Signed Bundle(.aab)
【发布时间】:2022-12-16 06:37:59
【问题描述】:

我不小心删除了.android文件夹。然后我从我的 Mac 中完全删除了Android Studio,然后重新安装。然后我尝试从Build -> Generate Signed Bundle / APK创建release signed bundle,并提供所有必需的详细信息,如release keystore文件路径、aliaspassword。然后我厌倦了使用以下命令从.aab生成.apk

sudo bundletool build-apks --bundle=<.aab location> --output=<.apk location>

然后我在终端中收到以下消息

INFO: The APKs will be signed with the debug keystore found at '/Users/<myfolder>/.android/debug.keystore'.

从上面的消息我了解到,keystore 文件是从.android 文件夹中获取的。但是在我的.android 文件夹中只有debug.keystore 文件可用,而没有release.keystore 文件。

我认为这就是我无法生成 release signed bundle 的原因。如果我是对的,

  1. 如何将release.keystore文件放入.android文件夹(我在android/app/release.keystore中有release.keystore的副本)?

    注意:自删除.android 文件夹后,我无法生成release signed bundle。在那之前一切都很好。

【问题讨论】:

  • 你在发电的时候签名捆绑包/ APK你有任何错误或警告吗
  • 为什么要使用sudo 进行构建?这根本没有任何意义。

标签: android android-studio apk android-app-bundle


【解决方案1】:

build.gradle模块应用中,添加以下几行代码:

signingConfigs {
   release {
       storeFile file('YOUR_KEYSTORE_FILE')
       storePassword YOUR_STORE_PASSWORD
       keyAlias YOUR_KEY_ALIAS
       keyPassword YOUR_KEY_PASSWORD
   }
}

buildTypes {
        release {
            signingConfig signingConfigs.release
        }
}

然后重试 build aab 命令。

【讨论】:

    猜你喜欢
    • 2021-10-30
    • 2020-09-29
    • 1970-01-01
    • 2020-05-19
    • 1970-01-01
    • 1970-01-01
    • 2021-06-02
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多