[英]Execution failed for task ':react-native-firebase:compileDebugJavaWithJavac'
In my React Native 0.60.4
app i'm trying to use react-native-firebase
and i have done everything except react-native-link
as it's not supported in the latest version of React Native.在我的 React Native 0.60.4
应用程序中,我尝试使用react-native-firebase
并且我已经完成了除react-native-link
之外的所有操作,因为它在最新版本的 React Native 中不受支持。 When i give command react-native-run-android
,it shows a lot of errors from the node module of react-native-firebase
.当我给出命令react-native-run-android
时,它显示了来自react-native-firebase
的节点模块的很多错误。 I'm guessing it's happening for some version conflict.我猜这是因为某些版本冲突而发生的。 Here is the long error:这是长错误:
Here's my app build.gradle file dependencies:这是我的应用程序 build.gradle 文件依赖项:
dependencies { implementation fileTree(dir: "libs", include: ["*.jar"]) implementation "com.facebook.react:react-native:+" implementation "com.google.firebase:firebase-core:16.0.9" implementation "com.google.firebase:firebase-firestore:19.0.0" implementation "com.google.firebase:firebase-messaging:18.0.0" // implementation "com.google.firebase:firebase-functions: 17.0.0" // implementation "com.google.firebase:firebase-analytics: 16.5.0" // implementation " com.google.firebase:firebase-ads:17.2.1" // implementation "com.google.android.gms:play-services-measurement-api:16.5.0" // implementation "com.google.firebase:firebase-invites:17.0.0" // implementation "com.google.firebase:firebase-iid: 18.0.0" // implementation "com.google.firebase:firebase-config:17.0.0" // implementation "com.google.firebase:firebase-perf:17.0.0" // Firebase dependencies implementation "com.google.android.gms:play-services-base:16.1.0" implementation"com.google.android.gms:play-services-gcm:16.1.0" implementation 'com.android.support:multidex:1.0.3' if (enableHermes) { def hermesPath = "../../node_modules/hermesvm/android/"; debugImplementation files(hermesPath + "hermes-debug.aar") releaseImplementation files(hermesPath + "hermes-release.aar") } else { implementation jscFlavor } } task copyDownloadableDepsToLibs(type: Copy) { from configurations.compile into 'libs' } apply from: file("../../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesAppBuildGradle(project) apply from: "../../node_modules/react-native-vector-icons/fonts.gradle" apply plugin: 'com.google.gms.google-services'
And my android build.gradle:还有我的 android build.gradle:
buildscript { ext { buildToolsVersion = "28.0.3" minSdkVersion = 21 compileSdkVersion = 28 targetSdkVersion = 28 supportLibVersion = "28.0.0" googlePlayServicesVersion = "16.1.0" multiDexEnabled = true } repositories { google() jcenter() } dependencies { classpath('com.android.tools.build.gradle:3.4.2') classpath( 'com.google.gms:google-services:4.2.0') } } allprojects { repositories { google() mavenLocal() jcenter() maven { url("$rootDir/../node_modules/react-native/android") } maven { url("$rootDir/../node_modules/jsc-android/dist") } } }
Run npx jetify运行 npx jetify
From the project root directory, where the node_modules is从 node_modules 所在的项目根目录
Simply Reinstall React Native Firebase只需重新安装React Native Firebase
npm install --save @react-native-firebase/app
After this its 100% works.在此之后,它的 100% 工作。
I have just faced this issue as well.我也刚遇到这个问题。 Upgrading openjdk from 8 to 11 will get error away.将 openjdk 从 8 升级到 11 将消除错误。
This script is to install openjdk 11: https://github.com/invertase/react-native-firebase/issues/1988#issuecomment-1070831039 .此脚本用于安装 openjdk 11: https ://github.com/invertase/react-native-firebase/issues/1988#issuecomment-1070831039。
You have update your openjdk with this:你已经用这个更新了你的openjdk:
brew tap homebrew/cask-versions
brew install --cask zulu11
For me, the issue was the difference in the versions of @react-native-firebase/app
and @react-native-firebase/firestore
so reinstalling the libraries updated both of them to the latest version, and the issue was resolved对我来说,问题是@react-native-firebase/app
和@react-native-firebase/firestore
的版本不同,所以重新安装库将它们都更新到最新版本,问题就解决了
yarn add @react-native-firebase/app @react-native-firebase/firestore
OR
npm install @react-native-firebase/app @react-native-firebase/firestore
I think you need to link react-native-firebase library.我认为您需要链接react-native-firebase 库。 Also, you can refer the documentation for firebase here https://github.com/invertase/react-native-firebase/tree/master/packages/firestore or https://rnfirebase.io/docs/v5.xx/getting-started此外,您可以在此处参考 firebase 的文档https://github.com/invertase/react-native-firebase/tree/master/packages/firestore或https://rnfirebase.io/docs/v5.xx/getting-开始
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.