How can I fix the Execution failed for task ':expo-image-picker:compileReleaseKotlin' error in react-native Expo android build?

huangapple go评论68阅读模式
英文:

How can I fix the Execution failed for task ':expo-image-picker:compileReleaseKotlin' error in react-native Expo android build?

问题

Here is the translated content:

执行失败的任务 ':expo-image-picker:compileReleaseKotlin'。

我是React Native的初学者,这是我的第一个项目,我正在尝试构建它。

但是在构建过程中,我收到以下错误消息:

[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.

我已经为这个错误苦苦挣扎了两个星期,但找不到解决方法。

据我理解,可能是因为依赖项不兼容,尽管我可能理解有误。

我的package.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
}

将不胜感激地接受任何帮助和信息。我尝试过谷歌搜索、询问ChatGPT,并按照此处找到的指南进行操作:https://github.com/expo/expo/issues/15629,但仍然出现相同

英文:

Execution failed for task ':expo-image-picker:compileReleaseKotlin'.

I am a beginner in react-native and it is my first project which I'm trying to build.

But on building i receive following errors:

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.

I am struggling with this error for second week and can't find any solution to fix it.

As I understand, i may be wrong, but this issues comes because of the dependencies incapability.

my package.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
}

Will be so happy and grateful for any help and info

I tried to google, ask chat-gpt and also follow the guide which i found here: https://github.com/expo/expo/issues/15629, but still same errors

答案1

得分: 1

只降级到了14.0.0版本就解决了问题。可以逐步增加版本号,直到出现问题为止。我没有时间测试更多版本。如果你这样做了,请在评论中分享版本号。

英文:

Its not the best solution, but just downgrading to 14.0.0 fixed the problem. You could increase the version till it breaks. I did not have time play with it. If you do that please share the version in the comment.

答案2

得分: 0

我遇到了相同的问题,暂时降级解决了。你也可以考虑使用 react-native-image-picker。

英文:

I was running into the same issue and downgrading works for now. You might also consider react-native-image-picker.

huangapple
  • 本文由 发表于 2023年5月22日 16:55:29
  • 转载请务必保留本文链接:https://go.coder-hub.com/76304481.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定