我正在使用AWS代码构建和代码管道为React原生Android移动的应用程序开发一个CICD管道。
构建调试包(./gradlew bundleDebug
)时,生成的.aab
文件未签名:
>keytool -printcert -jarfile app-debug.aab
Not a signed jar file
当我构建一个发布包(./gradlew bundleRelease
)时,生成的.aab
文件被正确签名。
这是我的build.gradle的相关部分:
signingConfigs {
debug {
storeFile file('debug.keystore')
storePassword 'android'
keyAlias 'androiddebugkey'
keyPassword 'android'
}
release {
storeFile file('release.keystore')
storePassword System.getenv('GOOGLE_KEYSTORE_PWD')
keyAlias System.getenv('GOOGLE_KEYSTORE_ALIAS')
keyPassword System.getenv('GOOGLE_KEYSTORE_PWD')
}
}
buildTypes {
release {
// Caution! In production, you need to generate your own keystore file.
// see https://reactnative.dev/docs/signed-apk-android.
signingConfig signingConfigs.release
minifyEnabled enableProguardInReleaseBuilds
proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
}
}
我将AWS Secrets Manager中的base64解码发布证书注入到构建脚本中android/app/release.keystore
的项目源代码中。debug.keystore
、release.keystore
和build.gradle
存在于android/app/
的代码存储库中。gradlew bundleXXXX
从android
目录运行。
最初,当我运行gradlew signingReport
时,它识别出代码构建源位置/codebuild/output/src634901523/src/android/app/
中的release
和debug
密钥库,但是,随后出现了几个missing keystore
错误。
2023-01-11T09:26:22.714-05:00 > Task :app:signingReport
2023-01-11T09:26:22.714-05:00 Variant: debug
2023-01-11T09:26:22.714-05:00 Config: debug
2023-01-11T09:26:22.714-05:00 Store: /codebuild/output/src634901523/src/android/app/debug.keystore
2023-01-11T09:26:22.714-05:00 Alias: androiddebugkey
2023-01-11T09:26:22.714-05:00 MD5: 20:F4:61:48:B7:2D:8E:5E:5C:A2:3D:37:A4:F4:14:90
2023-01-11T09:26:22.714-05:00 SHA1: 5E:8F:16:06:2E:A3:CD:2C:4A:0D:54:78:76:BA:A6:F3:8C:AB:F6:25
2023-01-11T09:26:22.714-05:00 SHA-256: FA:C6:17:45:DC:09:03:78:6F:B9:ED:E6:2A:96:2B:39:9F:73:48:F0:BB:6F:89:9B:83:32:66:75:91:03:3B:9C
2023-01-11T09:26:22.714-05:00 Valid until: Tuesday, April 30, 2052
2023-01-11T09:26:22.714-05:00 ----------
2023-01-11T09:26:22.714-05:00 Variant: release
2023-01-11T09:26:22.714-05:00 Config: release
2023-01-11T09:26:22.714-05:00 Store: /codebuild/output/src634901523/src/android/app/release.keystore
2023-01-11T09:26:22.714-05:00 Alias: ***
2023-01-11T09:26:22.714-05:00 MD5: ***
2023-01-11T09:26:22.714-05:00 SHA1: ***
2023-01-11T09:26:22.714-05:00 SHA-256: ***
2023-01-11T09:26:22.714-05:00 Valid until: Saturday, May 28, 2050
2023-01-11T09:26:22.714-05:00 ----------
2023-01-11T09:26:22.714-05:00 Variant: debugAndroidTest
2023-01-11T09:26:22.714-05:00 Config: debug
2023-01-11T09:26:22.714-05:00 Store: /codebuild/output/src634901523/src/android/app/debug.keystore
2023-01-11T09:26:22.714-05:00 Alias: androiddebugkey
2023-01-11T09:26:22.714-05:00 MD5: 20:F4:61:48:B7:2D:8E:5E:5C:A2:3D:37:A4:F4:14:90
2023-01-11T09:26:22.714-05:00 SHA1: 5E:8F:16:06:2E:A3:CD:2C:4A:0D:54:78:76:BA:A6:F3:8C:AB:F6:25
2023-01-11T09:26:22.714-05:00 SHA-256: FA:C6:17:45:DC:09:03:78:6F:B9:ED:E6:2A:96:2B:39:9F:73:48:F0:BB:6F:89:9B:83:32:66:75:91:03:3B:9C
2023-01-11T09:26:22.714-05:00 Valid until: Tuesday, April 30, 2052
2023-01-11T09:26:22.714-05:00 ----------
2023-01-11T09:26:22.714-05:00
2023-01-11T09:26:22.714-05:00 > Task :react-native-app-auth:signingReport
2023-01-11T09:26:22.714-05:00 Variant: debugAndroidTest
2023-01-11T09:26:22.714-05:00 Config: debug
2023-01-11T09:26:22.714-05:00 Store: /root/.android/debug.keystore
2023-01-11T09:26:22.714-05:00 Alias: AndroidDebugKey
2023-01-11T09:26:22.714-05:00 Error: Missing keystore
2023-01-11T09:26:22.714-05:00 ----------
2023-01-11T09:26:22.714-05:00
2023-01-11T09:26:22.714-05:00 > Task :react-native-async-storage_async-storage:signingReport
2023-01-11T09:26:22.714-05:00 Variant: debugAndroidTest
2023-01-11T09:26:22.714-05:00 Config: debug
2023-01-11T09:26:22.714-05:00 Store: /root/.android/debug.keystore
2023-01-11T09:26:22.714-05:00 Alias: AndroidDebugKey
2023-01-11T09:26:22.714-05:00 Error: Missing keystore
2023-01-11T09:26:22.714-05:00 ----------
...
因此,在我的构建脚本中,我还将debug.keystore
复制到了/root/.android/debug.keystore
,这样就删除了signingReport
中的所有missing keystore
错误。
然而,我仍然无法获得任何已签名的调试.aab
。然而,发行版.aab
已使用release
证书正确签名。
我已经尝试了许多不同的build.gradle
设置组合,并在不同的位置提供密钥库文件。包括添加一个等效的debug
构建类型,该构建类型引用debug
signingConfig
。我无法找到任何解决此问题的方法。在奋进之前,我们使用debug.keystore成功地构建了一个签名的.apk
,作为./gradlew assembleRelease
的release
类型。但是现在我需要一个产品包,可以上传到Google,并使用有效的证书签名,同时保持用debug.keystore
签署的较低级别环境。
1条答案
按热度按时间eyh26e7m1#
也许,你需要创建一个调试版本类型。你现在只有一个发布版本类型。