Share via


Android dependencies in .aar files not being imported to SDK

Hi!
I had been working with some issues importing .aar files, and i would like to share some recommendations that work under this scenario

Option 1)
You have to add dependent AARs and JARs to the Binding project as well as main AAR file.
Use the plugin Xamarin.GradleBindings https://github.com/EgorBo/Xamarin.GradleBindings as it should resolve dependency and all its sub-dependencies and generate the binding project.

Option 2)
- Follow instructions: Menu (File -> New-> New Module -> Import .JAR/.AAR) and import your .AAR. The correct way (currently) to use a local AAR file as a build dependency is to use the module import wizard (File | New Module | Import .JAR or .AAR package) which will automatically add the .aar as a library module in your
- Then in the project build.gradle (not the top level one, the one under 'app') add the following (in the dependencies section):

dependencies {
compile project(':Name-Of-Your-Project')
}

- Name-Of-Your-Project should match the name of the folder that was added after you imported the AAR file (at the same level as app/.myname under the top most level folder). Or to put it another way...

MyApplication
.myname
app
build.gradle (here's where to add compile project(':ProjectName') to dependency section)
ProjectName (added automatically after importing, matching the name of your aar file)
build
gradle
etc

- Sync Gradle (using toolbar button or in File->Synchronize) after you do this.

Option 3)
- You can also try placing the .aar locally and retry

Some interesting Public references:
Build your Android applications in Visual Studio using Gradle
Xamarin.Android Manual Installation
Launch the SDK Manager from Xamarin Studio

Hope it helps!
Regards,
Rosana