Solved: org.gradle.internal.exceptions.LocationAwareException: buildOutput.apkData must not be null

If you have some code which was already complied using “./gradlew clean build” on the ubuntu command line and was using some old gradle version.

Now, if you open the same code from Android Studio, and if the android studio have moved to some most recent version of gradle, it will ask for you to update the gradle version and if you clicked OK, will go on updating gradle version.

At the end of all this process, when the compilation of already compiled code with old gradle version starts from Studio with new gradle version, you might get a failure like as below,

org.gradle.internal.exceptions.LocationAwareException: 
buildOutput.apkData must not be null

Solution:

As mention above, the error has been caused since there was already compiled build directory present which was compiled with old gradle version.

For Solving the error using Android Studio :

  • Build -> Clean Project
  • Build -> Make Project

For Solving the error using command line

 $ ./gradlew clean build 

OR, you can manually delete “build” directory and recompile everything.

Follow Lynxbee

One Response

Leave a Reply / Ask Question