6

I develop mostly for iPhone and have started very recently with Android.

Tried the hello world, but when hit run the emulator just shows a black screen with an Android logo shining.

package com.hyper.tuti;

import android.app.Activity;
import android.os.Bundle;
import android.widget.TextView;

public class TutiActivity extends Activity {
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        // setContentView(R.layout.main);
        TextView tv = new TextView(this);
        tv.setText("Hello, Android");
        setContentView(tv);
    }
}

why is my simulator not working??

Philipp Reichart
  • 20,771
  • 6
  • 58
  • 65
manuelBetancurt
  • 15,428
  • 33
  • 118
  • 216
  • possible duplicate of [Speed up Android emulator](http://stackoverflow.com/questions/2975469/speed-up-android-emulator) – richq Sep 30 '11 at 16:09
  • 1
    Also note that Android/ADB uses an **emulator** (i.e. basically a virtual ARM CPU running on QEMU with everything behaving like a real device, just slower), while iOS/XCode uses a **simulator** (code running natively on your shiny quad-core 64-bit CPU, much faster than an actual device). Don't mix them up :) – Philipp Reichart Sep 30 '11 at 16:18

3 Answers3

14

Yeah I've had emulator boot times of 5-10 minutes initially.

Hint

When you edit your AVD, there is an option to take a snapshot. What this does is when you close your AVD, it takes a snapshot and opens that next time, bypassing boot.

Edit 1/9/2014

I have recently gotten back into Android development, and I now use Genymotion to run my emulators. It is based off of VirtualBox - it runs incredibly fast. I have not tried the Android Emulator in years so I cannot say whether or not it is any faster. I know my emulators start up almost instantly now and are not slow and buggy like before.

Jack
  • 9,156
  • 4
  • 50
  • 75
2

give it time... it takes a WHILE to boot up! (seriously)

Yevgeny Simkin
  • 27,946
  • 39
  • 137
  • 236
  • I'm pretty sure that without layoutParams the app will just crash... but maybe something has changed of late? – Yevgeny Simkin Sep 30 '11 at 16:06
  • @Dr.Dredel I'm pretty sure I'm just running the exact code from the question in an emulator, [from the docs](http://developer.android.com/reference/android/app/Activity.html#setContentView(android.view.View)): "When calling this method, the layout parameters of the specified view are ignored. Both the width and the height of the view are set by default to MATCH_PARENT" :) – Philipp Reichart Sep 30 '11 at 16:08
  • Weird... I distinctly recall my apps crashing when I omit explicitly specifying the width and height (either in xml or in code). Guess I'm wrong... I'll edit my answer. – Yevgeny Simkin Sep 30 '11 at 16:27
1

Haha I had the same problem first time I used the emulator too. But yes it just takes alot of time to boot it up, especially if you're booting it up for Android 3.0+ Honeycomb(platform 11+) wich in effect is the tablet platform.

Use Android 2.3 Gingerbread or Android 2.2 Froyo if you want your emulator to look like an android phone.

Configure your AVD settings to use platform version 10 or 8.

telamon
  • 415
  • 1
  • 6
  • 6