当我尝试使用这些命令yarn run android
或react-native run-android
构建Android时,我显示了这个错误。请帮助mw解决这个错误。
下面是package.json
"@react-native-firebase/admob": "^11.5.0",
"@react-native-firebase/app": "^11.5.0",
"@react-native-firebase/messaging": "^11.5.0",
错误:
> Configure project :react-native-firebase_messaging
:react-native-firebase_messaging package.json found at /Users/apple/Desktop/xnd-react-native/node_modules/@react-native-firebase/messaging/package.json
:@react-native-firebase_app package.json found at /Users/apple/Desktop/xnd-react-native/node_modules/@react-native-firebase/app/package.json
:react-native-firebase_messaging:firebase.bom using default value: 26.8.0
:react-native-firebase_messaging package.json found at /Users/apple/Desktop/xnd-react-native/node_modules/@react-native-firebase/messaging/package.json
:react-native-firebase_messaging:version set from package.json: 11.5.0 (11,5,0 - 11005000)
:react-native-firebase_messaging:android.compileSdk using custom value: 31
:react-native-firebase_messaging:android.targetSdk using custom value: 31
:react-native-firebase_messaging:android.minSdk using custom value: 21
:react-native-firebase_messaging:reactNativeAndroidDir /Users/apple/Desktop/xnd-react-native/node_modules/react-native/android
> Task :@react-native-firebase_messaging:compileDebugJavaWithJavac FAILED
Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/6.5/userguide/command_line_interface.html#sec:command_line_warnings
17 actionable tasks: 1 executed, 16 up-to-date
3条答案
按热度按时间aij0ehis1#
我在jdk 8中也有同样的问题。当我将jdk 8更改为11时,它对我有效。
要从jdk 8更新到11,请访问https://github.com/invertase/react-native-firebase/issues/1988#issuecomment-1070831039
axr492tv2#
更新JDK版本并尝试,
可以使用以下命令更新JDK
bkhjykvo3#
当我从JDK 8切换到11时,它解决了这个问题。
按照说明进行切换
1.打开新的“终端”窗口并输入:
1.它可能如下所示:
您可能只看到一个版本,可能是1.8(JDK 8),如果是这样,请转到https://www.oracle.com/java/technologies/downloads/下载JDK 11。
1.成功下载并安装后,您将运行此命令以切换。
1.在终端中检查JDK版本:
您也可以查看下面的链接
https://medium.com/@devkosal/switching-java-jdk-versions-on-macos-80bc868e686a