Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android emulator closes without warning

I'm using Linux Pop!OS 19.04 and have tried installing the Android Emulator. It does start but it closes within about 30seconds every time.

I have Java 8 installed through 'OpenJDK-8-JDK' and I can successfully build Android packages and side load them onto my phone without a problem.

After installing the Android SDK into the /usr/local/android here is what I did;

  1. Change into the tools bin dir

    cd /usr/local/android/sdk/tools/bin
    sudo chmod +x
    
  2. Install system images (must be done as root)

    sudo ./sdkmanager "system-images;android-25;google_apis;x86"
    sudo ./sdkmanager --licenses
    

    Say 'y' to all sudo touch ~/.android/repositories.cfg

  3. List available Android Virtual Devices to install (done as user)

    ./avdmanager list
    
  4. Create a test Android Virtual Device (AVD)

    ./avdmanager create avd -n test -k "system-images;android-25;google_apis;x86"
    

    custom hardware profile: no

  5. List AVDs

    Now I get the following when I list through avdmanager

    ./avdmanager list avd
    Available Android Virtual Devices:
        Name: test
        Path: /root/.android/avd/test.avd
      Target: Google APIs (Google Inc.)
              Based on: Android 7.1.1 (Nougat) Tag/ABI: google_apis/x86
    
  6. Start emulator

    cd /usr/local/android/sdk/emulator
    ./emulator -avd test
    

It then loads the emulator and I can start applications and browse around until it just crashes/closes the program.

I tried installing Android studio and setting up the AVD through there, same thing happened. I've tried different models and android versions for my AVD, same thing.

Update: Log a crash

I managed to log a crash by using

$ANDROID_HOME/emulator/emulator -avd test -gpu guest -logcat v

log

08-22 13:50:03.169  2703  2839 V NativeCrypto: Read error: ssl=0xb0a32640: I/O error during system call, Connection reset by peer
08-22 13:50:03.170  2703  2839 V NativeCrypto: SSL shutdown failed: ssl=0xb0a32640: I/O error during system call, Broken pipe
08-22 13:50:03.195  3551  3551 W dex2oat : Unexpected CPU variant for X86 using defaults: x86
08-22 13:50:03.195  3551  3551 W dex2oat : Mismatch between dex2oat instruction set features (ISA: X86 Feature string: smp,-ssse3,-sse4.1,-sse4.2,-avx,-avx2,-lock_add,-popcnt) and those of dex2oat executable (ISA: X86 Feature string: smp,ssse3,-sse4.1,-sse4.2,-avx,-avx2,-lock_add,-popcnt) for the command line:
08-22 13:50:03.195  3551  3551 W dex2oat : /system/bin/dex2oat --runtime-arg -classpath --runtime-arg & --instruction-set=x86 --instruction-set-features=smp,ssse3,-sse4.1,-sse4.2,-avx,-avx2,-lock_add,-popcnt --runtime-arg -Xrelocate --boot-image=/system/framework/boot.art --runtime-arg -Xms64m --runtime-arg -Xmx512m --instruction-set-variant=x86 --instruction-set-features=default --dex-file=/data/user/0/com.google.android.gms/app_fb/f.apk --oat-fd=44 --oat-location=/data/user/0/com.google.android.gms/app_fb/f.dex --compiler-filter=speed
08-22 13:50:03.195  3551  3551 I dex2oat : /system/bin/dex2oat --dex-file=/data/user/0/com.google.android.gms/app_fb/f.apk --oat-fd=44 --oat-location=/data/user/0/com.google.android.gms/app_fb/f.dex --compiler-filter=speed
08-22 13:50:03.232  3551  3551 I dex2oat : dex2oat took 36.457ms (threads: 2) arena alloc=323KB (331648B) java alloc=76KB (78168B) native alloc=966KB (989744B) free=2MB (2155984B)
08-22 13:50:03.234  2703  2839 W System  : ClassLoader referenced unknown path: 
08-22 13:50:03.253  2022  3550 I GoogleURLConnFactory: Using platform SSLCertificateSocketFactory
08-22 13:50:03.262  2022  3550 I GoogleURLConnFactory: Using platform SSLCertificateSocketFactory
08-22 13:50:03.387  2022  2716 W ConfigurationChimeraPro: Got null configs for com.google.android.gms.auth.account.base
08-22 13:50:03.415  2022  2716 W Conscrypt: Could not set socket write timeout:
08-22 13:50:03.416  2022  2716 W Conscrypt:    java.lang.reflect.Method.invoke(Native Method)
08-22 13:50:03.416  2022  2716 W Conscrypt:    com.google.android.gms.org.conscrypt.Platform.setSocketWriteTimeout(:com.google.android.gms@11743470:13)
08-22 13:50:03.552  2022  2716 W Conscrypt: Could not set socket write timeout:
08-22 13:50:03.552  2022  2716 W Conscrypt:    java.lang.reflect.Method.invoke(Native Method)
08-22 13:50:03.552  2022  2716 W Conscrypt:    com.google.android.gms.org.conscrypt.Platform.setSocketWriteTimeout(:com.google.android.gms@11743470:13)
08-22 13:50:03.678  2022  2716 W GLSUser : [AppCertManager] IOException while requesting key: 
08-22 13:50:03.678  2022  2716 W GLSUser : java.io.IOException: Invalid device key response.
08-22 13:50:03.678  2022  2716 W GLSUser :  at eyw.a(:com.google.android.gms@11743470:14)
08-22 13:50:03.678  2022  2716 W GLSUser :  at eyw.a(:com.google.android.gms@11743470:65)
08-22 13:50:03.678  2022  2716 W GLSUser :  at eyu.a(:com.google.android.gms@11743470:8)
08-22 13:50:03.678  2022  2716 W GLSUser :  at eyq.a(:com.google.android.gms@11743470:1)
08-22 13:50:03.678  2022  2716 W GLSUser :  at eyp.a(:com.google.android.gms@11743470:10)
08-22 13:50:03.678  2022  2716 W GLSUser :  at com.google.android.gms.auth.account.be.legacy.AuthCronChimeraService.b(:com.google.android.gms@11743470:7)
08-22 13:50:03.678  2022  2716 W GLSUser :  at edr.call(:com.google.android.gms@11743470:3)
08-22 13:50:03.678  2022  2716 W GLSUser :  at java.util.concurrent.FutureTask.run(FutureTask.java:237)
08-22 13:50:03.678  2022  2716 W GLSUser :  at mmu.run(:com.google.android.gms@11743470:26)
08-22 13:50:03.678  2022  2716 W GLSUser :  at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1133)
08-22 13:50:03.678  2022  2716 W GLSUser :  at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:607)
08-22 13:50:03.678  2022  2716 W GLSUser :  at mse.run(:com.google.android.gms@11743470)
08-22 13:50:03.678  2022  2716 W GLSUser :  at java.lang.Thread.run(Thread.java:761)
08-22 13:50:07.717  1603  1634 W ActivityManager: Unable to start service Intent { act=com.google.android.gms.drive.ApiService.RESET_AFTER_BOOT flg=0x4 cmp=com.google.android.gms/.drive.api.ApiService (has extras) } U=0: not found
emulator: Saving state on exit with session uptime 119964 ms

Update: config.ini

Here is my config.ini

PlayStore.enabled = false
abi.type = x86
avd.ini.encoding = UTF-8
hw.accelerometer = yes
hw.audioInput = yes
hw.battery = yes
hw.cpu.arch = x86
hw.dPad = no
hw.device.hash2 = MD5:fc85b2d34337b54227366eb43de4cfef
hw.device.manufacturer = Generic
hw.device.name = 5.4in FWVGA
hw.gps = yes
hw.lcd.density = 160
hw.lcd.height = 854
hw.lcd.width = 480
hw.mainKeys = yes
hw.sdCard = yes
hw.sensors.orientation = yes
hw.sensors.proximity = yes
hw.trackBall = no
image.sysdir.1 = system-images/android-24/google_apis_playstore/x86/
sdcard.size = 2048M
tag.display = Google Play
tag.id = google_apis_playstore
disk.dataPartition.size = 6442450944
hw.ramSize=3072

Update: Another crash log

This time it doesn't complain about a missing key.

08-28 09:48:58.109 12476 12476 W art     : Unexpected CPU variant for X86 using defaults: x86
08-28 09:48:58.114 12476 12476 D ICU     : No timezone override file found: /data/misc/zoneinfo/current/icu/icu_tzdata.dat
08-28 09:48:58.129 12476 12476 E memtrack: Couldn't load memtrack module (No such file or directory)
08-28 09:48:58.129 12476 12476 E android.os.Debug: failed to load memtrack module: -2
08-28 09:48:58.130 12476 12476 I Radio-JNI: register_android_hardware_Radio DONE
08-28 09:48:58.139 12476 12476 D AndroidRuntime: Calling main entry com.android.commands.settings.SettingsCmd
08-28 09:48:58.144 12476 12476 D AndroidRuntime: Shutting down VM
emulator: emulator_window_fb_update

emulator: emulator_window_fb_update

emulator: emulator_window_fb_update

emulator: emulator_window_fb_update

08-28 09:49:03.851  1602  2032 D AlarmManagerService: Kernel timezone updated to -600 minutes west of GMT
08-28 09:49:03.852  1602  2030 D AlarmManagerService: Setting time of day to sec=1566949744
08-28 09:49:04.002  1602  2030 W AlarmManagerService: Unable to set rtc to 1566949744: No such device
[ 8042.781849] healthd: battery l=100 v=0 t=0.0 h=2 st=2 chg=a
emulator: emulator_window_fb_update

emulator: emulator_window_fb_update

emulator: emulator_window_fb_update

emulator: emulator_window_fb_update

emulator: Saving state on exit with session uptime 73706 ms

Work around

Create an alias which restarts the emulator everytime it crashes.

alias tnsa="tns run android --device emulator-5554"   # Run in emulator
alias em="$ANDROID_HOME/emulator/emulator -avd samsung_galaxy_s8 -gpu guest -no-audio -verbose" 
alias eml="while true; do pkill -f android; sleep 2; tnsa &; em &> ~/emulator.log; done"

This is terrible, but what I'm currently working with.

like image 714
map7 Avatar asked Aug 04 '26 06:08

map7


2 Answers

The reason is you don't have enough disk space in your desktop where you have installed the studio with emulator.Try cleaning some space and rerun the device or it this doesn't help try creating a new emulator.hope it helps.

like image 122
karan sandhu Avatar answered Aug 06 '26 23:08

karan sandhu


Your Bios might disabled the virtualization, you can enable it manually getting into bios and turn it on, bios is different in almost each device. Also the problem might be storage problem, no space, file corrupted or storage restricted by some program. Usually it will be Bios problem.

like image 42
3Bady Avatar answered Aug 06 '26 23:08

3Bady



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!