Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 815307 - dev-util/android-studio: Emulator unable to run
Summary: dev-util/android-studio: Emulator unable to run
Status: UNCONFIRMED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Jason A. Donenfeld
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-09-29 06:46 UTC by Casey Avila
Modified: 2021-11-29 09:19 UTC (History)
4 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Casey Avila 2021-09-29 06:46:27 UTC
Upon trying to run the android emulator in the AVD installed with android-studio, an error is prompted stating "Not enough memory to run HAXM." My computer, with 16 gigabytes of memory is most definitely enough to run the android emulator, and I had successfully ran it before the icedtea-bin package was updated to 3.16.0.


Some notes:
Prior to icedtea-bin 3.16.0, the emulator would start successfully with icedtea-bin (yet the error would occur with openjdk-bin). Because of this, I don't think it's actually an issue of memory quantity, along with the fact that HAXM isn't used on Linux because there is KVM. Also, the fact that it worked with icedtea-bin and not openjdk-bin leads me to believe this is a packaging issue.
Comment 1 Casey Avila 2021-09-29 06:46:54 UTC
Portage 3.0.20 (python 3.9.6-final-0, default/linux/amd64/17.1/hardened, gcc-10.3.0, glibc-2.33-r1, 5.10.61-gentoo x86_64)
=================================================================
System uname: Linux-5.10.61-gentoo-x86_64-AMD_Ryzen_5_1600X_Six-Core_Processor-with-glibc2.33
KiB Mem:    16406164 total,   2615236 free
KiB Swap:    8388604 total,   8372988 free
Timestamp of repository gentoo: Wed, 29 Sep 2021 05:30:01 +0000
Head commit of repository gentoo: 4538454589d0f37545ec378638d54b07f1c3c59b
Timestamp of repository brother-overlay: Sun, 19 Sep 2021 21:51:57 +0000
Head commit of repository brother-overlay: 09ee0c1e201a47821384e215b1f4e60daa6c2e9c

Timestamp of repository guru: Mon, 27 Sep 2021 17:07:23 +0000
Head commit of repository guru: 3e1bf76cfe853b1acb661c93620fceea17cd20e9

Timestamp of repository ricerlay: Mon, 27 Sep 2021 17:07:22 +0000
Head commit of repository ricerlay: dbfc527161bcb7d503549ed8db4c0530dac57e9f

sh bash 5.1_p8
ld GNU ld (Gentoo 2.37_p1 p0) 2.37
app-shells/bash:          5.1_p8::gentoo
dev-java/java-config:     2.3.1::gentoo
dev-lang/perl:            5.34.0-r2::gentoo
dev-lang/python:          3.9.6_p2::gentoo
dev-lang/rust:            1.53.0::gentoo
dev-util/cmake:           3.20.5::gentoo
sys-apps/baselayout:      2.7::gentoo
sys-apps/openrc:          0.43.5::gentoo
sys-apps/sandbox:         2.24::gentoo
sys-devel/autoconf:       2.13-r1::gentoo, 2.69-r5::gentoo
sys-devel/automake:       1.16.4::gentoo
sys-devel/binutils:       2.37_p1::gentoo
sys-devel/gcc:            10.3.0-r2::gentoo
sys-devel/gcc-config:     2.4::gentoo
sys-devel/libtool:        2.4.6-r6::gentoo
sys-devel/make:           4.3::gentoo
sys-kernel/linux-headers: 5.10::gentoo (virtual/os-headers)
sys-libs/glibc:           2.33-r1::gentoo
Repositories:

gentoo
    location: /var/db/repos/gentoo
    sync-type: rsync
    sync-uri: rsync://rsync.gentoo.org/gentoo-portage
    priority: -1000
    sync-rsync-verify-max-age: 24
    sync-rsync-verify-jobs: 1
    sync-rsync-extra-opts: 
    sync-rsync-verify-metamanifest: yes

brother-overlay
    location: /var/db/repos/brother-overlay
    sync-type: git
    sync-uri: https://github.com/gentoo-mirror/brother-overlay.git
    masters: gentoo

guru
    location: /var/db/repos/guru
    sync-type: git
    sync-uri: https://github.com/gentoo-mirror/guru.git
    masters: gentoo

kc
    location: /var/db/repos/kc
    masters: gentoo

ricerlay
    location: /var/db/repos/ricerlay
    sync-type: git
    sync-uri: https://github.com/gentoo-mirror/ricerlay.git
    masters: gentoo

ACCEPT_KEYWORDS="amd64"
ACCEPT_LICENSE="@FREE"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-march=native -O2 -pipe"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/share/gnupg/qualified.txt"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/dconf /etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo"
CXXFLAGS="-march=native -O2 -pipe"
DISTDIR="/var/cache/distfiles"
ENV_UNSET="CARGO_HOME DBUS_SESSION_BUS_ADDRESS DISPLAY GOBIN GOPATH PERL5LIB PERL5OPT PERLPREFIX PERL_CORE PERL_MB_OPT PERL_MM_OPT XAUTHORITY XDG_CACHE_HOME XDG_CONFIG_HOME XDG_DATA_HOME XDG_RUNTIME_DIR"
FCFLAGS="-march=native -O2 -pipe"
FEATURES="assume-digests binpkg-docompress binpkg-dostrip binpkg-logs config-protect-if-modified distlocks ebuild-locks fixlafiles ipc-sandbox merge-sync multilib-strict network-sandbox news parallel-fetch pid-sandbox preserve-libs protect-owned qa-unresolved-soname-deps sandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync xattr"
FFLAGS="-march=native -O2 -pipe"
GENTOO_MIRRORS="http://distfiles.gentoo.org"
LANG="es_MX.utf8"
LDFLAGS="-Wl,-O1 -Wl,--as-needed"
MAKEOPTS="-j12"
PKGDIR="/var/cache/binpkgs"
PORTAGE_CONFIGROOT="/"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --omit-dir-times --compress --force --whole-file --delete --stats --human-readable --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages --exclude=/.git"
PORTAGE_TMPDIR="/var/tmp"
USE="X acl alsa amd64 bluetooth bzip2 crypt elogind hardened iconv ipv6 libglvnd libtirpc multilib ncurses nls nptl openmp pam pcre pie pulseaudio readline seccomp split-usr ssl ssp unicode vdpau vulkan xattr xtpax zlib" ABI_X86="64" ADA_TARGET="gnat_2019" ALSA_CARDS="ali5451 als4000 atiixp atiixp-modem bt87x ca0106 cmipci emu10k1x ens1370 ens1371 es1938 es1968 fm801 hda-intel intel8x0 intel8x0m maestro3 trident usb-audio via82xx via82xx-modem ymfpci" APACHE2_MODULES="authn_core authz_core socache_shmcb unixd actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache cgi cgid dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" CALLIGRA_FEATURES="karbon sheets words" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" CPU_FLAGS_X86="aes avx avx2 f16c fma3 mmx mmxext pclmul popcnt rdrand sha sse sse2 sse3 sse4_1 sse4_2 sse4a ssse3" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock greis isync itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf skytraq superstar2 timing tsip tripmate tnt ublox ubx" INPUT_DEVICES="libinput" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" LUA_SINGLE_TARGET="lua5-1" LUA_TARGETS="lua5-1" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php7-3 php7-4" POSTGRES_TARGETS="postgres12 postgres13" PYTHON_SINGLE_TARGET="python3_9" PYTHON_TARGETS="python3_9" RUBY_TARGETS="ruby26" USERLAND="GNU" VIDEO_CARDS="nvidia" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tarpit sysrq proto steal rawnat logmark ipmark dhcpmac delude chaos account"
Unset:  CC, CPPFLAGS, CTARGET, CXX, EMERGE_DEFAULT_OPTS, INSTALL_MASK, LC_ALL, LINGUAS, PORTAGE_BINHOST, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS, RUSTFLAGS
Comment 2 Tee KOBAYASHI 2021-09-29 22:50:03 UTC
I wonder if this can be worked around by launching emulator directly and not via AVD Manager:

$ /opt/android-sdk-update-manager/emulator && ./emulator -avd foo
Comment 3 Tee KOBAYASHI 2021-09-30 00:04:25 UTC
A typo in my previous comment. I meant

$ cd /opt/android-sdk-update-manager/emulator && ./emulator -avd foo
Comment 4 Casey Avila 2021-09-30 09:01:26 UTC
Oh yes I forgot to mention. Launching the emulator directly works perfectly fine, which was another reason why I thought this might be a packaging bug.

The only minor difference is that my emulator binary is located in `~/Android/Sdk/emulator/` rather than the path you provided.
Comment 5 deim 2021-10-01 10:59:59 UTC
I can confirm the error.
I can also run emulator directly.
AVD manager says in Troubleshoot: "Get more available memory for HAXM".
I have 32GB RAM.
Comment 6 Adam Giergun 2021-10-04 18:51:37 UTC
It seems to be something wrong with AMD Ryzen processor recognition. HAXM is Intel proprietary, completely not usable with AMD processors.

BTW current version of android-studio needs Java 11. Looks like Icedtea 3.16.0 is still based on OpenJDK 8. Have you tried openjdk-bin-11?
Comment 7 deim 2021-10-05 06:19:17 UTC
I have Intel CPU but under Linux it should use KVM.
AFAIK latest Android Studio has JDK 11 included.
In SDK's emulator dir there is emulator-check:

$ ./emulator-check accel
accel:
0
KVM (version 12) is installed and usable.

$ ./emulator-check cpu-info
cpu-info:
146
Intel CPU|Virtualization is supported|64-bit CPU|
Comment 8 Casey Avila 2021-10-12 06:50:21 UTC
As for running with JDK 11, how would we do that? As far as I know the highest version of a system vm you can install on Gentoo is JDK 8.
Comment 9 Adam Giergun 2021-10-16 11:00:38 UTC
(In reply to Casey Avila from comment #8)
> As for running with JDK 11, how would we do that? As far as I know the
> highest version of a system vm you can install on Gentoo is JDK 8.

You are mixing up two things, virtual/jdk (where 11 is still masked), and system-vm, which one can set via eselect. In the latter case it's possible to emerge openjdk (or openjdk-bin) 11, using gentoo-vm switch, and use it as system-vm.
Comment 10 Petric Frank 2021-11-29 09:19:24 UTC
Fresh install on a machine with Intel 6700T CPU. Using openjdk-bin-8*. VT is enabled in BIOS and kvm-intel kernel module is loaded. Checks shown in comment #7 executed successfully.

Using AVD manager it even don't let me configure a VM. At the step to select a VM image it shows the message "Not enough memory for HAXM" for every possible image. The "Next" button is grayed out so i can not complete the AVD configuration.

Copied a AVD from an other machine with an older android studio installation to ~/.android. AVD manager shows this VM but still not allow to start it due to HAXM problem.

From command line executed "~/Android/Sdk/emulator/emulator -avd <avd-name>" starts the AVD successfully.

So i can confirm this bug.

If this is relevant - installed also openjdk-bin-11* but "eselect java-vm list" does not list it as option.