如何修复react-native Expo android build中的“Execution failed for task ':expo-image-picker:compileReleaseKotlin'错误?

f45qwnt8  于 2023-08-01  发布在  Android
关注(0)|答案(2)|浏览(91)

执行任务“:expo-image-picker:compileReleaseKotlin”失败。
我是react-native的初学者,这是我第一个尝试构建的项目。
但在构建时,我收到以下错误:

FAILURE: Build completed with 2 failures.
[stderr] 
1: Task failed with an exception.
[stderr] 
-----------
[stderr] 
* What went wrong:
[stderr] 
Execution failed for task ':expo-image-picker:compileReleaseKotlin'.
[stderr] 
> A failure occurred while executing org.jetbrains.kotlin.compilerRunner.GradleCompilerRunnerWithWorkers$GradleKotlinCompilerWorkAction
[stderr] 
   > Compilation error. See log for more details
[stderr] 
* Try:
[stderr] 
> Run with --stacktrace option to get the stack trace.
[stderr] 
> Run with --info or --debug option to get more log output.
[stderr] 
> Run with --scan to get full insights.
[stderr] 
==============================================================================
[stderr] 
2: Task failed with an exception.
[stderr] 
-----------
[stderr] 
* What went wrong:
[stderr] 
java.lang.StackOverflowError (no error message)
[stderr] 
* Try:
[stderr] 
> Run with --stacktrace option to get the stack trace.
[stderr] 
> Run with --info or --debug option to get more log output.
[stderr] 
> Run with --scan to get full insights.
[stderr] 
==============================================================================
[stderr] 
* Get more help at https://help.gradle.org
[stderr] 
BUILD FAILED in 8m 3s
Error: Gradle build failed with unknown error. See logs for the "Run gradlew" phase for more information.

字符串
我在第二周与这个错误作斗争,找不到任何解决方案来修复它。
据我所知,我可能是错的,但这个问题是因为依赖性无能。
我的包.json:

{
    "name": "alarm-agent-app",
    "version": "1.0.0",
    "main": "node_modules/expo/AppEntry.js",
    "scripts": {
        "start": "expo start",
        "android": "expo start --android",
        "ios": "expo start --ios",
        "web": "expo start --web",
        "eject": "expo eject",
        "lint": "eslint \"src/**/*.{js, jsx}\"",
        "format:check": "prettier --check .",
        "format": "prettier --write .",
        "postinstall": "patch-package"
    },
    "dependencies": {
        "@expo/config-plugins": "~6.0.0",
        "@expo/prebuild-config": "~6.0.0",
        "@gorhom/bottom-sheet": "4",
        "@react-native-async-storage/async-storage": "1.17.11",
        "@react-native-community/netinfo": "9.3.7",
        "@react-native-picker/picker": "2.4.8",
        "@react-navigation/material-bottom-tabs": "^6.2.1",
        "@react-navigation/native": "^6.0.10",
        "@react-navigation/native-stack": "^6.6.2",
        "@reduxjs/toolkit": "^1.8.3",
        "axios": "^0.27.2",
        "expo": "^48.0.11",
        "expo-app-loading": "^2.1.1",
        "expo-av": "~13.2.1",
        "expo-background-fetch": "~11.1.1",
        "expo-build-properties": "~0.6.0",
        "expo-checkbox": "~2.3.1",
        "expo-dev-client": "~2.2.1",
        "expo-font": "~11.1.1",
        "expo-image": "~1.0.0",
        "expo-image-manipulator": "~11.1.1",
        "expo-image-picker": "^14.1.1",
        "expo-linear-gradient": "~12.1.2",
        "expo-location": "~15.1.1",
        "expo-secure-store": "~12.1.1",
        "expo-status-bar": "~1.4.4",
        "expo-task-manager": "~11.1.1",
        "expo-updates": "~0.16.4",
        "formik": "^2.2.9",
        "global": "^4.4.0",
        "moment": "^2.29.3",
        "patch-package": "^7.0.0",
        "postinstall-postinstall": "^2.1.0",
        "react": "18.2.0",
        "react-dom": "18.2.0",
        "react-native": "0.71.8",
        "react-native-gesture-handler": "~2.9.0",
        "react-native-maps": "1.3.2",
        "react-native-maps-directions": "^1.9.0",
        "react-native-paper": "^4.12.2",
        "react-native-reanimated": "~2.14.4",
        "react-native-redash": "^18.1.0",
        "react-native-safe-area-context": "4.5.0",
        "react-native-screens": "~3.20.0",
        "react-native-svg": "13.4.0",
        "react-native-toast-message": "2.1.5",
        "react-native-vector-icons": "^9.2.0",
        "react-native-web": "~0.18.11",
        "react-redux": "^8.0.2",
        "socket.io-client": "^4.5.1",
        "yup": "^1.0.2"
    },
    "devDependencies": {
        "@babel/core": "^7.20.0",
        "@babel/preset-env": "^7.1.6",
        "eslint": "^8.39.0",
        "eslint-config-prettier": "^8.8.0",
        "eslint-plugin-prettier": "^4.2.1",
        "eslint-plugin-react": "^7.32.2",
        "eslint-plugin-react-hooks": "^4.6.0",
        "eslint-plugin-react-native": "^4.0.0",
        "prettier": "2.8.8"
    },
    "resolutions": {
        "@expo/config-plugins": "~6.0.0",
        "@expo/prebuild-config": "~6.0.0",
        "expo-modules-autolinking": "~1.1.0"
    },
    "private": true
}


会非常高兴和感谢任何帮助和信息
我试着谷歌,问chat-gpt,也遵循我在这里找到的指南:https://github.com/expo/expo/issues/15629,但错误仍然相同

4dc9hkyq

4dc9hkyq1#

这不是最好的解决方案,但只是降级到14.0.0解决了这个问题。你可以增加版本直到它坏掉。我没有时间玩它。如果您这样做,请在评论中分享版本。

rxztt3cl

rxztt3cl2#

我遇到了同样的问题,现在降级工程。您也可以考虑react-native-image-picker。

相关问题