我正在尝试构建签名的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。 我需要怎么做才能解决这个问题?
答案 0 :(得分:0)
删除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