• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Apps Android Studio 1.5.1 AVD Crash on Run ?

ac4android

Well-Known Member
Nov 3, 2015
198
29
Hi.

I am running Android Studio 1.5.1 in Windows 7 on a Dell i7 with 8 GB memory of which I have allocated 2 GB to Android, presumably its exclusive sandbox.

I've created a simple Gradle and downloaded several system images to test the various o/s versions.

I have created 2 Android Virtual Devices for :
Nexus 4 API 21 (arm)
Nexus 5 API 23 x86
The intention is to test the Java code using each of those environment.

Next I clicked Run -> Run 'app' -> checked launch emulator and selected Nexus 4 API 21 -> OK

Studio displayed the AVD and I can see various apps loading e.g. time, battery charging etc.

Then, after a few minutes, it crashed with a lot of messages saying "...too much work..."

Here is a sample from the console:
12-22 17:14:45.701 1099-1099/com.hfad.myfirstapp I/art: Not late-enabling -Xcheck:jni (already on)
12-22 17:14:47.925 1099-1106/com.hfad.myfirstapp W/art: Suspending all threads took: 265.654ms
12-22 17:14:50.938 1099-1111/com.hfad.myfirstapp I/art: Background sticky concurrent mark sweep GC freed 2743(244KB) AllocSpace objects, 0(0B) LOS objects, 29% free, 804KB/1135KB, paused 4.812ms total 359.103ms
12-22 17:14:51.150 1099-1126/com.hfad.myfirstapp D/OpenGLRenderer: Render dirty regions requested: true
12-22 17:14:51.247 1099-1099/com.hfad.myfirstapp D/Atlas: Validating map...
12-22 17:14:51.279 1099-1111/com.hfad.myfirstapp I/art: Background partial concurrent mark sweep GC freed 362(66KB) AllocSpace objects, 0(0B) LOS objects, 51% free, 949KB/1973KB, paused 1.251ms total 194.452ms
12-22 17:14:51.580 1099-1126/com.hfad.myfirstapp I/OpenGLRenderer: Initialized EGL, version 1.4
12-22 17:14:51.608 1099-1126/com.hfad.myfirstapp D/OpenGLRenderer: Enabling debug mode 0
12-22 17:14:51.734 1099-1126/com.hfad.myfirstapp W/EGL_emulation: eglSurfaceAttrib not implemented
12-22 17:14:51.734 1099-1126/com.hfad.myfirstapp W/OpenGLRenderer: Failed to set EGL_SWAP_BEHAVIOR on surface 0xaeee6f00, error=EGL_SUCCESS
12-22 17:14:52.009 1099-1099/com.hfad.myfirstapp I/Choreographer: Skipped 41 frames! The application may be doing too much work on its main thread.
12-22 17:14:52.976 1099-1099/com.hfad.myfirstapp I/Choreographer: Skipped 57 frames! The application may be doing too much work on its main thread.
12-22 17:16:23.477 1099-1099/com.hfad.myfirstapp I/Choreographer: Skipped 62 frames! The application may be doing too much work on its main thread.
12-22 17:16:23.773 1099-1126/com.hfad.myfirstapp W/EGL_emulation: eglSurfaceAttrib not implemented
12-22 17:16:23.773 1099-1126/com.hfad.myfirstapp W/OpenGLRenderer: Failed to set EGL_SWAP_BEHAVIOR on surface 0xaeee6f00, error=EGL_SUCCESS
12-22 17:16:24.169 1099-1099/com.hfad.myfirstapp I/Choreographer: Skipped 39 frames! The application may be doing too much work on its main thread.
12-22 17:16:25.184 1099-1099/com.hfad.myfirstapp I/Choreographer: Skipped 33 frames! The application may be doing too much work on its main thread.
12-22 17:20:06.481 1099-1106/com.hfad.myfirstapp W/art: Suspending all threads took: 10.226ms
12-22 17:21:25.135 1099-1106/com.hfad.myfirstapp W/art: Suspending all threads took: 7.085ms
12-22 17:25:30.072 1099-1106/com.hfad.myfirstapp W/art: Suspending all threads took: 10.219ms


What have I done wrong and how do I fix it?

Perhaps delete the other AVD, the Nexus 5 ?
 
No, I did not get that message "the application has unexpectedly stopped".
The odd part, the AVD starts up and is responsive.
Prior to throwing those error messages in logcat, it says:
DEVICE SHELL COMMAND: pm install -r "/data/local/tmp/com.hfad.myfirstapp"
pkg: /data/local/tmp/com.hfad.myfirstapp
Success
etc...

then the error messages, but why is the AVD working?

Code for MainActivity.java follows
Code:
package com.hfad.myfirstapp;

import android.os.Bundle;
import android.support.design.widget.FloatingActionButton;
import android.support.design.widget.Snackbar;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.view.View;
import android.view.Menu;
import android.view.MenuItem;

public class MainActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
        setSupportActionBar(toolbar);

        FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
        fab.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                Snackbar.make(view, "Replace with your own action", Snackbar.LENGTH_LONG)
                        .setAction("Action", null).show();
            }
        });
    }

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        // Inflate the menu; this adds items to the action bar if it is present.
        getMenuInflater().inflate(R.menu.menu_main, menu);
        return true;
    }

    @Override
    public boolean onOptionsItemSelected(MenuItem item) {
        // Handle action bar item clicks here. The action bar will
        // automatically handle clicks on the Home/Up button, so long
        // as you specify a parent activity in AndroidManifest.xml.
        int id = item.getItemId();

        //noinspection SimplifiableIfStatement
        if (id == R.id.action_settings) {
            return true;
        }

        return super.onOptionsItemSelected(item);
    }
}



Stacktrace from logcat follows
12-23 10:31:06.850 1069-1069/? I/art: Not late-enabling -Xcheck:jni (already on)
12-23 10:31:08.107 1069-1076/com.hfad.myfirstapp W/art: Suspending all threads took: 6.836ms
12-23 10:31:08.756 1069-1076/com.hfad.myfirstapp W/art: Suspending all threads took: 159.294ms
12-23 10:31:09.104 1069-1076/com.hfad.myfirstapp W/art: Suspending all threads took: 5.408ms
12-23 10:31:09.658 1069-1076/com.hfad.myfirstapp W/art: Suspending all threads took: 27.921ms
12-23 10:31:10.144 1069-1076/com.hfad.myfirstapp W/art: Suspending all threads took: 33.759ms
12-23 10:31:10.276 1069-1083/com.hfad.myfirstapp W/art: Suspending all threads took: 20.853ms
12-23 10:31:10.366 1069-1083/com.hfad.myfirstapp I/art: Background sticky concurrent mark sweep GC freed 2781(250KB) AllocSpace objects, 0(0B) LOS objects, 27% free, 824KB/1135KB, paused 39.844ms total 308.166ms
12-23 10:31:10.619 1069-1076/com.hfad.myfirstapp W/art: Suspending all threads took: 8.637ms
12-23 10:31:10.987 1069-1114/com.hfad.myfirstapp D/OpenGLRenderer: Render dirty regions requested: true
12-23 10:31:11.012 1069-1069/com.hfad.myfirstapp D/Atlas: Validating map...
12-23 10:31:11.154 1069-1083/com.hfad.myfirstapp I/art: Background partial concurrent mark sweep GC freed 361(62KB) AllocSpace objects, 0(0B) LOS objects, 51% free, 948KB/1972KB, paused 1.146ms total 177.115ms
12-23 10:31:11.718 1069-1076/com.hfad.myfirstapp W/art: Suspending all threads took: 108.523ms
12-23 10:31:11.974 1069-1114/com.hfad.myfirstapp I/OpenGLRenderer: Initialized EGL, version 1.4
12-23 10:31:12.020 1069-1114/com.hfad.myfirstapp D/OpenGLRenderer: Enabling debug mode 0
12-23 10:31:12.123 1069-1114/com.hfad.myfirstapp W/EGL_emulation: eglSurfaceAttrib not implemented
12-23 10:31:12.123 1069-1114/com.hfad.myfirstapp W/OpenGLRenderer: Failed to set EGL_SWAP_BEHAVIOR on surface 0xaeee8d20, error=EGL_SUCCESS
12-23 10:31:12.386 1069-1069/com.hfad.myfirstapp I/Choreographer: Skipped 74 frames! The application may be doing too much work on its main thread.
12-23 10:31:13.568 1069-1069/com.hfad.myfirstapp I/Choreographer: Skipped 69 frames! The application may be doing too much work on its main thread.
12-23 10:32:40.894 1069-1076/com.hfad.myfirstapp W/art: Suspending all threads took: 6.202ms
12-23 10:32:42.406 1069-1076/com.hfad.myfirstapp W/art: Suspending all threads took: 71.960ms
12-23 10:32:42.863 1069-1076/com.hfad.myfirstapp W/art: Suspending all threads took: 28.868ms
12-23 10:32:43.361 1069-1076/com.hfad.myfirstapp W/art: Suspending all threads took: 8.898ms
12-23 10:32:43.959 1069-1069/com.hfad.myfirstapp I/Choreographer: Skipped 166 frames! The application may be doing too much work on its main thread.
12-23 10:32:44.739 1069-1114/com.hfad.myfirstapp W/EGL_emulation: eglSurfaceAttrib not implemented
12-23 10:32:44.740 1069-1114/com.hfad.myfirstapp W/OpenGLRenderer: Failed to set EGL_SWAP_BEHAVIOR on surface 0xaeee8d20, error=EGL_SUCCESS
12-23 10:32:45.143 1069-1069/com.hfad.myfirstapp I/Choreographer: Skipped 69 frames! The application may be doing too much work on its main thread.
12-23 10:32:45.346 1069-1076/com.hfad.myfirstapp W/art: Suspending all threads took: 6.952ms
12-23 10:32:46.300 1069-1069/com.hfad.myfirstapp I/Choreographer: Skipped 33 frames! The application may be doing too much work on its main thread.
 
Upvote 0
Do you get a pop-up with a message "the application has unexpectedly stopped"?

Is there a stack trace message in your logcat view?


I managed to capture the first part of the logcat msg, the AVD works fine after that.

I am beginning to think it is just some idiosyncratic Studio behaviour

Device connected: emulator-5554
Device is ready: Nexus_4_API_21 [emulator-5554]
Target device: Nexus_4_API_21 [emulator-5554]
Installing APK: C:\Users\ARTHUR\AndroidStudioProjects\MyFirstApp\app\build\outputs\apk\app-debug.apk
Uploading file to: /data/local/tmp/com.hfad.myfirstapp
Installing com.hfad.myfirstapp
DEVICE SHELL COMMAND: pm install -r "/data/local/tmp/com.hfad.myfirstapp"
pkg: /data/local/tmp/com.hfad.myfirstapp
Success


Launching application: com.hfad.myfirstapp/com.hfad.myfirstapp.MainActivity.
DEVICE SHELL COMMAND: am start -n "com.hfad.myfirstapp/com.hfad.myfirstapp.MainActivity" -a android.intent.action.MAIN -c android.intent.category.LAUNCHER
 
Upvote 0

BEST TECH IN 2023

We've been tracking upcoming products and ranking the best tech since 2007. Thanks for trusting our opinion: we get rewarded through affiliate links that earn us a commission and we invite you to learn more about us.

Smartphones