如何将Android Studio上创建的Android Library Project导入现有的Eclipse Android应用程序项目,作为库? [英] How to import an Android Library Project created on Android Studio into existing Eclipse Android App Project, as library?

查看:194
本文介绍了如何将Android Studio上创建的Android Library Project导入现有的Eclipse Android应用程序项目,作为库?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想要做的是添加此 GitHub - 自定义日历视图 Android图书馆项目在Android Studio上创建。

What I want to do is to add this GitHub - Custom-Calendar-View Android Library Project created on Android Studio.

我读了很多关于SO的问题和答案,但没有一个适合我的情况。
怎么可以这样?
需要从Android Studio上的Android Library Project导出.jar?如果是,怎么样?
对我来说,使用Custom-Calendar-View库的资源也很重要。

I read a lot of questions and answers about, on SO, but none fits my case. How can to this? Need to export a .jar from Android Library Project on Android Studio? if so, how? Also its important to me to use the resources of Custom-Calendar-View library.

任何帮助?

推荐答案

您可以将库简单地编译成jar文件,然后在Eclipse中导入。默认Gradle提供从源代码构建一个jar。参见示例

You can simply compile the library into a jar file and then import in Eclipse. By Default Gradle provides building a jar from source code. See the example,

// Include dependent libraries in archive.
mainClassName = "com.company.application.Main"

jar {
  manifest { 
    attributes "Main-Class": "$mainClassName"
  }  

  from {
    configurations.compile.collect { it.isDirectory() ? it : zipTree(it) }
  }
}

您可以检查其他使用Gradle构建具有依赖关系的jar的解决方案 here

You can check other solutions for building a jar with dependencies using Gradle here!

这篇关于如何将Android Studio上创建的Android Library Project导入现有的Eclipse Android应用程序项目,作为库?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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