简体   繁体   中英

How to add .aar file as a dependency in a Android library module

I have .aar(MyLib.aar) file and i want to create a new android library (MyNewLib.aar) which is dependent on MyLib.aar

apply plugin: 'com.android.library'

android {
    compileSdkVersion 25
    buildToolsVersion "25.0.2"

    defaultConfig {
        minSdkVersion 18
        targetSdkVersion 25
        versionCode 1
        versionName "1.0"

    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

repositories{
    flatDir{
        dirs 'libs'
    }
}
dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    compile(name:'mylib', ext:'aar')

}

When the build is completed the classes that are references to MyLib.aar, are not in the newly created MyNewLib.aar

i have checked this one

How to add .aar dependency in library module?

it doesn't work

put your aar file in libs folder then right click on that file and choose add as library and then sync now. it will be added to your project.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM