Execution failed for task ':react-native-webview:compileDebugJavaWithJavac'. RN

1,992 阅读1分钟

下载最新的react native 和 react-native-webview 后编译不成功

// package.json
{
...
  "dependencies": {
    "@react-native-community/masked-view": "^0.1.10",
    "@react-navigation/native": "^5.5.1",
    "@react-navigation/stack": "^5.4.2",
    "axios": "^0.19.2",
    "jetifier": "^1.6.5",
    "native-echarts": "^0.5.0",
    "react": "16.11.0",
    "react-native": "^0.62.2",
    "react-native-baidu-map": "^1.0.35",
    "react-native-gesture-handler": "^1.6.1",
    "react-native-reanimated": "^1.9.0",
    "react-native-safe-area-context": "^3.0.2",
    "react-native-screens": "^2.8.0",
    "react-native-webview": "^10.2.3",
    "react-navigation": "^4.3.9"
  },
  "devDependencies": {
    "@babel/core": "^7.6.2",
    "@babel/runtime": "^7.6.2",
    "@react-native-community/eslint-config": "^0.0.5",
    "babel-jest": "^24.9.0",
    "eslint": "^6.5.1",
    "jest": "^24.9.0",
    "metro-react-native-babel-preset": "^0.58.0",
    "react-devtools": "^4.7.0",
    "react-test-renderer": "16.11.0"
  },
  "jest": {
    "preset": "react-native"
  }
}

修改 android/build.gradle

ext {
        buildToolsVersion = "29.0.3"
        minSdkVersion = 16
        compileSdkVersion = 29
        targetSdkVersion = 28
    }

感觉是编译版本问题