执行任务“:@react-native-community_async-storage:compileDebugJavaWithJavac”失败[重复]

rfbsl7qr  于 2022-11-17  发布在  React
关注(0)|答案(1)|浏览(264)

此问题在此处已有答案

React Native Android build failure with different errors without any changes in code for past days due to publish of React Native version 0.71.0-rc.0(6个答案)
2天前关闭。
突然,我的应用程序无法运行调试。当我尝试运行时:npxReact-原生执行-android
它似乎停止时,第一个图书馆是扫描(我不确定这是否是世界)agregate的apk。
任务:@React Native社区异步存储:编译调试JavaWithJavac失败

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':@react-native-community_async-storage:compileDebugJavaWithJavac'.
> Compilation failed; see the compiler error output for details.

我的package.json配置:

"dependencies": {
    "@react-native-community/async-storage": "^1.12.1",
    "@react-native-community/netinfo": "8.3.0",
    "@react-native-firebase/analytics": "^15.6.0",
    "@react-native-firebase/app": "^15.6.0",
    "@react-native-firebase/auth": "^15.6.0",
    "@react-native-firebase/database": "^15.6.0",
    "@react-native-firebase/firestore": "^15.6.0",
    "@react-native-firebase/functions": "^15.6.0",
    "@react-native-firebase/messaging": "^15.6.0",
    "@react-native-firebase/remote-config": "^15.6.0",
    "@sentry/react-native": "3.4.3",
    "moment": "2.29.3",
    "react": "16.9.0",
    "react-native": "0.61.3",
    "react-native-calendars": "1.259.0",
    "react-native-code-push": "6.0.0",
    "react-native-extended-stylesheet": "^0.12.0",
    "react-native-fast-image": "^8.5.11",
    "react-native-fs": "^2.14.1",
    "react-native-image-picker": "^1.0.2",
    "react-native-keep-awake": "^4.0.0",
    "react-native-keychain": "^4.0.1",
    "react-native-masked-text": "^1.13.0",
    "react-native-push-notification": "^8.1.1",
    "react-native-vector-icons": "^5.0.0",
    "react-native-webview": "^7.4.1",
    "react-redux": "^8.0.2",
    "react-router": "^5.1.2",
    "react-router-dom": "^5.1.2",
    "react-router-native": "^5.1.2",
    "realm": "6.0.3",
    "redux": "^4.2.0",
    "redux-thunk": "^2.4.1"
  },

我已经试过重启我的电脑,清理gradle(cd android && ./gradle clean),清理gradle cash(rm -rf ~/.gradle/caches),调试通过(./gradlew assembleDebug --info)。但是我总是得到同样的错误。我该怎么办?

o8x7eapl

o8x7eapl1#

自上次react native更新以来,发生了此错误,根据文档,您需要在android/build.gradle中添加此错误

def REACT_NATIVE_VERSION = new File(['node', '--print',"JSON.parse(require('fs').readFileSync(require.resolve('react-native/package.json'), 'utf-8')).version"].execute(null, rootDir).text.trim())

allprojects {
 configurations.all {
    resolutionStrategy {
        force "com.facebook.react:react-native:" + REACT_NATIVE_VERSION
    }
 }
}

相关问题