在Ubuntu 18.04上反应本机Android模拟器错误

编程入门 行业动态 更新时间:2024-10-22 07:30:12
本文介绍了在Ubuntu 18.04上反应本机Android模拟器错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我正在尝试设置本机反应以在android模拟器上工作.我正在使用Ubuntu 18.04.我尝试使用"react-native run-android"时收到此错误消息:

I am trying to setup react native to work on an android emulator. I am using Ubuntu 18.04. I am getting this error message when i try to use "react-native run-android":

BUILD FAILED in 1m 21s 28 actionable tasks: 28 executed Could not install the app on the device, read the error above for details. Make sure you have an Android emulator running or a device connected and have set up your Android development environment: facebook.github.io/react-native/docs/getting-started.html Command failed: ./gradlew installDebug Error: Command failed: ./gradlew installDebug at checkExecSyncError (child_process.js:637:11) at Object.execFileSync (child_process.js:655:13) at runOnAllDevices (/home/william/react/AwesomeProject/node_modules/react-native/local-cli/runAndroid/runAndroid.js:299:19) at buildAndRun (/home/william/react/AwesomeProject/node_modules/react-native/local-cli/runAndroid/runAndroid.js:135:12) at isPackagerRunning.then.result (/home/william/react/AwesomeProject/node_modules/react-native/local-cli/runAndroid/runAndroid.js:65:12) at processTicksAndRejections (internal/process/next_tick.js:81:5)

此外,它说:

A problem was found with the configuration of task ‘:app:installDebug’. File ‘/home/william/Android/platform-tools/adb’ specified for property ‘adbExe’ does not exist.

在我的本机项目中,我找到了一个答案,说在我的settings.gradle中将"/"替换为".但是,其中唯一的文件是:rootProject.name =‘AwesomeProject’包括‘:app’

I found an answer that said to replace ‘/’ with ‘’ in my settings.gradle in my react native project. The only thing in that is file however is: rootProject.name = ‘AwesomeProject’ include ‘:app’

我添加了:

export PATH="$HOME/bin:$PATH" export ANDROID_HOME=$HOME/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

直到我的bashrc的结尾.

To the end of my bashrc.

推荐答案

对我来说,解决方案是创建android/local.properties文件并在磁盘上指定SDK路径 sdk.dir=/username/Android/Sdk

solution for me was to create android/local.properties file and specify SDK path on your disk sdk.dir=/username/Android/Sdk

更多推荐

在Ubuntu 18.04上反应本机Android模拟器错误

本文发布于:2023-07-04 11:06:46,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1023576.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:模拟器   本机   错误   Ubuntu   Android

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!