[英]How to compile gradle project to a jar file I can use in my Android application
I have an Android application that I've written in Eclipse. 我有一个用Eclipse编写的Android应用程序。 I like working with eclipse better than Android Studio.
与Android Studio相比,我更喜欢使用Eclipse。
I found a nice control on Github that I would like to use in my project https://github.com/pedant/sweet-alert-dialog 我在我的项目https://github.com/pedant/sweet-alert-dialog中使用了Github控件
And it depends on the following project: https://github.com/pnikosis/materialish-progress 它取决于以下项目: https : //github.com/pnikosis/materialish-progress
I tried compiling with gradle but with no luck. 我尝试用gradle编译,但是没有运气。 What I need is a JAR file that I can use in my eclipse project.
我需要的是可以在Eclipse项目中使用的JAR文件。 So I first tried to compile the sweet-alert-dialog project and I found out that I need to first somehow include the materialish-progress.
因此,我首先尝试编译了“ sweet-alert-dialog”项目,然后发现我首先需要以某种方式包括实质性进展。
How can I compile those projects into a JAR file that I can drop in my eclipse project and use? 如何将这些项目编译为可以放入Eclipse项目并使用的JAR文件?
Eclipse use apklib and gradle aar for packaging libraries. Eclipse使用apklib和gradle aar来打包库。 Aar is the recommended format to use by google but if you need to generate apklib from gradle you can add this code in your build.gradle
Aar是Google推荐使用的格式,但是如果您需要从gradle生成apklib,则可以在build.gradle中添加此代码
task apklib(type: Zip) {
appendix = extension = 'apklib'
from 'AndroidManifest.xml'
into('res') {
from 'res'
}
into('src') {
from 'src'
}
}
Then you could use this task by calling gradle apklib. 然后,您可以通过调用gradle apklib使用此任务。 You may have to adapt this snippet for your project.
您可能需要针对您的项目修改此代码段。
Try to download *.aar files from http://mvnrepository.com/artifact/cn.pedant.sweetalert/library/1.3 and http://mvnrepository.com/artifact/com.pnikosis/materialish-progress/1.0 , extract class jars from them (they are just archives) and put to your libs folder. 尝试从http://mvnrepository.com/artifact/cn.pedant.sweetalert/library/1.3和http://mvnrepository.com/artifact/com.pnikosis/materialish-progress/1.0提取类中的* .aar文件将它们中的jar(只是存档)保存到您的libs文件夹中。 May be some resources will need to be copied from archives, too.. But I haven't managed it yet.
可能有些资源也需要从存档中复制。.但是我还没有管理它。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.