gpt4 book ai didi

java - react-native运行android无法正常工作。无法初始化类org.codehaus.groovy.runtime.InvokerHelper

转载 作者:行者123 更新时间:2023-12-03 04:47:05 26 4
gpt4 key购买 nike

我正在尝试使用CLI方法运行react-native。
按照遍历媒体https://www.youtube.com/watch?v=Hf4MJH0jDb4&t=933s的本教程,我还获得了react-native-vector-icons并将其链接为react native。
我安装了android studio,并且Gradle全部更新到了最新版本。

Java Version
java 14.0.1 2020-04-14
Java(TM) SE Runtime Environment (build 14.0.1+7)
Java HotSpot(TM) 64-Bit Server VM (build 14.0.1+7, mixed mode, sharing)

cmd表示问题是什么。
* What went wrong:
Could not initialize class org.codehaus.groovy.runtime.InvokerHelper

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

这就是我在cmd中得到的。问题是什么?
当我运行包含以上内容的命令时,这是我的整个控制台。
C:\Users\Devesh\ShoppingList>react-native run-android
info Running jetifier to migrate libraries to AndroidX. You can disable it using "--no-jetifier" flag.
Jetifier found 967 file(s) to forward-jetify. Using 4 workers...
info Starting JS server...
info Installing the app...

FAILURE: Build failed with an exception.

* What went wrong:
Could not initialize class org.codehaus.groovy.runtime.InvokerHelper

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 864ms

error Failed to install the app. Make sure you have the Android development environment set up: https://reactnative.dev/docs/environment-setup. Run CLI with --verbose flag for more details.
Error: Command failed: gradlew.bat app:installDebug -PreactNativeDevServerPort=8081

FAILURE: Build failed with an exception.

* What went wrong:
Could not initialize class org.codehaus.groovy.runtime.InvokerHelper

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 864ms

at makeError (C:\Users\Devesh\ShoppingList\node_modules\execa\index.js:174:9)
at C:\Users\Devesh\ShoppingList\node_modules\execa\index.js:278:16
at processTicksAndRejections (internal/process/task_queues.js:97:5)
at async runOnAllDevices (C:\Users\Devesh\ShoppingList\node_modules\@react-native-community\cli-platform-android\build\commands\runAndroid\runOnAllDevices.js:94:5)
at async Command.handleAction (C:\Users\Devesh\ShoppingList\node_modules\react-native\node_modules\@react-native-community\cli\build\index.js:186:9)


android模拟器会启动,但不会加载react应用或其他任何东西,只是普通的模拟器和react CLI在另一个窗口中。有人也遇到了这个问题吗?你知道如何解决这个问题吗?

最佳答案

将gradle更改为6.3。
我修改了文件android/gradle/wrapper/gradle-wrapper.properties并将 distributionUrl 设置为https\://services.gradle.org/distributions/gradle-6.3-all.zip像这样:

distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.3-all.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

关于java - react-native运行android无法正常工作。无法初始化类org.codehaus.groovy.runtime.InvokerHelper,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61487507/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com