11

Whenever i click on run project , it is showing me NullPointerException : null. I don't know what is the reason, why am i getting this?

enter image description here

NOTE Dont point this question as duplicate of What is a Null Pointer Exception, and how do I fix it?, because i am not getting null in any control or view or any line of code.

Edit : I am using Android Studio 1.4 with following gradle configuration :

compileSdkVersion 23
buildToolsVersion "23.0.2"
Community
  • 1
  • 1
Ravi
  • 34,851
  • 21
  • 122
  • 183
  • 1
    What message getting in Messages Tab? – ρяσѕρєя K Feb 12 '16 at 06:05
  • 4
    @DavidS do you really think after having 5000+ reputation i will post that kind of question which are very famous in android? – Ravi Feb 12 '16 at 06:07
  • 1
    @DavidS - That duplicate would only apply if the **running code** had a null pointer – OneCricketeer Feb 12 '16 at 06:07
  • 1
    Anyways... [Locating IDE log files](https://intellij-support.jetbrains.com/hc/en-us/articles/207241085-Locating-IDE-log-files) may be worth a read – OneCricketeer Feb 12 '16 at 06:08
  • @ρяσѕρєяK i am getting same thing in message also, like NullpointerException : null (before 1min ago) – Ravi Feb 12 '16 at 06:09
  • It could be an internal IDE error. Did you try restarting android studio? – K Neeraj Lal Feb 12 '16 at 06:09
  • Oh, my apologies. You are all right. I did not read the question closely enough, and I did not realize this was the IDE. (In my defense, this would not have been the first time a question claimed it wasn't a duplicate when it was.) – DavidS Feb 12 '16 at 06:10
  • Have a look in the `idea.log` file. This is the path for me `C:\Users\UserX\.AndroidStudio1.5\system\log`. @cricket_007, I didnt know there was a shortcut to this. Thanks. :) – K Neeraj Lal Feb 12 '16 at 06:18
  • 2
    Thank you all , `Invalidate and Restart` did trick for me, it is solved by that. Only restarting studio and system was not working. – Ravi Feb 12 '16 at 06:18

2 Answers2

10

Strange I was finding for solution from more that 2 hours but solution was simple. I have tried with restarting system as well as Android Studio, but the thing which did trick for me is Invalidate and Restart.

you can find this option from File->Invalidate caches/Restart.

enter image description here

This did trick for me and now its not showing error.

Ravi
  • 34,851
  • 21
  • 122
  • 183
1

Strangely enough, I had the same issue, but Invalidation didn't helped. I even tried to reinstall Android Studio but it didn't help either.

Finally, I removed .idea folder and all other files from Android studio (*.iml) and re-imported project as a Gradle project and everything became fine.

I had Android Studio version 2.3

Gaket
  • 6,533
  • 2
  • 37
  • 67