cordova插件添加外部.aar文件(不是.jar) [英] cordova plugin add external .aar file (not .jar)

查看:2339
本文介绍了cordova插件添加外部.aar文件(不是.jar)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在编写一个插件来使用filepicker的原生Android SDK https://github.com/Ink / filepicker-android



在maven central上,他们只提供一个.aar文件( http://search.maven.org/#artifactdetails%7Cio.filepicker%7Cfilepicker-android%7C3.8.13%7Caar



如果我在我的config.xml中添加这一行
< source- file src =src / android / filepicker-android-3.8.13.aartarget-dir =libs //>



该文件是在libs中复制的,但是在构建期间通过 cordova build 不包括在类路径中,因此构建失败。


$ b $



感谢您的帮助

解决方案

我找到一个有效的解决方案:



添加一个包含依赖关系的新gradle文件:

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

plugin.xml 中,引用额外的gradle文件:

 <! -  android  - > 
< platform name =android>
...
< framework src =src / android / FilePickerIO.gradlecustom =truetype =gradleReference/>
< / platform>

就是这样。


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

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

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

the file is copy in libs but not included in the class path during the build via cordova build, so the build failed.

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

Thank you for your help

解决方案

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.

这篇关于cordova插件添加外部.aar文件(不是.jar)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆