运行 npx expo run 时出现构建错误:android

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

我正在尝试从 Android Studio 在 Android 模拟器上运行一个 React-Native 项目。但是,每当我运行 npx expo run:android 时,我都会收到一些错误:

The Kotlin Gradle plugin was loaded multiple times in different subprojects, which is not supported and may break the build. 
This might happen in subprojects that apply the Kotlin plugins with the Gradle 'plugins { ... }' DSL if they specify explicit versions, even if the versions are equal.
Please add the Kotlin plugin to the common parent project or the root project, then remove the versions in the subprojects.
If the parent project does not need the plugin, add 'apply false' to the plugin line.
See: https://docs.gradle.org/current/userguide/plugins.html#sec:subprojects_plugins_dsl
The Kotlin plugin was loaded in the following projects: ':expo', ':expo-av', ':react-native-gesture-handler', ':react-native-safe-area-context', ...

> Task :app:compileDebugJavaWithJavac FAILED
error: cannot find symbol
        return BuildConfig.DEBUG;

Deprecated Gradle features were used in this build, making it incompatible with Gradle 9.0.

我尝试了很多不同的帖子建议,清理gradle,调整版本等等,但都无济于事。

值得一提的是,IOS 运行完全正常。

java react-native android-studio gradle simulator
2个回答
0
投票

刚刚想通了这一点。我在 android -> app -> build.gradle 中的命名空间与其他包名称略有不同。确保这些都相同。


0
投票

运行 npx expo run 时出现构建错误:android 我也面临这个问题,最后找到这里,我发现我的 build.gradle 文件有问题,我在这里发布了完整的解决方案,我希望它能帮助你,谢谢 在这里检查我的答案 在此输入链接描述

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