Asked  3 Months ago    Answers:  5   Viewed   601 times

We recently upgraded to Android Gradle Plugin 4.0.0-beta03. We are now seeing this error when building one of our library modules

$ ./gradlew library_module:assemble

Execution failed for task ':library_module:bundleDebugAar'.
> Direct local .aar file dependencies are not supported when building an AAR. 
The resulting AAR would be broken because the classes and Android resources from any local .aar 
file dependencies would not be packaged in the resulting AAR. Previous versions of the Android 
Gradle Plugin produce broken AARs in this case too (despite not throwing this error). The 
following direct local .aar file dependencies of the :library_module project caused this error: 

I can see this was added to AGP a few months ago. But they provide no further info on why.


  1. What was the problem? Any more info? I can't find a single bug report anywhere.
  2. How exactly can I fix this? Is this saying that I can't build one .aar that depends on other local .aars? What if this local aar was instead hosted on Maven Central or another remote repo? Why would that make a difference?



I recently encountered the same issue, the fix was to remove the library from libs/ and import it using File -> New -> New Module -> Import .JAR/.AAR Package, then referencing it in the library module build.gradle file:

dependencies {
  implementation project(":imported_aar_module")
Sunday, August 1, 2021
answered 3 Months ago

Based on hakre's suggestions above, I've created this script, to be included at the top of any php script:

(also here is a gist I made of this file if you wish to fork/download it: view on github )

function custom_error_debug($errno, $errstr, $errfile, $errline, $errvars) {
  $message = "";
  $message .= "[ " . date('Y-m-d h-i-s') . " ] Error: [$errno] $errstr on line $errline of $errfile ";

  //Dump all info to browser!
  //WARNING: Leave this commented except for extreme cases where you need to see all variables in use!
  //Using this will cause excessive processing time, and RAM. Use only as needed!
  /*if (!empty($errvars)) {
     echo $message . PHP_EOL . "Variables in use: <pre>";print_r($errvars); echo "</pre>";
     //WARNING: not ending execution here may cause the browser to overload on larger frameworks, comment out at your own risk!

  //get the directory of the offending file, put a log in that path, and separate them by end of line, append to file
  file_put_contents ( dirname($errfile) . "/php_errors.log", $message . PHP_EOL, FILE_APPEND );

  //Dump all variables to file as well, (MAY CAUSE LARGE FILES, read above)
  //file_put_contents ( dirname($errfile) . "/php_errors.log", $errvars . PHP_EOL, FILE_APPEND );

  //Optionally end script execution
Saturday, May 29, 2021
answered 5 Months ago

It appears that my problem has cleared up with Gradle 1.9 and Leastways, I can no longer reproduce the problem.

Monday, August 2, 2021
answered 3 Months ago

Use android-fat-aar gradle plugin, it is super usefull!

Wednesday, August 11, 2021
Shane Hsu
answered 2 Months ago

Its probably complaining about the fact you are trying to use a JDK 11 version when your gradle is only compatible up to a lesser JDK version.

The short answer would be - download a JDK 1.8.something version and try with that, the alternate (and probably better long term) answer would be to upgrade your gradle version to the latest (i.e. a JDK 11 compatible version).

EDIT: so google says that you need a minimum of Gradle 5.0 to use JDK 11 :)

Thursday, August 26, 2021
answered 2 Months ago
Only authorized users can answer the question. Please sign in first, or register a free account.
Not the answer you're looking for? Browse other questions tagged :