question about debug on Eclispe

Common bugs/problems with the Android SDK the Emulator and the ADT-Plugin.

Re: question about debug on Eclispe

Postby huascar82 » Thu Apr 14, 2011 1:58 am

FC stands for "Force Close", the window you see in either an android phone or the emulator that indicates the app has/is about to crash. During debug this would usually come up after a couple of times of clicking on resume once your project drops into an error. Switch to DDMS perspective so you can see the logcat, click Force Close in your Emulator to force the debugging app to close, and you'll see a few red lines shoot from the bottom of your logcat pane. This stack of errors will be from your project. Usually towards the top of the stack you'll see 1 or 2 lines that relate directly to your code and not just android's code. This is the dump I get when I run your code. If you notice the second line says something about "ClassCastException" and points at an android.widget.textview in the testerror.errordebug class. While down further on the stack towards the end it says "Caused by" and again points to the ClassCastException. One line actually points you to the java file that caused the error and the line number.
com.test.testerror.errordebug.onCreate( In my test that's actually the line that created the b Button object, it doesn't even get to the ispressed code.

It may not show it to you as easily or as clearly as either of us is used to but I guess you have to get yourself used to doing things different in different enviornments.

    java.lang.RuntimeException: Unable to start activity ComponentInfo{com.test.testerror/com.test.testerror.errordebug}: java.lang.ClassCastException: android.widget.TextView
    at $1500(
    at android.os.Handler.dispatchMessage(
    at android.os.Looper.loop(
    at java.lang.reflect.Method.invokeNative(Native Method)
    at java.lang.reflect.Method.invoke(
    at dalvik.system.NativeStart.main(Native Method)
    Caused by: java.lang.ClassCastException: android.widget.TextView
    at com.test.testerror.errordebug.onCreate(

As for using the try catch block, this was the code I used. Instead dropping out of normal run mode and forcing you to click resume thru the "source not found" thing, it just skips it but prints to logcat in an orange looking text. The top 2 lines in the stack point you to the line in your code that caused the exception.

java.lang.ClassCastException: android.widget.TextView
at com.test.testerror.errordebug.onCreate(

Code: Select all
try {
        Button b = (Button) findViewById(;
    catch (Exception e){
Posts: 6
Joined: Tue Apr 12, 2011 10:02 pm


Return to SDK/ADT/Emulator Problems

Who is online

Users browsing this forum: No registered users and 10 guests