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

查看:84
本文介绍了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.

在出现unable to locate adb"错误信息后,AVD 仍然启动.但是,当我尝试在其上运行 React Native 应用程序时,出现错误

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 的参数我将我的 repo 克隆到另一个文件夹中,执行另一个npm install"、react-native 链接",并且它正在工作.

[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[username]AppDataLocalAndroidSdkplatform-tools 中.我还在命令行中运行它以证明 exe 工作正常.

I checked that adb.exe was in the folder C:Users[username]AppDataLocalAndroidSdkplatform-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 Manager,文件菜单->设置->外观&行为 -> 系统设置 -> 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 Platform-Tools(现在是 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!

您现在应该看到 Android SDK -(已安装)在复选框中打勾,您拥有的任何 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天全站免登陆