1

Здравствуйте!

При запуске на выполнение программы в среде Android Studio 1.0 при помощи эмулятора программа не выводится на экран эмулятора.

Файл MainActivity.java самый простой, впервые созданный программой автоматически, как новый проект.

Пробовал создавать различные AVD с различными параметрами, не помогает.

Пробовал ставить отладочный вывод в окно LogCat.

Подскажите, в чем причина?

У меня на ПК оперативная память 2 Гб. Может, недостаточно оперативной памяти?

Ниже привожу содержимое файла AndroidManifest.xml, MainActivity.java и окон IDE Android Studio LogCat, Console, Grade Console.


Содержимое файла AndroidManifest.xml


<?xml version="1.0" encoding="utf-8"?>

<manifest xmlns:android="http://schemas.android.com/apk/res/android"

package="ru.mbn.hellokitty" >

<application

    android:allowBackup="true"

    android:icon="@drawable/ic_launcher"

    android:label="@string/app_name"

    android:theme="@style/AppTheme" >
    <activity
        android:name=".MainActivity"

        android:label="@string/app_name" >

        <intent-filter>

            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.LAUNCHER" />

        </intent-filter>

    </activity>

</application>

</manifest>


Содержимое файла MainActivity.java


package ru.mbn.hellokitty;

import android.support.v7.app.ActionBarActivity;
import android.os.Bundle;
import android.util.Log;
import android.view.Menu;
import android.view.MenuItem;

import static android.util.Log.*;

public class MainActivity extends ActionBarActivity {

@Override
protected void onCreate(Bundle savedInstanceState) {

    // Конструктор родительского класса
    super.onCreate(savedInstanceState);

    // Вывод отладочного сообщения
    Log.d("Hello Kitty", "Call onCreate() method for super class");

    setContentView(R.layout.activity_main);

    // Вывод отладочного сообщения
    Log.d("Hello Kitty", "Finished create user interface");
}

@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);

    // Вывод отладочного сообщения
    Log.d("Hello Kitty", "Finished create 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();

    // Вывод отладочного сообщения
    Log.d("Hello Kitty", "Method onOptionsItemSelected()");

    //noinspection SimplifiableIfStatement
    if (id == R.id.action_settings) {

        // Вывод отладочного сообщения
        Log.d("Hello Kitty", "onOptionsItemSelected() return true");

        return true;
    }

    // Вывод отладочного сообщения
    Log.d("Hello Kitty", "onOptionsItemSelected() return super");

    return super.onOptionsItemSelected(item);
}
}

Содержимое окна LogCat


12-12 12:08:16.792
1208-1208/ru.mbn.hellokitty I/art﹕ Not late-enabling -Xcheck:jni (already on) 12-12 12:08:17.557
1208-1208/ru.mbn.hellokitty W/Zygote﹕ Slow operation: 1367ms so far, now at Zygote.nativeForkAndSpecialize 12-12 12:08:17.653
1208-1208/ru.mbn.hellokitty W/Zygote﹕ Slow operation: 1464ms so far, now at Zygote.postForkCommon 12-12 12:08:17.654
1208-1208/ru.mbn.hellokitty W/Zygote﹕ Slow operation: 1472ms so far, now at zygoteConnection.runOnce: postForkAndSpecialize 12-12 12:08:19.370
1208-1215/ru.mbn.hellokitty W/art﹕ Suspending all threads took: 56.555ms 12-12 12:08:19.854
1208-1208/ru.mbn.hellokitty W/ActivityThread﹕ Application ru.mbn.hellokitty is waiting for the debugger on port 8100... 12-12 12:08:19.970
1208-1208/ru.mbn.hellokitty I/System.out﹕ Sending WAIT chunk 12-12 12:08:20.081
1208-1215/ru.mbn.hellokitty I/art﹕ Debugger is active 12-12 12:08:20.182 1208-1208/ru.mbn.hellokitty I/System.out﹕ Debugger has connected 12-12 12:08:20.183
1208-1208/ru.mbn.hellokitty I/System.out﹕ waiting for debugger to settle... 12-12 12:08:20.440
1208-1208/ru.mbn.hellokitty I/System.out﹕ waiting for debugger to settle... 12-12 12:08:20.664
1208-1208/ru.mbn.hellokitty I/System.out﹕ waiting for debugger to settle... 12-12 12:08:20.869
1208-1208/ru.mbn.hellokitty I/System.out﹕ waiting for debugger to settle... 12-12 12:08:21.073
1208-1208/ru.mbn.hellokitty I/System.out﹕ waiting for debugger to settle... 12-12 12:08:21.275
1208-1208/ru.mbn.hellokitty I/System.out﹕ waiting for debugger to settle... 12-12 12:08:21.504
1208-1208/ru.mbn.hellokitty I/System.out﹕ waiting for debugger to settle... 12-12 12:08:21.722
1208-1208/ru.mbn.hellokitty I/System.out﹕ waiting for debugger to settle... 12-12 12:08:21.932
1208-1208/ru.mbn.hellokitty I/System.out﹕ waiting for debugger to settle... 12-12 12:08:22.134
1208-1208/ru.mbn.hellokitty I/System.out﹕ waiting for debugger to settle... 12-12 12:08:22.341
1208-1208/ru.mbn.hellokitty I/System.out﹕ waiting for debugger to settle... 12-12 12:08:22.577
1208-1208/ru.mbn.hellokitty I/System.out﹕ waiting for debugger to settle... 12-12 12:08:22.799
1208-1208/ru.mbn.hellokitty I/System.out﹕ waiting for debugger to settle... 12-12 12:08:23.100
1208-1208/ru.mbn.hellokitty I/System.out﹕ waiting for debugger to settle... 12-12 12:08:23.339
1208-1208/ru.mbn.hellokitty I/System.out﹕ waiting for debugger to settle... 12-12 12:08:23.549
1208-1208/ru.mbn.hellokitty I/System.out﹕ waiting for debugger to settle... 12-12 12:08:23.771
1208-1208/ru.mbn.hellokitty I/System.out﹕ waiting for debugger to settle... 12-12 12:08:23.982
1208-1208/ru.mbn.hellokitty I/System.out﹕ waiting for debugger to settle... 12-12 12:08:24.184
1208-1208/ru.mbn.hellokitty I/System.out﹕ waiting for debugger to settle... 12-12 12:08:24.385
1208-1208/ru.mbn.hellokitty I/System.out﹕ waiting for debugger to settle... 12-12 12:08:24.599
1208-1208/ru.mbn.hellokitty I/System.out﹕ waiting for debugger to settle... 12-12 12:08:24.802
1208-1208/ru.mbn.hellokitty I/System.out﹕ waiting for debugger to settle... 12-12 12:08:25.019
1208-1208/ru.mbn.hellokitty I/System.out﹕ waiting for debugger to settle... 12-12 12:08:25.230
1208-1208/ru.mbn.hellokitty I/System.out﹕ waiting for debugger to settle... 12-12 12:08:25.450
1208-1208/ru.mbn.hellokitty I/System.out﹕ waiting for debugger to settle... 12-12 12:08:25.659
1208-1208/ru.mbn.hellokitty I/System.out﹕ waiting for debugger to settle... 12-12 12:08:25.879
1208-1208/ru.mbn.hellokitty I/System.out﹕ waiting for debugger to settle... 12-12 12:08:26.082
1208-1208/ru.mbn.hellokitty I/System.out﹕ waiting for debugger to settle... 12-12 12:08:26.350
1208-1208/ru.mbn.hellokitty I/System.out﹕ waiting for debugger to settle... 12-12 12:08:26.559
1208-1208/ru.mbn.hellokitty I/System.out﹕ waiting for debugger to settle... 12-12 12:08:26.760
1208-1208/ru.mbn.hellokitty I/System.out﹕ waiting for debugger to settle... 12-12 12:08:26.962
1208-1208/ru.mbn.hellokitty I/System.out﹕ waiting for debugger to settle... 12-12 12:08:27.245
1208-1208/ru.mbn.hellokitty I/System.out﹕ waiting for debugger to settle... 12-12 12:08:27.463
1208-1208/ru.mbn.hellokitty I/System.out﹕ waiting for debugger to settle... 12-12 12:08:27.665
1208-1208/ru.mbn.hellokitty I/System.out﹕ waiting for debugger to settle... 12-12 12:08:27.867
1208-1208/ru.mbn.hellokitty I/System.out﹕ waiting for debugger to settle... 12-12 12:08:28.069
1208-1208/ru.mbn.hellokitty I/System.out﹕ waiting for debugger to settle... 12-12 12:08:28.271
1208-1208/ru.mbn.hellokitty I/System.out﹕ waiting for debugger to settle... 12-12 12:08:28.473
1208-1208/ru.mbn.hellokitty I/System.out﹕ waiting for debugger to settle... 12-12 12:08:28.676
1208-1208/ru.mbn.hellokitty I/System.out﹕ waiting for debugger to settle... 12-12 12:08:28.883
1208-1208/ru.mbn.hellokitty I/System.out﹕ waiting for debugger to settle... 12-12 12:08:29.087
1208-1208/ru.mbn.hellokitty I/System.out﹕ waiting for debugger to settle... 12-12 12:08:29.306
1208-1208/ru.mbn.hellokitty I/System.out﹕ debugger has settled (1477) 12-12 12:08:29.917
1208-1215/ru.mbn.hellokitty W/art﹕ Suspending all threads took: 101.511ms 12-12 12:08:30.874
1208-1215/ru.mbn.hellokitty W/art﹕ Suspending all threads took: 54.176ms 12-12 12:08:31.332
1208-1215/ru.mbn.hellokitty W/art﹕ Suspending all threads took: 14.171ms 12-12 12:08:31.428
1208-1208/ru.mbn.hellokitty D/Hello Kitty﹕ Call onCreate() method for super class 12-12 12:08:31.840
1208-1220/ru.mbn.hellokitty I/art﹕ Background sticky concurrent mark sweep GC freed 1929(131KB) AllocSpace objects, 0(0B) LOS objects, 29% free, 438KB/623KB, paused 3.919ms total 701.447ms 12-12 12:08:31.862 1208-1220/ru.mbn.hellokitty W/art﹕ Suspending all threads took: 19.576ms 12-12 12:08:32.415
1208-1215/ru.mbn.hellokitty W/art﹕ Suspending all threads took: 90.144ms 12-12 12:08:32.943
1208-1215/ru.mbn.hellokitty W/art﹕ Suspending all threads took: 100.868ms 12-12 12:08:33.835
1208-1215/ru.mbn.hellokitty W/art﹕ Suspending all threads took: 460.711ms 12-12 12:08:33.884
1208-1220/ru.mbn.hellokitty I/art﹕ Background partial concurrent mark sweep GC freed 146(51KB) AllocSpace objects, 0(0B) LOS objects, 51% free, 476KB/988KB, paused 6.787ms total 899.954ms 12-12 12:08:33.921 1208-1220/ru.mbn.hellokitty W/art﹕ Suspending all threads took: 36.816ms 12-12 12:08:34.452
1208-1215/ru.mbn.hellokitty W/art﹕ Suspending all threads took: 117.232ms 12-12 12:08:35.326
1208-1208/ru.mbn.hellokitty D/Hello Kitty﹕ Finished create user interface 12-12 12:08:35.871
1208-1208/ru.mbn.hellokitty I/Choreographer﹕ Skipped 115 frames! The application may be doing too much work on its main thread. 12-12 12:08:36.886
1208-1215/ru.mbn.hellokitty W/art﹕ Suspending all threads took: 36.876ms 12-12 12:08:37.452
1208-1220/ru.mbn.hellokitty I/art﹕ Background sticky concurrent mark sweep GC freed 1214(116KB) AllocSpace objects, 0(0B) LOS objects, 23% free, 759KB/988KB, paused 2.247ms total 278.011ms 12-12 12:08:37.461 1208-1220/ru.mbn.hellokitty W/art﹕ Suspending all threads took: 7.470ms 12-12 12:08:37.613
1208-1208/ru.mbn.hellokitty D/Hello Kitty﹕ Finished create menu 12-12 12:08:37.847
1208-1208/ru.mbn.hellokitty I/Choreographer﹕ Skipped 1759 frames! The application may be doing too much work on its main thread. 12-12 12:08:37.886
1208-1215/ru.mbn.hellokitty W/art﹕ Suspending all threads took: 19.996ms 12-12 12:08:38.188
1208-1208/ru.mbn.hellokitty D/gralloc_goldfish﹕ Emulator without GPU emulation detected. 12-12 12:08:38.582
1208-1208/ru.mbn.hellokitty I/Choreographer﹕ Skipped 158 frames! The application may be doing too much work on its main thread. 12-12 12:09:13.714
1208-1208/ru.mbn.hellokitty D/Hello Kitty﹕ Call onCreate() method for super class 12-12 12:09:13.900
1208-1220/ru.mbn.hellokitty W/art﹕ Suspending all threads took: 10.581ms 12-12 12:09:13.933
1208-1220/ru.mbn.hellokitty I/art﹕ Background sticky concurrent mark sweep GC freed 627(27KB) AllocSpace objects, 0(0B) LOS objects, 14% free, 849KB/988KB, paused 14.009ms total 122.612ms 12-12 12:09:13.999 1208-1215/ru.mbn.hellokitty W/art﹕ Suspending all threads took: 11.857ms 12-12 12:09:14.041
1208-1208/ru.mbn.hellokitty D/Hello Kitty﹕ Finished create user interface 12-12 12:09:14.389
1208-1208/ru.mbn.hellokitty I/Choreographer﹕ Skipped 12803 frames! The application may be doing too much work on its main thread. 12-12 12:09:14.645
1208-1215/ru.mbn.hellokitty W/art﹕ Suspending all threads took: 153.416ms 12-12 12:09:14.868
1208-1220/ru.mbn.hellokitty I/art﹕ Background partial concurrent mark sweep GC freed 221(22KB) AllocSpace objects, 0(0B) LOS objects, 37% free, 843KB/1355KB, paused 1.901ms total 463.659ms 12-12 12:09:15.012 1208-1208/ru.mbn.hellokitty D/Hello Kitty﹕ Finished create menu 12-12 12:09:15.017
1208-1208/ru.mbn.hellokitty I/Choreographer﹕ Skipped 225 frames! The application may be doing too much work on its main thread. 12-12 12:09:15.290
1208-1208/ru.mbn.hellokitty I/Choreographer﹕ Skipped 124 frames! The application may be doing too much work on its main thread. 12-12 12:09:23.098
1208-1215/ru.mbn.hellokitty W/art﹕ Suspending all threads took: 90.729ms 12-12 12:09:56.649
1208-1215/ru.mbn.hellokitty W/art﹕ Suspending all threads took: 10.560ms 12-12 12:09:58.248
1208-1215/ru.mbn.hellokitty W/art﹕ Suspending all threads took: 15.606ms 12-12 12:10:09.318
1208-1215/ru.mbn.hellokitty W/art﹕ Suspending all threads took: 9.810ms 12-12 12:10:17.238
1208-1215/ru.mbn.hellokitty W/art﹕ Suspending all threads took: 60.784ms 12-12 12:11:12.485
1208-1215/ru.mbn.hellokitty W/art﹕ Suspending all threads took: 67.197ms


Содержимое окна Console


Waiting for device. C:\Users\user\AppData\Local\Android\sdk\tools\emulator.exe -avd 2_7_QVGA_API_21_5_0_1_arm -netspeed full -netdelay none Device connected: emulator-5554 Device 2_7_QVGA_API_21_5_0_1_arm [emulator-5554] is online, waiting for processes to start up.. Device 2_7_QVGA_API_21_5_0_1_arm [emulator-5554] is online, waiting for processes to start up.. Device 2_7_QVGA_API_21_5_0_1_arm [emulator-5554] is online, waiting for processes to start up.. Device is ready: 2_7_QVGA_API_21_5_0_1_arm [emulator-5554] Target device: 2_7_QVGA_API_21_5_0_1_arm [emulator-5554] Uploading file local path: C:\Users\user\AndroidStudioProjects\HelloKitty\app\build\outputs\apk\app-debug.apk remote path: /data/local/tmp/ru.mbn.hellokitty Installing ru.mbn.hellokitty DEVICE SHELL COMMAND: pm install -r "/data/local/tmp/ru.mbn.hellokitty" pkg: /data/local/tmp/ru.mbn.hellokitty Success

Launching application: ru.mbn.hellokitty/ru.mbn.hellokitty.MainActivity. DEVICE SHELL COMMAND: am start -D -n "ru.mbn.hellokitty/ru.mbn.hellokitty.MainActivity" -a android.intent.action.MAIN -c android.intent.category.LAUNCHER Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] cmp=ru.mbn.hellokitty/.MainActivity }

Waiting for process: ru.mbn.hellokitty Connected to the target VM, address: 'localhost:8621', transport: 'socket' Disconnected from the target VM, address: 'localhost:8621', transport: 'socket'


Содержимое окна Grade Console


Executing tasks: [:app:assembleDebug]

Configuration on demand is an incubating feature. :app:preBuild :app:compileDebugNdk UP-TO-DATE :app:preDebugBuild :app:checkDebugManifest :app:preReleaseBuild :app:prepareComAndroidSupportAppcompatV72102Library UP-TO-DATE :app:prepareComAndroidSupportSupportV42102Library UP-TO-DATE :app:prepareDebugDependencies :app:compileDebugAidl UP-TO-DATE :app:compileDebugRenderscript UP-TO-DATE :app:generateDebugBuildConfig UP-TO-DATE :app:generateDebugAssets UP-TO-DATE :app:mergeDebugAssets UP-TO-DATE :app:generateDebugResValues UP-TO-DATE :app:generateDebugResources UP-TO-DATE :app:mergeDebugResources UP-TO-DATE :app:processDebugManifest UP-TO-DATE :app:processDebugResources UP-TO-DATE :app:generateDebugSources UP-TO-DATE :app:compileDebugJava UP-TO-DATE :app:preDexDebug UP-TO-DATE :app:dexDebug UP-TO-DATE :app:processDebugJavaRes UP-TO-DATE :app:validateDebugSigning :app:packageDebug UP-TO-DATE :app:zipalignDebug UP-TO-DATE :app:assembleDebug UP-TO-DATE

BUILD SUCCESSFUL

Total time: 22.603 secs

1
  • У меня тоже такая проблема тут проблема не в оперативке.У меня 6 ГБ оперативки все запустится всё в норме но только проект который я создаль в эмуляторе не показывается.Тут проблема в чем то другом.В каких то настройках!
    – Umar
    18 ноя 2017 в 18:17

3 ответа 3

2

Во-первых, не нужно сюда выкидывать простыню логов из LogCat`а - отфильтруйте ее либо вручную, либо по RegExp.

Android Studio является очень "жирной" IDE, в которой совмещаются много тулз, поэтому в оперативной памяти она занимает, в среднем, 1гб места. Делайте выводы насчет своих 2 гб ОЗУ.

Эмулятор может не работать по нескольким причинам: либо вы просто выкачали не все, что для его работы необходимо (из SDK Manager`а), либо же неправильно настроили. В таком случае, разумеется, на эмуляторе Android не запустится (хотя сам эмулятор запустится).


UPD

Судя по вашим логам, приложение успешно скомпилировалось и подготовлено к запуску на устройстве. Покажите свой файл манифеста приложения и убедитесь, что в настройках проекта стоит запуск НУЖНОЙ активности после сборки приложения на устройстве.

Об успешной компиляции говорит вам система Gradle:

BUILD SUCCESSFUL
Total time: 22.603 secs

А о запуске - компилятор:

Launching application: ru.mbn.hellokitty/ru.mbn.hellokitty.MainActivity. 
DEVICE SHELL COMMAND: am start -D -n "ru.mbn.hellokitty/ru.mbn.hellokitty.MainActivity"
2
  • Да там, похоже, приложение стартует. Вот только памяти под эмулятор катастрофически не хватает. Вот оно и свопиться активно. А это накладывает свой отпечаток на скорость работы.
    – KoVadim
    12 дек 2014 в 15:04
  • Действительно, если ОЗУ чересчур мало, то время будет такое, как в логах выше. Но, так или иначе, в конце концов приложение должно будет скомпилироваться и запуститься на виртуальном устройстве. Когда системе не хватает ОЗУ, задействовывается файл подкачки с жесткого диска - это в разы медленнее, но зато система не "умирает".
    – AseN
    12 дек 2014 в 15:07
1

Я бы тебе посоветовал использовать Genymotion, продукт бесплатный, качай с офф сайта, забудешь о проблемах с эмуляторами!

0

Согласен с @0xFFh.

Приложение компилируется нормально.
Studio в целом требует много ресурсов. У меня 4Гб оперативной памяти, и то испытываю дискомфорт от долгой загрузки эмулятора и компиляции проекта.

Предлагаю:

  1. Закрыть все посторонние программы и попробовать подождать минут 10-15. Чем меньше свободных ресурсов у вашего компьютера, тем медленнее "ворочается" Studio.
  2. Проверить настройки Android Studio и эмулятора. Вот отличная инструкция по настройке, лично мне помогла.

Ваш ответ

Нажимая на кнопку «Отправить ответ», вы соглашаетесь с нашими пользовательским соглашением, политикой конфиденциальности и политикой о куки

Всё ещё ищете ответ? Посмотрите другие вопросы с метками или задайте свой вопрос.