问题描述
我已经下载了一些库来源,并想利用它导出为一个JAR文件Android的工作室。有没有一种方法使用的是Android工作室导出到jar文件?
I have downloaded some library sources and would like to export it as a Jar file usingAndroid Studio. Is there a way to export to jar file using Android studio ?
编辑:
我要导出为JAR库是一个Android库。这就是所谓的突出,可以从GitHub上下载。 https://github.com/pingpongboss/StandOut
The library I want to export as jar is an Android library.It's called "StandOut" and can be downloaded from GitHub.https://github.com/pingpongboss/StandOut
推荐答案
这是不可能的一个Android库导出为一个jar文件。这是可能的,但是,将其导出为 AAR
文件。 阿勒
文件是为Android图书馆新的二进制格式。有一个在谷歌I / O时,新构建系统的视频。
It is not possible to export an Android library as a jar file. It is possible, however, to export it as aar
file. Aar
files being the new binary format for Android libraries. There's info about them in Google I/O, the New Build System video.
首先,Android的Studio或命令行从库的根目录下发出摇篮构建
生成库。
First, build the library in Android Studio or from command line issuing gradle build
from your library's root directory.
这将导致< yourlibroot>。/libs/build/yourlib.aar
文件
这AAR文件是库的二进制重新presentation,并可以添加到您的项目,而不是库作为依赖的项目。
This aar file is a binary representation of your library and can be added to your project instead of the library as a dependency project.
要添加AAR文件作为依赖,你必须把它发布到Maven的中央或到你的本地仓库,然后将该文件AAR在项目的 gradle.build
文件。
To add aar file as a dependency you have to publish it to the maven central or to your local maven repository, and then refer the aar file in your project's gradle.build
file.
不过,这一步是有点令人费解。我已经找到了一个很好的解释了如何使这里做的:
However, this step is a bit convoluted. I've found a good explanation how to do so here:
http://www.flexlabs.org/2013/06/using-local-aar-android-library-packages-in-gradle-builds
这篇关于如何导出库在Android的工作室是JAR?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!