How to manually include external aar package using new Gradle Android Build System -


i've been experimenting new android build system , i've run small issue. i've compiled own aar package of actionbarsherlock i've called 'actionbarsherlock.aar'. i'm trying use aar build final apk. if include whole actionbarsherlock library android-library module main project using compile project (':actionbarsherlock') i'm able build without problems.

but problem want provide dependency aar file package manually if jar can't seem figure out how include project. i've attempted use compile configuration doesn't seem work. keep on getting cannot find symbol during compile tells me classes.jar aar package isn't getting included in classpath.

does know of syntax manually include aar package file?

build.gradle

buildscript {   repositories {      mavencentral()   }   dependencies {     classpath 'com.android.tools.build:gradle:0.4'   } } apply plugin: 'android'  repositories {    mavencentral() } dependencies {     compile files('libs/actionbarsherlock.aar') }  android {     compilesdkversion 15     buildtoolsversion "17.0" } 

edit: answer it's not supported, here's issue if want track it.

edit: still not supported directly best alternative seems proposed solution @ranwakshlak

edit: simpler using syntax proposed @vipulshah

please follow below steps working ( have tested android studio 2.2)

lets have kept aar file in libs folder. ( assume file name cards.aar )

then in app build.gradle specify following , click sync project gradle files. open project level build.gradle , add flatdir{dirs 'libs'} did below

allprojects {    repositories {       jcenter()       flatdir {         dirs 'libs'       }    } } 

and open app level build.grdle file , add .aar file

    dependencies {        compile(name:'cards', ext:'aar') } 

if goes see library entry made in build -> exploded-aar

also note if importing .aar file project has dependencies you'll need include these in build.gradle, too.


Comments

Popular posts from this blog

php - failed to open stream: HTTP request failed! HTTP/1.0 400 Bad Request -

java - How to filter a backspace keyboard input -

java - Show Soft Keyboard when EditText Appears -