由于“:app:compileDebugJavaWithJavac”而无法构建 React Native 项目

问题描述 投票:0回答:1

我无法运行 React Native 项目。当我尝试运行这个时,它给了我以下日志,但我仍然无法理解这个问题:

`info Opening the app on Android...
info JS server already running.
info Launching emulator...
info Successfully launched emulator.
info Installing the app...
Starting a Gradle Daemon, 3 incompatible and 1 stopped Daemons could not be reused, use --status for details
> Task :gradle-plugin:compileKotlin UP-TO-DATE
> Task :gradle-plugin:compileJava NO-SOURCE
> Task :gradle-plugin:pluginDescriptors UP-TO-DATE
> Task :gradle-plugin:processResources UP-TO-DATE
> Task :gradle-plugin:classes UP-TO-DATE
> Task :gradle-plugin:jar UP-TO-DATE
> Task :gradle-plugin:inspectClassesForKotlinIC UP-TO-DATE

> Configure project :app
WARNING:DSL element 'dexOptions' is obsolete and should be removed.
It will be removed in version 8.0 of the Android Gradle plugin.
Using it has no effect, and the AndroidGradle plugin optimizes dexing automatically.
5 actionable tasks: 5 up-to-date

info 💡 Tip: Make sure that you have set up your development environment correctly, by running react-native doctor. To read more about doctor command visit: https://github.com/react-native-community/cli/blob/main/packages/cli-doctor/README.md#doctor


FAILURE: Build failed with an exception.

* What went wrong:
Could not determine the dependencies of task ':app:compileDebugJavaWithJavac'.
> Could not determine the dependencies of null.
   > Cannot query the value of this provider because it has no value available.

* 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 55s
info Run CLI with --verbose flag for more details.`

我尝试清除缓存,按照文档一步步重新安装所有工具,React Native Doctor显示没有错误,我完全迷失了。

android react-native android-gradle-plugin
1个回答
0
投票

1。尝试清理构建或直接删除构建文件夹

android/build

• 通过运行清理构建:

cd android

./gradlew clean

2。然后删除node_modules并重新安装

rm -rf node_modules
npm install

3.如果您的问题仍然存在,请确保您的 Android SDK 和相关工具是最新的。

这应该可以解决您的问题。

注意: 请记住在进行这些更改后重新启动开发服务器并重建项目。

© www.soinside.com 2019 - 2024. All rights reserved.