Skip to content Skip to sidebar Skip to footer

How To Debug A Nullpointerexception In An Android App?

I have a very simple app which isn't starting correctly. The app should load a splashscreen, and then the main app. For some reason it's now not working - Logcat: 02-08 13:30

Solution 1:

According to the LogCat output the problem is in your welcome.xml layout file. It is inflated incorrectly for some reason.

Try removing android:textAppearance="?android:attr/textAppearanceLarge" attribute and ENSURE that you have run Clean.. command on your project before the launch.

Also ENSURE that all the references in the xml-file are valid (i.e. logov2, img1). I would temporarily remove all references from your xml-file and check if it helps.

Solution 2:

Copy the welcome.xml file and save it anywhere for temporary time then delete this file from the eclipse after delete the file again paste that welcome.xml file which you copied.Then run again.It will sure run your app.

Solution 3:

I was also suffering from this problem once. Then what i did was i just copied the id of the layout from my R.java and pasted it directly to setContentView(). ie, Here in your case the id of welcome in R.java->layout. then my app ran successfully without any exception. Thus i realized that its just a temporary problem. After restarting my eclipse (sometimes you have to restart your system fully) I replaced the id again by R.layout.welcome and it worked fine. Hope this helps...

Solution 4:

Have you added the activity in to the manifest and also added the permission?

Please add the manifest so that I can refer you something more?

You have crash may be due to this Permission denied. Check your permission in the manifest.xml.

Post a Comment for "How To Debug A Nullpointerexception In An Android App?"