当我尝试执行以下代码时,我的本机应用程序出现错误
react-native run-android --variant=release
Starting a Gradle Daemon (subsequent builds will be faster)
> Configure project :react-native-firebase
react-native-firebase: using React Native prebuilt binary from /Users/sanglee/Documents/react-native-firebase-starter/node_modules/react-native/android
FAILURE: Build failed with an exception.
* What went wrong:
Task 'installDebug' not found in project ':app'.
我从react-native-firebase下载了react-native应用,甚至无法在android上进行测试。
答案 0 :(得分:1)
发生这种情况是因为不存在密钥库。请遵循https://facebook.github.io/react-native/docs/0.60/signed-apk-android
中提到的步骤~/.gradle/gradle.properties
或android/gradle.properties
,然后添加以下内容(用正确的密钥库密码,别名和密钥密码替换*****) MYAPP_UPLOAD_STORE_FILE=my-upload-key.keystore
MYAPP_UPLOAD_KEY_ALIAS=my-key-alias
MYAPP_UPLOAD_STORE_PASSWORD=*****
MYAPP_UPLOAD_KEY_PASSWORD=*****
android/app/build.gradle
,并添加签名配置,...
android {
...
defaultConfig { ... }
signingConfigs {
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 {
release {
...
signingConfig signingConfigs.release
}
}
}
...
答案 1 :(得分:0)
确保您在Windows中使用PowerShell,而不是Git Bash