Nns_ninteyFIve
Nns_ninteyFIve

Reputation: 37

how to integrate an android .aar library file into a flutter project

enter image description here

i already added a folder inside android directory called linklibrary and add .aar file and also include build.gradle file inside gradle I added

configurations.maybeCreate("default")

artifacts.add("default", file('E4link-1.0.0.aar'))

is there anyone know the steps of how to integrate .aar dependency to my flutter project and also know how to use those library functions inside the flutter project.

I am new to flutter

Upvotes: -1

Views: 1560

Answers (1)

eamirho3ein
eamirho3ein

Reputation: 17910

First create 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.

Upvotes: 2

Related Questions