在项目 ':app' 中找不到任务'installDebug'



当我尝试执行以下代码时,我的反应本机应用程序出错

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进行测试。

发生这种情况是因为不存在密钥库。按照 https://reactnative.dev/docs/signed-apk-android 中提到的步骤操作

  1. 您可以使用密钥工具生成私有签名密钥。(说明因操作系统而异(
  2. 编辑文件~/.gradle/gradle.propertiesandroid/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=*****
  1. 编辑项目文件夹中的文件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
}
}
}
...

确保你在Windows中使用PowerShell而不是Git Bash

相关内容

  • 没有找到相关文章

最新更新