Search code examples
cordovaandroid-studiogradleandroid-gradle-plugincordova-plugins

How to download a library dependence on gradle for external use?


I have a project on PhoneGap and I am trying to build a plugin to use a FilePicker library. So, I build one Android Studio Project and I have it working. So, right now, that I know that I know how to do it, I just need to know how to reference the project on PhoneGap.

The problem is that I don't know where the project is downloaded when I use gradle for referencing it. I use:

compile 'io.filepicker:filepicker-android:3.8.13'

I just need to know where is this project folder, so I can copy and referencing it from phoneGap. Or how can I download it directly from gradle.


Solution

  • What you're looking for is an aar file. You can copy this file to lib folder with the following script:

    apply plugin: 'java'
    
    repositories {
       mavenCentral()
    }
    
    dependencies {
       compile 'io.filepicker:filepicker-android:3.8.14@aar'
    }
    
    task copyLibs(type: Copy) {
       from configurations.compile
       into 'lib'
    }