0

I am beginner for android. Trying to make basic applications. When I tried to run the program after adding an adapter and gridview in my code, the application couldnt be started. These are the lines from the DDMS for failing it. Can anybody please suggest me how do i locate the error contain line from it ? or I cannot ?

02-19 16:53:12.481: D/ActivityThread(1721): setTargetHeapConcurrentStart:2097152

02-19 16:53:12.591: W/dalvikvm(1721): threadid=1: thread exiting with uncaught exception     (group=0x410eb438)

02-19 16:53:12.591: E/AndroidRuntime(1721): FATAL EXCEPTION: main

02-19 16:53:12.591: E/AndroidRuntime(1721): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.zilo/com.example.zilo.MainActivity}: java.lang.NullPointerException

02-19 16:53:12.591: E/AndroidRuntime(1721): at    android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2087)

02-19 16:53:12.591: E/AndroidRuntime(1721): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2112)

I am not seeking help to find the error, Please help me to figure out, how to locate the error from DDMS log.

Shasi
  • 274
  • 6
  • 21
  • the error start with you app package name, double click it to show the line getting error in eclipse – appukrb Feb 19 '14 at 06:42
  • **ComponentInfo** Activity is not starting in this package **com.example.zilo** because of Null Pointer Exception. – i.n.e.f Feb 19 '14 at 06:43
  • `java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.zilo/com.example.zilo.MainActivity}: java.lang.NullPointerException` this is the error. Usually, the stack trace will also print more detail info on `caused by:` line. – Andrew T. Feb 19 '14 at 06:44

1 Answers1

0

Here are the steps :

1- Go to the first 2 lines of the exception , in your case Fetal Exception, Main and java.lang.RuntimeException so this is the main exception. Sometimes you will find it like Security Exception, NullPOinterException and so on

2- Proceed with all following lines until you find the Caused by lines which mostly will be followed by the line number of the code that causes the problem

3- If you couldn't find the cause by and generally you look at the exception trace line by line until you find some indicator or component name of your code that might cause this problem.

Looking to the second line : Unable to start activity ComponentInfo{com.example.zilo/com.example.zilo.MainActivity}: java.lang.NullPointerException

So here is another clue , NullPointerException that prevents the app from being loaded. probably a problem in onCreate() method or something that prevented MainActivity from being loaded.

I believe this is not the full stack trace, in the following lines of the stack trace you will find the cause. You may post the full exception so that we may assist further.

Hope this helps you.

MSaudi
  • 4,442
  • 2
  • 40
  • 65
  • Satisfied with your answer. I wish I coul vote up your answer, but I cant because I got only 11 reps. – Shasi Feb 19 '14 at 12:33
  • You should click the "Check Right" mark below the down arrow to mark it as correct answer :) – MSaudi Feb 19 '14 at 12:49