I'm following the Android App HelloAndroid tutorial on http://developer.android.com/resources/tutorials/hello-world.html and I seem to be doing well so far. I got the SDK downloaded and installed, emulator works... I am using Android 2.2
开发者_运维知识库it works.. but I do not see the text string... This is my first android app so I am doing something wrong.
Yeah, getting Eclipse to talk to the Emulator can be a PITA. If you can debug on an actual device, don’t waste your time with the emulator.
You can look in Eclipse’s console window to see what’s up. Chances are it has installed the package, but it never got around to launching the application. Press the debug button again to see if it works, or just launch the app from the home screen manually. Unfortunately this won’t connect the debugger, but at least you can use it.
I’ve struggled with this a few times and can’t come up with anything more conclusive than “delete your emulator image and try again” or “restart Eclipse to see if it works this time”.
try the following:
unlock the emulator. if do not show text. restart the emulator or try the code
TextView tv = (TextView)findViewById(R.id.textview1);
tv.setText("first app");
....
Based on your screenshot it looks like an error occured while installing the app, you could try to install the app via adb. It's in ANDROID_SDK_FOLDER/platform-tools/ in the current sdk or in ANDROID_SDK_FOLDER/tools on the old version, where ANDROID_SDK_FOLDER is the folder where you placed your sdk. With the emulator open, use:
adb install path_to_the_apk_folder/HelloAndroid.apk
You can usually find your apk on the bin folder of your project.
Even if it doesn't work adb can give you more information about how to handle the problem.
You could also take a look at the troubleshooting tips on developer.android.com. http://developer.android.com/resources/faq/troubleshooting.html#eclipse and http://developer.android.com/resources/faq/troubleshooting.html#noapp might be relevant.
精彩评论