Android Studio 3.3 Emulator doesn't run Hello World

0

I just installed Android Studio and tried to run "Hello World!" for the very first time on the Android Studio Emulator.  The emulator works but the app isn't installed at all and doesn't run.  I got this message at the 4:Run tab:

Device emulator-5554disconnected, monitoring stopped

I didn't find a solution so far; all solutions are concerned with Eclipse, not Android Studio.  I tried everything I could.

screenshot

Youssef Mokhtar

Posted 2019-03-24T02:44:36.840

Reputation: 11

Answers

0

Had the same problem, and it seems Android Studio's list of devices does not match what is actually possible to use. Running avdmanager list avd on the command line told me this about the device I was trying to emulate:

The following Android Virtual Devices could not be loaded:
    Name: Pixel_2_API_27
    Path: C:\Users\foo\.android\avd\Pixel_2_API_27.avd
   Error: Google pixel_2 no longer exists as a device

The strange thing is that the emulator was running just fine, but the debug connection was dropping immediately after starting.

Running avdmanager list device gives me completely different options from the AVD Manager inside Android Studio. I don't know how to make them agree with each other, but I got around it by emulating a device I found in both lists (the Nexus 6P in my case).

Pianosaurus

Posted 2019-03-24T02:44:36.840

Reputation: 210

-1

Android Studio is based on Eclipse, so that one of the suggestions you didn't try might actually have helped. You should have also listed the solutions you already tried, because there are many reasons for this error code. Below is a small list:

  1. You might have not waited long enough for the emulator to run the OS before trying to install the app. Launch the emulator and then wait for the home screen to appear before running the app in Eclipse.

  2. Installed VPN software might conflict and may need to be uninstalled.

  3. Launch Options "Wipe user data" might help, by right-click on the Android Project, Configurations, Target, found in the Emulator launch parameters.

  4. Ensure the project has an appropriate Virtual Device defined for it in the AVD manager:

    1. Go to "Project"-> Properties-> Android.
    2. On the right pane see what line is checked in the Project build target.
      Remember the target platform number that appears in the selected line.
    3. Go to "Windows"-> AVD Manager.
    4. Check the list of existing Android Virtual Devices for a device that matches the Platform and API level that you have set for your project (see step #2 above).
    5. If there is no line that includes an AVD for your platform (as I suspect), add it using the "New" button.
    6. A "Create New Android Virtual Device" window will be opened. set a new device name. in the "Target" selection box choose the right platform for your project.
  5. Leaving Eclipse and the emulator open (even though Eclipse doesn't find it), run the command line adb kill-server followed by adb start-server, and after adb starts again, try to run your project from Eclipse.

  6. Open the Device view of Android in Eclipse IDE, then click the "Reset Adb" menu item on the Device menu, then run the application again.

  7. In Preferences > Android > DDMS, check Use ADBHost, set ADB Connection timeout to 1000000 and Method Profile Buffer to 20MB.

These are only some of the solutions, and might not solve your problem.

harrymc

Posted 2019-03-24T02:44:36.840

Reputation: 306 093

Actually, Android Studio is based on IntelliJ IDEA, and is essentialy just IDEA with the Android plugin preinstalled. I have the same problem OP has, and the closest equivalents of the Eclipse fixes don't seem to work. – Pianosaurus – 2019-06-06T10:03:40.997