Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

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.

I use the 4.0 android-studio and Ubuntu 18.04

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.

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

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

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

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.

EDIT: [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.

EDIT2: [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.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
972 views
Welcome To Ask or Share your Answers For Others

1 Answer

A couple of days after posting the above solution, the problem returned on my Windows system.

Finally after several hours of investigation I think I have another solution for everyone having issues with AVD Manager "Unable to locate adb".

I know we have the setting for the SDK in File -> Settings -> Appearance & Behavior -> System Settings -> Android SDK. This it seems is not enough! It appears that Android Studio (at least the new version 4) does not give projects a default SDK, despite the above setting.

So, you also (for each project) need to go to File -> Project Structure -> Project Settings -> Project, and select the Project SDK, which is set to [No SDK] by default.

If there's nothing in the drop-down box, then select New, select Android SDK, and navigate to your Android SDK location (normally C:Users[username]AppDataLocalAndroidSdk on Windows). You will then be able to select the Android API xx Platform. You now should not get this annoying adb error.

HTH


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...