Error building Android library: Direct local .aar file dependencies are not supported
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")
}
If you are on a newer Android Studio version (4.0.0+), this option is not available. Instead you have to do it manually.
- Create a new directory and put the following content into the
build.gradle
file withing the new directory:
configurations.maybeCreate("default")
artifacts.add("default", file('[nameOfTheAar].aar'))
- Place the
aar
into this new directoy. Next to thebuild.gradle
file. - Add the new created Gradle project to the
settings.gradle
file:
include(":pathToTheCreatedDirectory")
- Include the project in your library where you want to use the
aar
:
implementation project(":pathToTheCreatedDirectory", configuration = "default")
how to integrate an android .aar library file into a flutter project
First creat a libs folder in android root folder then adding your .aar
file to libs
(in your case liblibrary
) folder in android root folder, add this in android build.gradle
:
allprojects {
repositories {
google()
jcenter()
flatDir {
dirs '../libs' // in your case liblibrary
}
}
}
then in app build.gradle
add this:
dependencies {
...
implementation(name:'your_file_name', ext:'aar')
}
then sync your gradle and you are good to go.
Related Topics
Onpagefinished() Never Called (Webview)!
Save Webview Content to Android Storage and Load It
How to Get Screen Display Metrics in Application Class
How to Detect If Device Support Notch Display
How to Avoid Scientific Notation in Double
Android - Correct Use of Invalidateoptionsmenu()
Display the App Icon If the Contact Is Associated with the Application in Phone Address Book
Onbackpressed to Hide Not Destroy Activity
How to Animate a View in Android and Have It Stay in The New Position/Size
Onitemclicklistener and Onclicklistener Not Working for Listview
How to Apply Custom CSS to Android Webview When Url Is from Internet Server
How Do Popular Apps Authenticate User Requests from Their Mobile App to Their Server
What Is Use of Cursor in Android Development
Captured Photo Orientation Is Changing in Android
How to Develop Android App Completely Using Python