导入GitHub的项目,库现有项目 [英] Importing github projects as library to existing project
问题描述
我用导入库作为.jar文件,但我不知道如何使用这些项目从这样的github上:<一href=\"https://github.com/jfeinstein10/SlidingMenu/\">https://github.com/jfeinstein10/SlidingMenu/
I am used to importing library as .jar file but I don't know how to use the projects from github like this: https://github.com/jfeinstein10/SlidingMenu/
我想在我现有的项目使用它。我试着包括依赖项目文件,但它给了我一些错误
I want to use it in my existing project. I tried including the project file in the dependencies but it's giving me some errors
推荐答案
我已经解释<一个href=\"http://stackoverflow.com/questions/20377591/how-to-use-a-library-project-in-android-studio/20418060#20418060\">in这个帖子如何在Android Studio中使用项目库。
但我知道,尤其是在一开始,直到你明白AS-项目的所有制结构它不是那么容易的。所以在这里为您的问题作出解释:
I already explained in this post how to use a project library in android studio. But I know especially at the beginning it's not that easy until you understand the structur of AS-Projects. So here an explanation for your issue:
我通过配置我的项目的文件的gradle这样增加项目库,我的项目:
I'm adding project libraries to my projects by configuring the gradle files of my project like this:
- 在命名您的项目根目录创建一个文件夹库
- 复制SlidingMenu项目的整个文件夹'库'混帐上进入库
- 重命名您只需复制到文件夹图书馆如SlidingMenuLibrary(只是为了避免混淆)
-
现在添加此库中的
settings.gradle
使用以下命令:
include ':libs:SlidingMenuLibrary'
去你AppProject你的的build.gradle
文件,下面一行添加到您的依赖:
go to your build.gradle
file of your AppProject and add the following line to your 'dependencies':
compile project(':libs:SlidingMenuLibrary')
你至少要同步您的文件的gradle:工具 - > Android的 - >同步工程与摇篮文件
at least you have to sync your gradle files: Tools -> Android -> Sync Project with Gradle Files
请试试这个。如果出现错误,请张贴日志文件。
Please try this. If you get errors please post the log file.
这篇关于导入GitHub的项目,库现有项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!