[英]Execution failed for task ':app:processDebugManifest' - React Native
[英]React-native Execution failed for task ':app:processDebugManifest' for android app
我试图在 M1 Mac air 上运行 react-native android 应用程序。 我正在运行 react-native 0.63.4。 Android Studio 2020.3.1 适用于苹果芯片。 iOS 应用程序工作正常,但我的 android 应用程序表现异常。 首先,每当我尝试使用“npx react-native run-android”通过 cli 运行应用程序时,都会出现此错误
> Configure project :react-native-reanimated
> Task :app:processDebugManifest FAILED
Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/6.3/userguide/command_line_interface.html#sec:command_line_warnings
127 actionable tasks: 127 executed
Warning: Mapping new ns http://schemas.android.com/repository/android/common/02 to old ns http://schemas.android.com/repository/android/common/01
Warning: Mapping new ns http://schemas.android.com/repository/android/generic/02 to old ns http://schemas.android.com/repository/android/generic/01
Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/addon2/02 to old ns http://schemas.android.com/sdk/android/repo/addon2/01
Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/repository2/02 to old ns http://schemas.android.com/sdk/android/repo/repository2/01
Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/sys-img2/02 to old ns http://schemas.android.com/sdk/android/repo/sys-img2/01
Warning: Mapping new ns http://schemas.android.com/repository/android/common/02 to old ns http://schemas.android.com/repository/android/common/01
Warning: Mapping new ns http://schemas.android.com/repository/android/generic/02 to old ns http://schemas.android.com/repository/android/generic/01
Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/addon2/02 to old ns http://schemas.android.com/sdk/android/repo/addon2/01
Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/repository2/02 to old ns http://schemas.android.com/sdk/android/repo/repository2/01
Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/sys-img2/02 to old ns http://schemas.android.com/sdk/android/repo/sys-img2/01
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:processDebugManifest'.
> Unable to make field private final java.lang.String java.io.File.path accessible: module java.base does not "opens java.io" to unnamed module @70673583
* 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 8s
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 app:installDebug -PreactNativeDevServerPort=8081
Warning: Mapping new ns http://schemas.android.com/repository/android/common/02 to old ns http://schemas.android.com/repository/android/common/01
这发生在它配置 react-native firebase 并且在配置 react-native-reanimated 时失败。
这就是它现在变得有趣的地方。 最初在 android 工作室中打开项目给了我一个错误,它无法找到节点。 我通过在终端中打开 android 工作室来解决此问题。 就构建应用程序而言,android 工作室中的一切都很好。 该应用程序已安装,但它无法或什至没有尝试连接到 Metro 捆绑程序(我在尝试运行该应用程序之前就开始了它)。 我尝试在应用程序中重新加载,它立即解决了一个错误,指出它无法连接到开发服务器。 在捆绑器本身中重新加载会在捆绑器中解决,警告我没有连接任何设备。
任何想法可能导致所有这些错误?
解决了这个问题是由于 android studio 指向 java 16 尚不支持。 以下错误的证据:
Unable to make field private final java.lang.String java.io.File.path accessible: module java.base does not "opens java.io" to unnamed module @70673583
解决方案:删除 java 16,使用 java 8 或 11。以下步骤适用于 Mac OS 用户
cd /Library/Java/JavaVirtualMachines
然后你想列出这个文件夹中的所有 jdk 版本使用
ls
现在,如果您看到 jdk-16.xxjdk 形式的任何文件,请按如下方式将其删除
sudo rm -rf jdk-16.0.2.jdk
就我而言,我有 jdk-16.0.2.jdk 以及 jdk-11 和 jdk-8
完成此操作后,确保您通过运行安装了适当版本的 java
java --version
我相信任何低于 16 的版本就足够了。
在此堆栈溢出问题上找到的解决方案: 如何在 macOS 中卸载 Java JDK?
现在像往常一样在你的项目目录中运行你的项目:
npx react-native run-android
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.