Compilation failed: org.gradle.internal.exceptions.LocationAwareException

This usually happens when we mess something in the code, like id or wrong imports, you can use

gradlew assembleDebug --info

to compile the code and see for detailed error logs. There you'll find what you messed up.


In my case it's not a problem regarding gradle but regarding java. I have a singleton class A that extends another singleton class B and when I make private the class A constructor, the build failed with org.gradle.internal.exceptions.LocationAwareException

I solved this issue making protected or public the class A contructor.


Try to invalidate caches in Android Studio (File -> Invalidate Caches/Restart -> Invalidate and Restart). Then sync Gradle, clean project and run.

If this doesn't help, try to remove dependencies one by one and see which one is causing troubles.