Coding⏱️ 2 min read📅 2026-06-03

How to Fix: Error building Android library: Direct local .aar file dependencies are not supported

Direct local .aar file dependencies are not supported when building an AAR. Consider using Maven or Gradle repositories for dependency management.

Quick Answer: Use a Maven repository or configure your library module to use the Android Gradle Plugin's built-in repository support.

The 'Error building Android library: Direct local .aar file dependencies are not supported' error occurs when you're trying to include a local .aar file as a dependency in your Android library module. This is due to changes introduced in the latest version of the Android Gradle Plugin (4.0.0-beta03).

🛑 Root Causes of the Error

  • Upgrading to Android Gradle Plugin 4.0.0-beta03 without updating your build.gradle configuration.

✅ Best Solutions to Fix It

Method 1: Using the `aar` plugin

  1. Step 1: Add the 'aar' plugin to your build.gradle file.

Method 2: Using a repository

  1. Step 1: Add the local .aar file to your project's `libs` directory.

✨ Wrapping Up

To fix this error, you can use either the 'aar' plugin or add your local .aar file to your project's `libs` directory. Both methods should resolve the issue and allow you to build your Android library module successfully.

Did this fix your problem?

If not, try searching for specific error codes.

🔍 Search Error Database

❓ Frequently Asked Questions