Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 678757
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T01:11:05+00:00 2026-05-14T01:11:05+00:00

I’ve just started debugging my first three line long android app and I can’t

  • 0

I’ve just started debugging my first three line long android app and I can’t seem to use the debug tool like I want to.
Here’s my code:

public void onCreate(Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);
  setContentView(R.layout.main);
  int a = 1 / 0;
}

Now I expect the debugger to halt the thread and show me the line number of statement where the division by zero occurs. No, instead it shows some other method internal to the system for which I have no source. To make the matters worse, there is no exception message either.

Prior to this app, I created one which would do something when a button was pressed. If any exception was raised, again no useful line number or exception message would be shown.

As of right now, there is no way to debug my app. Any ideas?

I’m using the latest SDK along with Eclipse ADT plugin and debugging on a real device (Nexus One).

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T01:11:06+00:00Added an answer on May 14, 2026 at 1:11 am

    At first I have to admit that you are partially right. There are debuggers that will stop the execution at a exception and show your code line that caused it. I would love to see this behavior in the eclipse debugger. But the other answers are right.

    While you are in Eclipse go to Window -> Show View -> Other -> Android -> LogCat
    Now you will get all the debugging output that occurs on the emulator or a connected device.
    With you example I will get the following StackTrace.

    T03-18 09:45:12.398: ERROR/AndroidRuntime(1778): Uncaught handler: thread main exiting due to uncaught exception
    03-18 09:45:12.428: ERROR/AndroidRuntime(1778): java.lang.RuntimeException: Unable to start activity ComponentInfo{android.client/android.client.ClientMain}: java.lang.ArithmeticException: divide by zero
    03-18 09:45:12.428: ERROR/AndroidRuntime(1778):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2401)
    03-18 09:45:12.428: ERROR/AndroidRuntime(1778):     at  android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2417)
    03-18 09:45:12.428: ERROR/AndroidRuntime(1778):     at android.app.ActivityThread.access$2100(ActivityThread.java:116)
    03-18 09:45:12.428: ERROR/AndroidRuntime(1778):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1794)
    03-18 09:45:12.428: ERROR/AndroidRuntime(1778):     at android.os.Handler.dispatchMessage(Handler.java:99)
    03-18 09:45:12.428: ERROR/AndroidRuntime(1778):     at android.os.Looper.loop(Looper.java:123)
    03-18 09:45:12.428: ERROR/AndroidRuntime(1778):     at android.app.ActivityThread.main(ActivityThread.java:4203)
    03-18 09:45:12.428: ERROR/AndroidRuntime(1778):     at java.lang.reflect.Method.invokeNative(Native Method)
    03-18 09:45:12.428: ERROR/AndroidRuntime(1778):     at java.lang.reflect.Method.invoke(Method.java:521)
    03-18 09:45:12.428: ERROR/AndroidRuntime(1778):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:791)
    03-18 09:45:12.428: ERROR/AndroidRuntime(1778):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:549)
    03-18 09:45:12.428: ERROR/AndroidRuntime(1778):     at dalvik.system.NativeStart.main(Native Method)
    03-18 09:45:12.428: ERROR/AndroidRuntime(1778): Caused by: java.lang.ArithmeticException: divide by zero
    03-18 09:45:12.428: ERROR/AndroidRuntime(1778):     at android.client.ClientMain.onCreate(ClientMain.java:35)
    03-18 09:45:12.428: ERROR/AndroidRuntime(1778):     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1123)
    03-18 09:45:12.428: ERROR/AndroidRuntime(1778):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2364)
    03-18 09:45:12.428: ERROR/AndroidRuntime(1778):     ... 11 more
    03-18 09:45:12.438: INFO/Process(52): Sending signal. PID: 1778 SIG: 3
    

    If you go to the deepest Exception shown that one that raised all the others you will see

    03-18 09:45:12.428: ERROR/AndroidRuntime(1778): Caused by: java.lang.ArithmeticException: divide by zero
    03-18 09:45:12.428: ERROR/AndroidRuntime(1778):     at android.client.ClientMain.onCreate(ClientMain.java:35)
    

    This is pretty clear I think. On line 35 in the ClientMain an Exception was thrown and it was a divide by zero exception. If you can’t figure this out (in a case not as clear as the example) you can set a breakpoint on this line or the entry point of the method or something. Now the debugger will show you all the variables and you can step execute the code step by step until the error occurs. If you hover over a varibale you can see the value of this variable and now you can step by step try to understand the cause of the exception and solve it. If you step to deeply into the code you will end in the java class that is responsible for doing the division, if you haven’t added the jars with the source code of this classes to your project the debugger isn’t able to show you something at this point.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 372k
  • Answers 372k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer The data model handles the data and the abstract relationships… May 14, 2026 at 7:18 pm
  • Editorial Team
    Editorial Team added an answer What I suggest. Open Eclipse Create a new Java project… May 14, 2026 at 7:18 pm
  • Editorial Team
    Editorial Team added an answer It looks like IIS is denying you access to the… May 14, 2026 at 7:18 pm

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.