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 [/bash\


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.

Android Android Commands Android Java Applications Application Libraries Application Stack / User Interface Bash / Shell Scripts Commands and Packages Compilation Content Management System - CMS Core Kernel C Programs Development & Build Development Environment Setup Errors & Failures Flutter git Go Language Programs Hardware Platforms HTML JAVA Programs Kernel & Device Drivers Linux, OS Concepts and Networking Linux Device Drivers Linux Host, Ubuntu, SysAdmin Linux Kernel Linux Networking Middleware Libraries, HAL Monetization / Google AdSense Multimedia - Audio, Video, Images NDK / Middleware / HAL OS Concepts PHP Programming Languages RaspberryPi Scripting and Automation Search Engine Optimisation ( SEO ) Social Media Socurce Code Management ( SCM ) System Administration, Security Testing and Debugging Uncategorized User Interface Web design and development Wordpress Yocto / Bitbake / Openembedded

Leave a Reply / Ask Question