如何从github上导入Eclipse库项目到Android Studio项目? [英] How to import eclipse library project from github to android studio project?

查看:215
本文介绍了如何从github上导入Eclipse库项目到Android Studio项目?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用 HoloCircullarProgressBar 在我的Andr​​oid Studio项目库项目。 我试图复制到pre创建的库文件夹在我的项目做出来,然后将其添加到项目结构项目。但它不工作不知。

I want to use HoloCircullarProgressBar as a library project in my android studio project. I tried to do it by copying into pre-created "library" folder in my project and then to add it to project in "Project Structure". But it's not working somehow.

谁能给出一个非常具体的一步一步的教程如何做,在Android的工作室0.3.6?

Could anyone give a very specific step-by-step tutorial on how to do that in android studio 0.3.6?

推荐答案

如果您要导入一个库源$ C ​​$ C到摇篮为基础的项目,然后在那一刻有没有超级简单的方法来做到这一点(不好意思,这是待办事项列表,请参阅<一href="https://$c$c.google.com/p/android/issues/detail?id=62122">https://$c$c.google.com/p/android/issues/detail?id=62122)所以你必须编写你自己的构建文件库中。事实上,它可能是更容易使用的新建模块向导设置生成的文件和目录结构,那么你就可以修剪下来,并在这个复制文件组步骤应该让你启动和运行。这似乎是一个很大的步骤,但它应该有希望去pretty的快。

If you're importing a library as source code into a Gradle-based project, then at the moment there's no super-easy way to do it (sorry, it's on the to-do list, see https://code.google.com/p/android/issues/detail?id=62122) so you'll have to author your own build file for the library. Actually, it might be easier to use the New Module wizard to set up the build file and directory structure, then you can trim it down and copy the files over. This set of steps should get you up and running. It seems like a lot of steps but it should hopefully go pretty quick.

  1. 文件菜单,选择新模块...
  2. 从出现的向导中,选择的Andr​​oid库
  3. 从向导的下一个页面,给它的模块名称HoloCircularProgressBar并取消创建自定义启动图标创建活动选项。
  4. 单击向导上完成。
  1. From the File menu, choose New Module...
  2. From the wizard that comes up, choose Android Library
  3. From the next page of the wizard, give it the module name HoloCircularProgressBar, and uncheck the options for Create custom launcher icon and Create activity.
  4. Click Finish on the wizard.

它应该增加新的模块,您的项目,所以你最终的东西是这样的:

It should add the new module to your project, so you'll end up with something like this:

  1. 删除一切都在src /主文件夹内。
  2. 现在,复制 AndroidManfiest.xml ic_launcher-web.png 资源的src 从HoloCircularProgressBar源到的src /主文件夹。
  3. 重命名您只需复制到的src /主的src 文件夹的Java
  4. 在新模块向导留下了一些东西,在你的 HoloCircularProgresBar 模块/目录下的 build.gradle 文件(使确保你正在编辑的那一个,而不是一个是你的主要的应用程序模块),我们不需要。删除依赖块和发布块。
  1. Delete everything inside the src/main folder.
  2. Now copy AndroidManfiest.xml, ic_launcher-web.png, res, and src from the HoloCircularProgressBar source into the src/main folder.
  3. Rename the src folder that you just copied into src/main to java.
  4. The New Module wizard left some things in the build.gradle file in your HoloCircularProgresBar module/directory (make sure you're editing that one, not the one for your main app module) we don't need. Remove the dependencies block and the release block.

在这一点上,你应该有希望能够建立成功。现在,如果您确实希望使用该模块:

At this point you should hopefully be able to build successfully. Now if you want to actually use the module:

  1. 进入文件> 项目结构... > 模块> 你的主模块> 依赖
  2. 点击+按钮添加一个依赖,选择模块依赖,然后选择 HoloCircularProgressBar 从列表中。
  1. Go to File > Project Structure... > Modules > Your main module > Dependencies.
  2. Click on the + button to add a dependency, choose Module dependency, and select HoloCircularProgressBar from the list.

现在进口图书馆的声明和用法应该工作,你应该是好去。

Now import statements and usages of the library should work, and you should be good to go.

这篇关于如何从github上导入Eclipse库项目到Android Studio项目?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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