如何将Android Studio上创建的Android Library Project导入现有的Eclipse Android应用程序项目,作为库?

如何将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!