AndroidStudio启动项目报错error Failed to launch emulator. Reason: No emulators found as an output of `emul
然后重启下 AndroidStudio 就能启动项目了。我是因为android sdk的环境变量没配好。
·
错误:
PS E:\project\AccountManage\android> npm run android
> AccountManage@0.0.1 android
> react-native run-android
info A dev server is already running for this project on port 8081.
ϵͳ�Ҳ���ָ����·����
info Launching emulator...
error Failed to launch emulator. Reason: No emulators found as an output of `emulator -list-avds`.
warn Please launch an emulator manually or connect a device. Otherwise app may fail to launch.
info Installing the app...
> Task :app:installDebug
Installing APK 'app-debug.apk' on 'Medium_Phone_API_31(AVD) - 12' for :app:debug
Installed on 1 device.
BUILD SUCCESSFUL in 6s
43 actionable tasks: 2 executed, 41 up-to-date
info Connecting to the development server...
warn Failed to connect to development server using "adb reverse": spawnSync C:\Users\ASUS\AppData\Local\Android\platform-tools\adb ENOENT
info Starting the app...
系统找不到指定的路径。
error Failed to start the app.
Error: Command failed with exit code 1: C:\Users\ASUS\AppData\Local\Android\platform-tools\adb shell am start -n com.accountmanage/com.accountmanage.MainActivity -a android.intent.action.MAIN -c android.intent.category.LAUNCHER
at makeError (E:\project\AccountManage\node_modules\execa\lib\error.js:60:11)
at module.exports.sync (E:\project\AccountManage\node_modules\execa\index.js:194:17)
at tryLaunchAppOnDevice (E:\project\AccountManage\node_modules\@react-native-community\cli-platform-android\build\commands\runAndroid\tryLaunchAppOnDevice.js:52:22)
at E:\project\AccountManage\node_modules\@react-native-community\cli-platform-android\build\commands\runAndroid\runOnAllDevices.js:93:39
at Array.forEach (<anonymous>)
at runOnAllDevices (E:\project\AccountManage\node_modules\@react-native-community\cli-platform-android\build\commands\runAndroid\runOnAllDevices.js:88:48)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async Command.handleAction (E:\project\AccountManage\node_modules\@react-native-community\cli\build\index.js:118:9)
info Run CLI with --verbose flag for more details.
解决方法:
我是因为android sdk的环境变量没配好
1.找到sdk所在位置
2.配置环境变量
创建新的变量
ANDROID_HOME
添加到path中
%ANDROID_HOME%\tools\bin
%ANDROID_HOME%\tools
%ANDROID_HOME%\emulator
%ANDROID_HOME%\platform-tools
然后重启下 AndroidStudio 就能启动项目了
开放原子开发者工作坊旨在鼓励更多人参与开源活动,与志同道合的开发者们相互交流开发经验、分享开发心得、获取前沿技术趋势。工作坊有多种形式的开发者活动,如meetup、训练营等,主打技术交流,干货满满,真诚地邀请各位开发者共同参与!
更多推荐
已为社区贡献6条内容
所有评论(0)