You are not logged in.

#1 2017-05-07 15:21:24

welkie
Member
Registered: 2017-05-07
Posts: 17

[SOLVED] Android Studio - Cannot launch AVDs

I'm using Android Studio installed via the "android-studio" package from the AUR. I chose not to install the SDK using AUR packages, instead allowing the IDE to manage my SDK for me.

I'm having an issue where I try to launch any AVD and it shows "Starting AVD..." at the bottom center with a loading bar, but then when the loading bar finishes, nothing happens. The AVD isn't launched and Android Studio is still running as if I had never tried to launch one. Previously, on Ubuntu, I had issues running AVDs with hardware graphics, where I would get an error message about drivers, and I could get around that by setting my AVDs to launch with software graphics. On Arch, it makes no different whether I set them up for hardware or software graphics, they don't launch.

I was wondering if anybody could help me with this.

Last edited by welkie (2017-05-12 07:15:53)

Offline

#2 2017-05-07 15:52:53

ewaller
Administrator
From: Pasadena, CA
Registered: 2009-07-13
Posts: 19,791

Re: [SOLVED] Android Studio - Cannot launch AVDs

Try turning off hardware acceleration on the AVD


Nothing is too wonderful to be true, if it be consistent with the laws of nature -- Michael Faraday
Sometimes it is the people no one can imagine anything of who do the things no one can imagine. -- Alan Turing
---
How to Ask Questions the Smart Way

Offline

#3 2017-05-07 15:56:12

welkie
Member
Registered: 2017-05-07
Posts: 17

Re: [SOLVED] Android Studio - Cannot launch AVDs

ewaller wrote:

Try turning off hardware acceleration on the AVD

I already tried turning off hardware acceleration on the AVD. The "Graphics" drop-down has three options:

- Automatic
- Hardware - GLES 2.0
- Software - GLES 2.0

I've tried all three, with the same result.

Offline

#4 2017-05-07 16:45:16

Drehstromlampe
Member
From: GER
Registered: 2015-07-18
Posts: 45

Re: [SOLVED] Android Studio - Cannot launch AVDs

Check if the AVD launches without android studio.

Offline

#5 2017-05-07 16:56:18

gnox
Member
Registered: 2013-05-18
Posts: 81

Re: [SOLVED] Android Studio - Cannot launch AVDs

I had the same problem, what  I did was to move from the SDK to a backup dir these two files

$SDK_DIR/emulator/libststdc++.so.6
$SDK_DIR/emulator/libststdc++.so.6.0.18

Is not a good solution but it worked for me, maybe it has something to do with the LD_LIBRARY_PATH but I didnt try anything else.

Offline

#6 2017-05-08 05:18:22

welkie
Member
Registered: 2017-05-07
Posts: 17

Re: [SOLVED] Android Studio - Cannot launch AVDs

In my SDK directory, I have an emulator directory, but inside I have two more directories, "lib" and "lib64". The files with "c++" in their name aren't in the emulator directory. I do see them if I explore the "lib" and "lib64" directories, but they don't end in ".so.6" or ".so.6.0.18". It looks like this:

$ pwd && tree .
/home/mwelke/Android/Sdk/emulator
.
├── bin64
│   ├── e2fsck
│   ├── fsck.ext4
│   ├── mkfs.ext4
│   ├── resize2fs
│   └── tune2fs
├── emulator
├── emulator64-arm
├── emulator64-crash-service
├── emulator64-mips
├── emulator64-x86
├── emulator-check
├── lib
│   ├── advancedFeatures.ini
│   ├── ca-bundle.pem
│   ├── hardware-properties.ini
│   ├── libstdc++
│   │   ├── libstdc++.so.6
│   │   └── libstdc++.so.6.0.18
│   └── pc-bios
│       ├── bios-256k.bin
│       ├── bios.bin
│       ├── efi-virtio.rom
│       ├── kvmvapic.bin
│       ├── linuxboot.bin
│       ├── linuxboot_dma.bin
│       └── vgabios-cirrus.bin
├── lib64
│   ├── gles_mesa
│   │   ├── libGL.so
│   │   └── libGL.so.1
│   ├── gles_swiftshader
│   │   ├── libEGL.so
│   │   ├── libGLES_CM.so
│   │   └── libGLESv2.so
│   ├── lib64EGL_translator.so
│   ├── lib64emugl_test_shared_library.so
│   ├── lib64GLES12Translator.so
│   ├── lib64GLES_CM_translator.so
│   ├── lib64GLES_V2_translator.so
│   ├── lib64OpenglRender.so
│   ├── libstdc++
│   │   ├── libstdc++.so.6
│   │   └── libstdc++.so.6.0.18
│   └── qt
│       ├── lib
│       │   ├── libQt5Concurrent.so
│       │   ├── libQt5Concurrent.so.5
│       │   ├── libQt5Concurrent.so.5.7
│       │   ├── libQt5Concurrent.so.5.7.0
│       │   ├── libQt5Core.so
│       │   ├── libQt5Core.so.5
│       │   ├── libQt5Core.so.5.7
│       │   ├── libQt5Core.so.5.7.0
│       │   ├── libQt5DBus.so
│       │   ├── libQt5DBus.so.5
│       │   ├── libQt5DBus.so.5.7
│       │   ├── libQt5DBus.so.5.7.0
│       │   ├── libQt5Gui.so
│       │   ├── libQt5Gui.so.5
│       │   ├── libQt5Gui.so.5.7
│       │   ├── libQt5Gui.so.5.7.0
│       │   ├── libQt5Network.so
│       │   ├── libQt5Network.so.5
│       │   ├── libQt5Network.so.5.7
│       │   ├── libQt5Network.so.5.7.0
│       │   ├── libQt5OpenGL.so
│       │   ├── libQt5OpenGL.so.5
│       │   ├── libQt5OpenGL.so.5.7
│       │   ├── libQt5OpenGL.so.5.7.0
│       │   ├── libQt5PrintSupport.so
│       │   ├── libQt5PrintSupport.so.5
│       │   ├── libQt5PrintSupport.so.5.7
│       │   ├── libQt5PrintSupport.so.5.7.0
│       │   ├── libQt5Sql.so
│       │   ├── libQt5Sql.so.5
│       │   ├── libQt5Sql.so.5.7
│       │   ├── libQt5Sql.so.5.7.0
│       │   ├── libQt5Svg.so
│       │   ├── libQt5Svg.so.5
│       │   ├── libQt5Svg.so.5.7
│       │   ├── libQt5Svg.so.5.7.0
│       │   ├── libQt5Test.so
│       │   ├── libQt5Test.so.5
│       │   ├── libQt5Test.so.5.7
│       │   ├── libQt5Test.so.5.7.0
│       │   ├── libQt5Widgets.so
│       │   ├── libQt5Widgets.so.5
│       │   ├── libQt5Widgets.so.5.7
│       │   ├── libQt5Widgets.so.5.7.0
│       │   ├── libQt5XcbQpa.so
│       │   ├── libQt5XcbQpa.so.5
│       │   ├── libQt5XcbQpa.so.5.7
│       │   ├── libQt5XcbQpa.so.5.7.0
│       │   ├── libQt5Xml.so
│       │   ├── libQt5Xml.so.5
│       │   ├── libQt5Xml.so.5.7
│       │   └── libQt5Xml.so.5.7.0
│       └── plugins
│           ├── bearer
│           │   ├── libqconnmanbearer.so
│           │   ├── libqgenericbearer.so
│           │   └── libqnmbearer.so
│           ├── generic
│           │   ├── libqevdevkeyboardplugin.so
│           │   ├── libqevdevmouseplugin.so
│           │   ├── libqevdevtabletplugin.so
│           │   ├── libqevdevtouchplugin.so
│           │   └── libqtuiotouchplugin.so
│           ├── iconengines
│           │   └── libqsvgicon.so
│           ├── imageformats
│           │   ├── libqgif.so
│           │   ├── libqico.so
│           │   ├── libqjpeg.so
│           │   └── libqsvg.so
│           ├── platforminputcontexts
│           │   ├── libcomposeplatforminputcontextplugin.so
│           │   └── libibusplatforminputcontextplugin.so
│           ├── platforms
│           │   ├── libqlinuxfb.so
│           │   ├── libqminimal.so
│           │   ├── libqoffscreen.so
│           │   └── libqxcb.so
│           └── sqldrivers
│               └── libqsqlite.so
├── mksdcard
├── NOTICE.txt
├── package.xml
├── qemu
│   └── linux-x86_64
│       ├── qemu-system-aarch64
│       ├── qemu-system-armel
│       ├── qemu-system-i386
│       ├── qemu-system-mips64el
│       ├── qemu-system-mipsel
│       ├── qemu-system-x86_64
│       ├── qemu-upstream-aarch64
│       ├── qemu-upstream-armel
│       ├── qemu-upstream-i386
│       ├── qemu-upstream-mips64el
│       ├── qemu-upstream-mipsel
│       └── qemu-upstream-x86_64
├── resources
│   └── resources.rcc
└── source.properties

21 directories, 125 files

Do you think I may be missing something from the SDK? Or perhaps a dependency of Android Studio was not installed?

EDIT:

I see it now. I had a directory called "libstdc++" and inside were those two files. I used "mv" to move them to "<filename>.bak" files in the same directory. I can now launch the AVD, even with hardware acceleration enabled.

Very interesting. Thanks for the tip!

Last edited by welkie (2017-05-08 19:51:56)

Offline

#7 2017-05-08 12:44:24

olegabrielz
Member
From: Norway
Registered: 2015-12-23
Posts: 255

Re: [SOLVED] Android Studio - Cannot launch AVDs

@welkie: Please edit your post and use code tags (BBCode).

https://wiki.archlinux.org/index.php/Co … s_and_code


Be aware of my Newbie Powers

Offline

#8 2017-05-08 19:52:18

welkie
Member
Registered: 2017-05-07
Posts: 17

Re: [SOLVED] Android Studio - Cannot launch AVDs

olegabrielz wrote:

@welkie: Please edit your post and use code tags (BBCode).

https://wiki.archlinux.org/index.php/Co … s_and_code

Thanks for the link, I was wondering about formatting posts. I'll keep that in mind.

Should we consider this issue with AVDs solved because of the moving files workaround? Or should this be investigated further?

Last edited by welkie (2017-05-08 19:53:03)

Offline

#9 2017-05-11 08:42:02

rexct
Member
Registered: 2012-02-03
Posts: 2

Re: [SOLVED] Android Studio - Cannot launch AVDs

It seems still have a problem using AVD with hardware acceleration.
The workaround is replacing libstdc++.so.6 with a symbolic link to /usr/lib/libstdc++.so.6.

# ln -s /usr/lib/libstdc++.so.6 $SDK_DIR/emulator/lib64/libstdc++/libstdc++.so.6

Offline

#10 2017-05-12 06:14:44

welkie
Member
Registered: 2017-05-07
Posts: 17

Re: [SOLVED] Android Studio - Cannot launch AVDs

rexct wrote:

It seems still have a problem using AVD with hardware acceleration.
The workaround is replacing libstdc++.so.6 with a symbolic link to /usr/lib/libstdc++.so.6.

# ln -s /usr/lib/libstdc++.so.6 $SDK_DIR/emulator/lib64/libstdc++/libstdc++.so.6

I actually already used a workaround where I moved the files to a different filename in their directory, which then caused the AVDs to start working. I'm guessing it accomplished the same thing as creating the symlinks would - forcing Android Studio to use the system version of libstdc++ instead of the one supplied with Android Studio. Weird that this fixes things... you would expect that using a specific version of a dependency the software ships with would work better.

This workaround reminded me of how I used the same workaround to fix this issue on Ubuntu. And it actually started happening within the last year, where before that, it was working fine without the workaround. This seems to be an ongoing issue affecting multiple distros. I wonder if there's a way to modify the way Android Studio is installed in Arch to automatically apply a workaround until a solution is found upstream.

Offline

#11 2017-05-12 06:37:07

gnox
Member
Registered: 2013-05-18
Posts: 81

Re: [SOLVED] Android Studio - Cannot launch AVDs

With this (fish shell) without moving files works also:

env LD_PRELOAD=/usr/lib/libstdc++.so.6 ./emulator -netdelay none -netspeed full -avd <avd-name>

So maybe just an export of LD_PRELOAD in .bashrc or .profile could be enough.

EDIT: or follow the wiki smile and  just export :

export ANDROID_EMULATOR_USE_SYSTEM_LIBS=1

Last edited by gnox (2017-05-12 06:50:38)

Offline

#12 2017-05-12 06:41:01

welkie
Member
Registered: 2017-05-07
Posts: 17

Re: [SOLVED] Android Studio - Cannot launch AVDs

gnox wrote:

With this (fish shell) without moving files works also:

env LD_PRELOAD=/usr/lib/libstdc++.so.6 ./emulator -netdelay none -netspeed full -avd <avd-name>

So maybe just an export of LD_PRELOAD in .bashrc or .profile could be enough.

Just tested this. I moved my libstdc++ files back to their original filenames and exported that env variable. AVD launches.

However, as I expected, this only worked for me when launching Android Studio from the bash terminal, so that the env variable would be carried into the child process. Launching Android Studio with the system icon (GNOME for me) resulted in the AVD not launching.

Last edited by welkie (2017-05-12 06:42:56)

Offline

#13 2017-05-12 06:52:57

gnox
Member
Registered: 2013-05-18
Posts: 81

Re: [SOLVED] Android Studio - Cannot launch AVDs

welkie wrote:
gnox wrote:

With this (fish shell) without moving files works also:

env LD_PRELOAD=/usr/lib/libstdc++.so.6 ./emulator -netdelay none -netspeed full -avd <avd-name>

So maybe just an export of LD_PRELOAD in .bashrc or .profile could be enough.

Just tested this. I moved my libstdc++ files back to their original filenames and exported that env variable. AVD launches.

However, as I expected, this only worked for me when launching Android Studio from the bash terminal, so that the env variable would be carried into the child process. Launching Android Studio with the system icon (GNOME for me) resulted in the AVD not launching.

Should be added that or the ANDROID_EMULATOR_USE_SYSTEM_LIBS in .profile or globally in /etc/profile.d .

Offline

#14 2017-05-12 07:03:51

welkie
Member
Registered: 2017-05-07
Posts: 17

Re: [SOLVED] Android Studio - Cannot launch AVDs

gnox wrote:

Should be added that or the ANDROID_EMULATOR_USE_SYSTEM_LIBS in .profile or globally in /etc/profile.d .

That worked perfectly too. I appended

export ANDROID_EMULATOR_USE_SYSTEM_LIBS=1

to my

$HOME/.profile

file.

I see in your edited post that this entire process was apparently already on the wiki. Perhaps I should have read it more thoroughly. Thanks again for your help.

EDIT:

The reason I didn't catch this in the wiki was because it was under a heading that didn't describe my problem. I encountered the problem with no error message displayed. I edited the wiki to include this: https://wiki.archlinux.org/index.php/An … _displayed. And I'm marking this thread as solved.

Last edited by welkie (2017-05-12 07:15:37)

Offline

#15 2017-08-09 15:30:50

Juszr
Member
Registered: 2013-03-12
Posts: 87

Re: [SOLVED] Android Studio - Cannot launch AVDs

Hi.

I am still having the same issue, after deleting libstdc++ folder and adding thie ENV var.

I added this line and still not working (i already logged out and back in):
echo "LD_PRELOAD=/usr/lib/libstdc++.so.6" >> .bashrc

[UPDATE]
It turned out that the KVM module was busy due to VirtualBox being executed in background:

ioctl(KVM_CREATE_VM) failed: 16 Device or resource busy
failed to initialize KVM: Device or resource busy

Any way so that the KVM module would work with both VMs?

Regards

Last edited by Juszr (2017-08-09 19:19:23)

Offline

Board footer

Powered by FluxBB