6

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

Axil
  • 3,606
  • 10
  • 62
  • 136

5 Answers5

19

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

Ruben Helsloot
  • 12,582
  • 6
  • 26
  • 49
Ravikiran
  • 512
  • 3
  • 14
  • 2
    Thank you! At last this annoying pop up is now gone. – Jim E Russel May 05 '21 at 07:53
  • @JimERussel Welcome . I am Glad that it helped you. – Ravikiran May 05 '21 at 07:55
  • 1
    I followed this to solve a similar issue with the `Quick Start` React Native for Android. I drilled down to `android > app > src > debug > java > com > awesomeproject > ReactNativeFlipper.java`. I opened the file and as you mentioned I clicked the link to Setup SDK. Now I don't get the error popup anymore. THANKS!!! – Andrew Lobban Jun 24 '21 at 21:52
0

This may seem very basic but start with a full system restart,

  1. Where did you install the SDK's & AVD(Default Directories).
  2. Do you have the same issue when you plug in your own Physical Device.
  3. Ensure you have enabled USB Debugging for step 2.
  4. If possible walk us through the installation steps so we can identify any possible errors you may have made
Arvin
  • 11
  • 4
  • If you are describing a similar issue to this thread ( https://stackoverflow.com/questions/62462211/installing-emulator-for-flutter-on-android-studio) you will find a solution posted in the first comment by Muhammad – Arvin Jun 19 '20 at 12:08
  • A third and possible reason might be your anti-virus may have flagged it as a fale-positive - This would be the solution for that instance : https://stackoverflow.com/questions/39036796/unable-to-locate-adb-using-android-studio – Arvin Jun 19 '20 at 12:26
0

I've had the same issue and it took a while to figure out what's wrong, but in the end, it was a storage problem, just check if you have couple of gigs (at least 5gb) of free space left where you have your avd installed. That fixed it for me.

Rechem MEG
  • 311
  • 1
  • 10
-2

Try this. Copy platform-tools address and paste it in environment variable in path. C:\Users\viram\AppData\Local\Android\Sdk\platform-tools hope this works.

Jeet Viramgama
  • 608
  • 5
  • 16
-2

I will answer this myself as this was how it was solved.

open a native android project, and then adb works.

This looks like a bug in flutter.

Axil
  • 3,606
  • 10
  • 62
  • 136