react-native - React Native 构建签名的 apk 任务:app:signingConfigWriterRelease FAILED
问题描述
我正在尝试构建签名的 apk 但是当我尝试
./gradlew bundleRelease
它抛出:
Task :app:signingConfigWriterRelease FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:signingConfigWriterRelease'.
> Trailing char < > at index 71: C:\Users\..\..\..\myProject\android\app\my-upload-key.keystore
SigningConfigs 和 buildTypes :
signingConfigs {
debug {
storeFile file('debug.keystore')
storePassword 'android'
keyAlias 'androiddebugkey'
keyPassword 'android'
}
release {
if (project.hasProperty('MYAPP_UPLOAD_STORE_FILE')) {
storeFile file(MYAPP_UPLOAD_STORE_FILE)
storePassword MYAPP_UPLOAD_STORE_PASSWORD
keyAlias MYAPP_UPLOAD_KEY_ALIAS
keyPassword MYAPP_UPLOAD_KEY_PASSWORD
}
}
}
buildTypes {
debug {
signingConfig signingConfigs.debug
}
release {
// Caution! In production, you need to generate your own keystore file.
// see https://facebook.github.io/react-native/docs/signed-apk-android.
signingConfig signingConfigs.debug
minifyEnabled enableProguardInReleaseBuilds
proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
signingConfig signingConfigs.release
}
}
我不知道为什么,但是由于这个问题,我几天都无法获得签名的 apk。我需要做什么来解决这个问题?
解决方案
删除signingConfig signingConfigs.debug 内部发布块
buildTypes {
debug {
signingConfig signingConfigs.debug
}
release {
// Caution! In production, you need to generate your own keystore file.
// see https://facebook.github.io/react-native/docs/signed-apk-android.
signingConfig signingConfigs.debug // try deleting this
minifyEnabled enableProguardInReleaseBuilds
proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
signingConfig signingConfigs.release
}
}
gradle.properties
MYAPP_RELEASE_STORE_FILE=my-upload-key.keystore
MYAPP_RELEASE_KEY_ALIAS=my-key-alias
MYAPP_RELEASE_STORE_PASSWORD=XXXXX
MYAPP_RELEASE_KEY_PASSWORD=XXXX
推荐阅读
- machine-learning - 用外行的话来说,LossFunction 和 OptimizationAlgorithm 有什么区别?
- android - 使用 Dagger 2 提供应用程序上下文
- python - 如何使用复选按钮激活和停用功能?
- java - 无法将 Lombok 与 Java 11 一起使用
- java - 在 Groovy 中将列表转换为枚举列表
- java - 如何为以下代码解析 Mongo JDBC 驱动程序?
- excel - 数据透视表过滤月份选择当前月份之前的所有内容
- javascript - 使用 Object.keys 从对象中检索字符串
- css - CSS 将矩阵转换为像素
- sas - 读取带有空白列的分隔文本文件