开发者

My Emulator will not "load" the Hello World tutorial program properly

I am a total beginner with Android. I followed the instructions on the Android Developer site for loading all of the necessary software. However, I tried the Hello World Tutorial and I cannot get the code to install on the emulator properly. I am using Eclipse SDK ver. 3.6.2. and running the code with Android 3.1 API 12 emulator. The emulator does not crash and as you will be able to see from the sample from my Eclipse console window output below, I have waited a sufficient amount of time for the Emulator to start. Here is my source code

package com.example.helloandroid;  

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

public class HelloAndroid extends Activity {  
    /** Called when the activity is first created. */  
    @Override  
    public void onCreate(Bundle savedInstanceState) {  
        super.开发者_高级运维onCreate(savedInstanceState);  
        TextView tv = new TextView(this);  
        tv.setText("Hello, Android");  
        setContentView(tv);  
    }  
}  

Here is the Eclipse console output:

[2011-05-13 20:12:53 - HelloAndroid] ------------------------------  
[2011-05-13 20:12:53 - HelloAndroid] Android Launch!  
[2011-05-13 20:12:53 - HelloAndroid] adb is running normally.  
[2011-05-13 20:12:54 - HelloAndroid] Performing com.example.helloandroid.HelloAndroid   activity launch  
[2011-05-13 20:12:54 - HelloAndroid] Automatic Target Mode: launching new emulator with compatible AVD 'Android-3-1'  
[2011-05-13 20:12:54 - HelloAndroid] Launching a new emulator with Virtual Device 'Android  -3-1'  
[2011-05-13 20:13:14 - HelloAndroid] New emulator found: emulator-5554  
[2011-05-13 20:13:14 - HelloAndroid] Waiting for HOME ('android.process.acore') to be   launched...  
**Two lines below are in red**  
[2011-05-13 20:18:01 - HelloAndroid] WARNING: Application does not specify an API level   requirement!  
[2011-05-13 20:18:01 - HelloAndroid] Device API version is 12 (Android 3.1)  
[2011-05-13 20:18:01 - HelloAndroid] HOME is up on device 'emulator-5554'  
[2011-05-13 20:18:01 - HelloAndroid] Uploading HelloAndroid.apk onto device 'emulator-5554'  
[2011-05-13 20:18:01 - HelloAndroid] Installing HelloAndroid.apk...  
**Below appears in red**  
[2011-05-13 20:21:23 - HelloAndroid] Failed to install HelloAndroid.apk on device 'emulator-5554!  
[2011-05-13 20:21:23 - HelloAndroid] (null)  
[2011-05-13 20:21:28 - HelloAndroid] Launch canceled!  

Any help is greatly appreciated. I can't really start learning how to make Android programs until I get this issue resolved.c

Thanks!


Eclipse 3.6 and Android 3.1 API 12 works fine. However, please make the following change. In Eclipse, Window > Preferences > Android > DDMS > ADB Connection Timeout - Change this from 5000 to a higher value - say 20000. Close Eclipse and open up again and run. You should get past the "Launch Failed" issue. Next, if you get past this and then you get a message saying, "Success....ActivityManager: Starting: Intent { act=android.intent.action.MAIN cat=....", but on the emulator screen you just see a lock icon, please understand that the emulator is similar to the phone. Drag the lock (to unlock your simulated phone) and then you should be able to see your "Hello Android" message.


It wont work for revision 11 and revison 12 i think maybe going to revison 10 platform may help


I was also encountered error when followed instructions, so i ran "adb logcat" which showed that it is not able to find the class.

In the instructions(tutorial) - : It has been said that during (create new project or class)application name as Hello World and activity name became HelloWorldActivity.

So if you maintain both CreateActivity name and application name both same, then it might work.

I have increased the AVD RAM size to 1024 and VM application to 36 0r 48 or 24.


Your emulator does not appear to be fully loaded. According to that stack trace when your hello world project tries to access the emulator the object it expects to find is (null).

On a separate issue I would use API 8 for phone dev. (2.2 or 2.3).

thenewboston.com has a good set of tutorials for setting up your android development environment.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜