Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android Studio - launch emulator AVD - "unable to locate adb"

When I launch emulator in Android Studio through AVD, it keeps on having this annoying popup "unable to locate avd".

  • I'ved removed platform tools and reinstall it under SDK Manager->SDK Tools->Android SDK platform-tools so that its a new avd.exe but it doesnt help.

I am really clueless now how, I would like adb prints coming from the emulator to debug. How can I solve this ?

FYI, I am developing flutter on Android Studio 4.0

enter image description here

like image 752
Axil Avatar asked Jun 19 '20 10:06

Axil


1 Answers

I had the same issue as you were facing, I have Researched the Whole Internet but found nothing useful. So, I somehow figured out the problem and fixed it, The problem is at

app/src/main/java/io/flutter/plugins/GeneratedPluginRegistrant.java

Whenever we create a new project due to some reason the Module SDK is not set up automatically. Thus the ADB manager was throwing an error 'Unable to locate AVD', which is not that fatal as the error/warning is not stopping us from launching /starting the emulator, but it is so annoying to see that pop-up box. So here is my simple and quick fix.

Solution:

Click on the project folder, tap the dropdown icon just beside it.

Now Navigate to the path below.

> android/app/src/main/java/io/flutter/plugins/GeneratedPluginRegistrant.java

Now Click on the file GeneratedPluginRegistrant.java to open it.

Once it is open, At the Top you will notice a bar that says 'Module SDK is not defined',

Now right against it, you will also see a hyper-text named 'Setup SDK', Just Click on it.

That will open a Pop-up Box with the title 'Select project SDK'.

Now select the Android Platform API and then click OK. After that being done Restart your IDE.

Your Problem will be Solved. And you will also notice that Emulator Opens up way faster than before.

NOTE:

The Above Steps has to be performed with every new flutter project.

I have attached some screenshots just follow them.

The Problem

The Below image represents the annoying Popup-box that you encounter while launching the AVD which we are going to fix.

warning box

Step 1 : Close the AVD window

Close Warning box

Step 2: Navigate to GeneratedPluginRegistrant.java

Navigate to GeneratedPluginRegistrant.java

Step 3: Look for Module SDK not Defined

GeneratedPluginRegistrant.java file

Module SDK not defined

Step 4: Against to Module SDK click on Setup SDK hyper-text.

Setup SDK Hyper-text

Step 5: Select any Android SDK version

Select project SDK

Step 6: Click OK

Select Android SDK version

Step 7: Restart Android Studio IDE.

Restart the Android Studio IDE

After Restart you wont see the Annoying popup box anymore.

I have also Uploaded a Youtube Video for you. Check that out as well. https://www.youtube.com/watch?v=19ESTnrmYJY&feature=youtu.be

like image 137
Ravikiran Avatar answered Sep 28 '22 04:09

Ravikiran