【发布时间】:2021-10-16 09:57:20
【问题描述】:
React-native npm run android 在 Mac m1 上使用以下命令失败
错误 无法安装应用程序。确保您已设置 Android 开发环境:https://reactnative.dev/docs/environment-setup。
**.zshrc
export ANDROID_HOME=$HOME/Library/Android/sdk
export PATH=$PATH:$ANDROID_HOME/emulator
export PATH=$PATH:$ANDROID_HOME/tools
export PATH=$PATH:$ANDROID_HOME/tools/bin
export PATH=$PATH:$ANDROID_HOME/platform-tools
export PATH=/opt/homebrew/bin:$PATH
export JAVA_HOME="/Applications/Android Studio.app/Contents/jre/jdk/Contents/Home"**
错误:命令失败:./gradlew app:installDebug -PreactNativeDevServerPort=8081
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:mergeDebugResources'.
> Multiple task action failures occurred:
> A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
> AAPT2 aapt2-4.1.0-6503028-osx Daemon #1: Daemon startup failed
This should not happen under normal circumstances, please file an issue if it does.
> A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
> AAPT2 aapt2-4.1.0-6503028-osx Daemon #0: Daemon startup failed
This should not happen under normal circumstances, please file an issue if it does.
> A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
> AAPT2 aapt2-4.1.0-6503028-osx Daemon #2: Daemon startup failed
This should not happen under normal circumstances, please file an issue if it does.
> A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
> AAPT2 aapt2-4.1.0-6503028-osx Daemon #4: Daemon startup failed
This should not happen under normal circumstances, please file an issue if it does.
> A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
> AAPT2 aapt2-4.1.0-6503028-osx Daemon #3: Daemon startup failed
This should not happen under normal circumstances, please file an issue if it does.
> A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
> AAPT2 aapt2-4.1.0-6503028-osx Daemon #5: Daemon startup failed
This should not happen under normal circumstances, please file an issue if it does.
> A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
> AAPT2 aapt2-4.1.0-6503028-osx Daemon #6: Daemon startup failed
This should not happen under normal circumstances, please file an issue if it does.
> A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
> AAPT2 aapt2-4.1.0-6503028-osx Daemon #7: Daemon startup failed
This should not happen under normal circumstances, please file an issue if it does.
【问题讨论】:
-
你曾经尝试清理过Android项目吗?例如通过运行“cd android && ./gradlew clean”
-
第一,你的JAVA_HOME路径不对,一定是
export JAVA_HOME="/Applications/Android\ Studio.app/Contents/jre/jdk/Contents/Home"第二,你的模拟器/物理设备上安装应用了吗?如果是这样,请尝试卸载您的应用并重新运行它 -
@LinhNguyễn 尝试按照您的建议更改 java_home 仍然错误相同,请帮助
-
你解决了吗?
-
@OliverD 还没有
标签: android macos react-native react-native-android