Cordova plugin add external .aar file (not .jar)

I am writing a plugin to use the native Android SDK filepicker https://github.com/Ink/filepicker-android .

In the maven center, they provide only a .aar file ( http://search.maven.org/#artifactdetails%7Cio.filepicker%7Cfilepicker-android%7C3.8.13%7Caar ), not a .jar.

If I add this line to my config.xml file <source-file src="src/android/filepicker-android-3.8.13.aar" target-dir="libs/" />

the file is copied in libraries, but does not enter the class path during assembly through cordova build, therefore the assembly fails.

What is the best solution to include a third-party library with aar files?

thanks for the help

+4
source share
3 answers

I found a working solution:

gradle , :

dependencies {
   compile 'io.filepicker:filepicker-android:3.9.1'
}

plugin.xml gradle:

<!-- android -->
<platform name="android">
    ...
    <framework src="src/android/FilePickerIO.gradle" custom="true" type="gradleReference" />
</platform>

.

0

cordova , .

, aar libs. (, - card.aar)

app build.gradle Gradle.

{flatDir {dirs 'libs}}

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

!! ... Android Studio build.gradle

+1

Suggestion: you can extract the jar file from aar. You may also need to take care of other dependencies.

0
source

All Articles