Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Pixel 2 Emulator / Virtual Device not in AVD manager device list

Question

Can you only create the Pixel 2 virtual device via Android Studio (v3.1.4) and not via avdmanager?

What we want to do

Use avdmanager to create a Pixel 2 device automatically (Continuous Integration script based on avdmanger). We need to use the pixel 2 device explicitly.

Problem

Executing $ANDROID_HOME/tools/bin/avdmanager list does not return a Pixel 2 hardware profile but returns an error:

Parsing ****
Available Android Virtual Devices:
The following Android Virtual Devices could not be loaded:
    Name: Pixel_2_API_28
    Path: /home/user/.android/avd/Pixel_2_API_28.avd
   Error: Google pixel_2 no longer exists as a device
Available devices definitions:
id: 0 or "tv_1080p"
    Name: Android TV (1080p)
    OEM : Google
    Tag : android-tv

Additional Details

I had to execute the following command to execute the avdmanager command with JAVA 10.0.2 export JAVA_OPTS='-XX:+IgnoreUnrecognizedVMOptions --add-modules java.se.ee'. Else, I receive the error mentioned here: Failed to install android-sdk: "java.lang.NoClassDefFoundError: javax/xml/bind/annotation/XmlSchema"

like image 441
hb0 Avatar asked Sep 14 '18 09:09

hb0


2 Answers

I was able to find the description of the Pixel 2 that the Android Studio plugin uses in

com/android/sdklib/devices/nexus.xml,

that file is in

$ANDROID_HOME/plugins/android/lib/sdklib.jar

but I haven't been able to figure out how to get avdmanager to load the same sdklib that the Android Studio plugin uses.

like image 69
Asyn DE Shown Avatar answered Oct 11 '22 06:10

Asyn DE Shown


I've solved the problem using AndroidSDK/cmdline-tools/latest/bin/avdmanager.

  • You can install the new tools from here: https://developer.android.com/studio/command-line
  • or From Android Studio:

enter image description here

The old AndroidSDK/tools folder has been deprecated and should not be used anymore

like image 26
MatPag Avatar answered Oct 11 '22 06:10

MatPag