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

橙三吉。 提交于 2019-11-29 11:02:38

After cordova project creation, adding platform, adding plugin is done.

Lets say the aar file are copied in libs folder. ( assume file name is cards.aar )

then in app build.gradle specify following and click sync project with Gradle files.

repositories { flatDir { dirs 'libs' } }

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

It works for me!! but one drawback of this solution is .. you need to open the project from platform folder on Android Studio and add the above lines to your build.gradle

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

I found a working solution:

Add a new gradle file containing your dependency:

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

In your plugin.xml, reference the extra gradle file:

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

That's all.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!