Android-studio:无法找到ADB [英] Android-studio: Unable to locate adb

查看:663
本文介绍了Android-studio:无法找到ADB的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我阅读了无法找到adb"的答案.使用Android Studio >错误:无法找到adb在Android Studio的SDK中,但并不能解决我的问题.

I read the answers "unable to locate adb" using Android Studio and Error:Unable to locate adb within SDK in Android Studio and it didn't solve my problem.

我使用4.0 android-studio和Ubuntu 18.04

I use the 4.0 android-studio and Ubuntu 18.04

当我单击在模拟器中启动此AVD"时,出现错误消息无法找到adb". 我确实在Android/Sdk/platform-tools中查看过,我有一个"adb"可执行文件.

When I click on "launch this AVD in the emulator", I get an error message "Unable to locate adb". I did look in the Android/Sdk/platform-tools, I have an "adb" executable.

在无法找到adb"错误消息之后,AVD仍会启动.但是,当我尝试在其上运行我的本机应用程序时,出现错误

After the "unable to locate adb" error message, the AVD still launches. But, when I try to run my react native app on it, I get the error

错误无法安装该应用程序.确保您已设置Android开发环境: https://facebook.github.io/react-native/docs/getting-started.html#android-development-environment .使用--verbose标志运行CLI以获取更多详细信息. 错误:命令失败:./gradlew app:installDebug -PreactNativeDevServerPort = 8081

error Failed to install the app. Make sure you have the Android development environment set up: https://facebook.github.io/react-native/docs/getting-started.html#android-development-environment. Run CLI with --verbose flag for more details. Error: Command failed: ./gradlew app:installDebug -PreactNativeDevServerPort=8081

我很确定react-native部分很好,但是到仿真器的路由与以前不同.

I'm pretty sure the react-native part is fine, but that route to the emulator is not the same as before.

它曾经在工作.昨天,出乎意料的是,当我启动android-studio时,它重新启动"(向我显示安装向导等),似乎搞乱了其配置.

It was working before. Yesterday, out of the blue, when I launched my android-studio, it "restarted" (showing me the install wizard, etc), and it seems it messed up its configuration.

[错误的方式]我创建了一个新的ubuntu用户,重新安装android studio + react-native.我仍然收到错误消息,仍然会启动AVD,但是现在React-native可以在其上安装应用程序.因此,现在我可以与新用户一起使用,但是我没有解决问题.

[bad way] I created a new ubuntu user, re-install android studio + react-native. I still get the error message, still the AVD launches, but now React-native can install the app on it. So, now I can work with my new user, but I did not fix the problem.

[好方法] @jpatmore修复了android-studio部分(请参见他的回答). 反应本地人仍然无法正常工作.在[我的项目]/android/[gradle或其他内容]中可能仍存在android-studio 3.6的某些参数 我将我的存储库克隆到另一个文件夹中,再执行另一个"npm install","react-native link",并且可以正常工作.

[good way] @jpatmore fixed the android-studio part (see his answer). The react-native was still not working. There was probably some parameter of android-studio 3.6 still in the [my project]/android/[gradle or something] I cloned my repo in another folder, do another "npm install", "react-native link", and it was working.

推荐答案

将Android Studio从3.6.3版本更新到4.0后,我开始出现此错误.它并没有停止仿真器的工作,但是隐约令人讨厌.

I started getting this error after updating Android Studio from version 3.6.3 to 4.0. It didn't stop the emulator working, but it was vaguely annoying.

我检查adb.exe是否在文件夹C:\ Users [用户名] \ AppData \ Local \ Android \ Sdk \ platform-tools中.我还在命令行中运行了它,以证明该exe可以正常运行.

I checked that adb.exe was in the folder C:\Users[username]\AppData\Local\Android\Sdk\platform-tools. I also ran it in a command-line to prove that the exe worked OK.

最后,经过一番挣扎,我找到了解决方案:

Finally after a bit of a struggle I found a solution:

启动SDK管理器,依次选择文件"菜单->设置"->外观&行为->系统设置-> Android SDK,SDK工具选项卡(或单击工具栏中带有蓝色向下箭头图标的多维数据集).

Start the SDK Manager, File menu -> Settings -> Appearance & Behavior -> System Settings -> Android SDK, SDK Tools tab (Or click the cube with blue down arrow icon in the toolbar).

首先,我更新了Android SDK平台工具(现为v30.0.2).这不能解决问题.我还尝试过手动删除平台工具文件夹并重新安装.

Firstly I updated the Android SDK Platform-Tools (now v30.0.2). This didn't fix the problem. I also tried manually deleting the platform tools folder and reinstalling.

最终,我决定单击"Android SDK位置"框旁边的编辑"链接.这将打开"SDK组件设置"的新对话框.那有多隐藏?!?!我一直以为是要编辑SDK路径!

Eventually I decided to click the "Edit" link next to the "Android SDK Location" box. This opens a new dialog for SDK Components Setup. How well hidden is that?!?! I had always assumed it was to edit the SDK path!

您现在应该看到,与已安装的所有SDK平台一样,Android SDK-(已安装)在复选框中有一个勾号.单击下一步按钮,您的SDK将更新. 问题解决了.

You should now see that Android SDK - (installed) has a tick in the checkbox, as do any SDK Platforms you have. Click on the Next button and your SDK will update. Problem solved.

HTH

这篇关于Android-studio:无法找到ADB的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆