将github库作为依赖添加到Android-Studio项目中

我试图从https://github.com/chrisbanes/ActionBar-PullToRefresh/wiki/QuickStart-ABC实施ActionBar的PullToRefresh。 我只是从Eclipse切换到Android-Studio,所以我对AS和Gradle完全陌生。

chrisbanes在网站上写道:

将ActionBar-PullToRefresh添加到项目的最简单的方法是通过Gradle,您只需将以下依赖项添加到您的build.gradle:

dependencies { mavenCentral() compile 'com.github.chrisbanes.actionbarpulltorefresh:extra-abc:+' }

这是否意味着我不必下载库并且Gradle照顾它,以便我总是拥有最新版本? 我只是不知道把上面的线放在哪里。 我有两个gradle.build文件,一个在我的根目录下,如下所示:

// Top-level build file where you can add configuration options common to all sub-projects/modules. buildscript { repositories { mavenCentral() } dependencies { classpath 'com.android.tools.build:gradle:0.8.+' } }

和我的项目中的一个看起来像:

apply plugin: 'android' dependencies { compile fileTree(dir: 'libs', include: '*.jar') compile 'com.android.support:support-v4:18.0.+' compile 'com.android.support:appcompat-v7:18.0.+' } android { compileSdkVersion 19 buildToolsVersion "19.0.1" sourceSets { main { manifest.srcFile 'AndroidManifest.xml' java.srcDirs = ['src'] resources.srcDirs = ['src'] aidl.srcDirs = ['src'] renderscript.srcDirs = ['src'] res.srcDirs = ['res'] assets.srcDirs = ['assets'] } // Move the tests to tests/java, tests/res, etc... instrumentTest.setRoot('tests') // Move the build types to build-types/ // For instance, build-types/debug/java, build-types/debug/AndroidManifest.xml, ... // This moves them out of them default location under src//... which would // conflict with src/ being used by the main source set. // Adding new build types or product flavors should be accompanied // by a similar customization. debug.setRoot('build-types/debug') release.setRoot('build-types/release') } }

我必须在某处添加资料库吗?

它将工作,当你把这一行在你的项目build.gradle ,在dependencies部分:

compile 'com.github.chrisbanes.actionbarpulltorefresh:extra-abc:+'

另外,添加:

repositories { mavenCentral() }

所以:

repositories { mavenCentral() } dependencies { compile fileTree(dir: 'libs', include: '*.jar') compile 'com.android.support:support-v4:18.0.+' compile 'com.android.support:appcompat-v7:18.0.+' compile 'com.github.chrisbanes.actionbarpulltorefresh:extra-abc:+' }

Gradle会自动为您下载所需的资源。

allprojects { repositories { jcenter() maven { url "https://jitpack.io" } } } dependencies { compile 'com.github.User:Repo:Tag' }

android将项目添加到github,将github库作为依赖添加到Android-Studio项目中相关推荐

  1. AD软件如何添加SCHLIB和PCBLIB进库/Altium designer添加库文件

    AD软件如何添加SCHLIB和PCBLIB进库 点击库->libraries->安装->install from file 然后会弹出选择文件框,在文件类型那改为all files ...

  2. android源码环境下编译fourthling.cling库的依赖问题

    记录下,编译fourthline.cling静态库的依赖问题. 1,因为需要在android的源码环境下调试依赖cling的投屏,需要将fourthline.cling编译为静态库. 首先预制依赖的. ...

  3. Android 4.4.2 系统源码字体库精简、添加

    字体加载原理 首先先来阐述一下Android的字体加载原理,Android系统的字体配置文件位于workspace/frameworks/base/data/fonts/ 文件夹下,分为 system ...

  4. Android 必须知道2018年流行的框架库及开发语言,看这一篇就够了!

    导语 2017 已经悄悄的走了,2018 也已经匆匆的来了,我们在总结过去的同时,也要展望一下未来,来规划一下今年要学哪些新技术.这几年优秀Android的开源库不断推出,新技术层出不穷,需要我们不断 ...

  5. Android studio下将项目代码上传至github包括更新,同步,创建依赖

    AS中设置GIT 一.开篇 本文讲如何使用Android Studio将项目上传到github,虽然讲上传github的文章很多,但是大部分都是使用Git Bash命令行,虽然效率高些,但是有点麻烦, ...

  6. 如何将Android Studio项目提交(更新)到github

    前言 在写这篇文章之前首先我假设你已经安装了Android Studio 并已经会用Android Studio建立项目.  那么这篇博文既然是将项目提交到github上,自然我们要明白两个相关概念: ...

  7. github上十二款最著名的Android播放器开源项目

    1.ijkplayer 项目地址: https://github.com/Bilibili/ijkplayer 介绍:Ijkplayer 是Bilibili发布的基于 FFplay 的轻量级 Andr ...

  8. android 音乐视频播放器(github上十二款最著名的Android播放器开源项目)

    1.ijkplayer 项目地址: https://github.com/Bilibili/ijkplayer 介绍:Ijkplayer 是Bilibili发布的基于 FFplay 的轻量级 Andr ...

  9. 提高开源项目逼格-为你的github项目添加Travis CI

    1.背景  每当我们浏览github开源项目的时候,比较牛的项目,往往在readme文件里,会有如下图这样的小绿标.因为博主的好奇心比较强,所以就研究了下怎么添加这个.大家也不妨动手试试! 2.步骤 ...

最新文章

  1. 怎么用linux设计一个小程序,“Linux”小程序发布一个月后,我们发现了什么
  2. Python使用matplotlib可视化多个时间序列数据、在同一个可视化图像中可视化多个时间序列数据(Multiple Time Series)
  3. vba 修改access表的链接地址_VBA中常用的这7种数据类型,你都get到了吗?
  4. 小程序之获取用户信息取消授权处理
  5. JavaScript Table排序
  6. CodeForces - 786C——二分+模拟?
  7. Remon Spekreijse CSerialPort串口类的修正版2014-01-10
  8. python局部变量函数_python函数局部变量用法实例分析
  9. 【C++】R进制转10进制,10进制转R进制
  10. 【C++:类和对象】处理一个线性表,动态产生线性存储空间,并实现线性表的部分操作
  11. mysql 子查询 性能_mysql子查询性能
  12. Uncaught RangeError: Maximum call stack size exceeded
  13. 2003-2017年地级市环境指标数据
  14. 基于MediaTek_ApSoC_SDK_4320_20150414 编译mt7621 的uboot
  15. 【VHDL】四位全减器
  16. 十、工业相机与SCARA机械臂的坐标系标定
  17. 如何测试短信接口调用代码
  18. feign接口返回泛型设置属性为null问题
  19. pygame设计舒尔特方格游戏python舒尔特方格小程序
  20. 非系统APK很多权限受限制,如何让APK成为系统APK

热门文章

  1. mysql的sql执行过程和explain语句
  2. 灯塔谈话记录错误_如何保留灯塔报告的历史记录
  3. unity多人游戏_如何使用Unity 2D和镜像构建多人纸牌游戏(更新)
  4. ipv6怎么进行邻居学习_事实证明,我的邻居也想学习编码。 他们只是没有意识到这是可能的。
  5. android 仿直播点赞,Android-DivergeView
  6. phpstudy创建wordpress
  7. 看看你爱的他今天是什么‘颜色‘ -- Python爬取微博评论制作专属偶像词云
  8. 用Python玩连连看是什么效果?
  9. 深夜,我用python爬取了整个斗图网站,不服来斗
  10. [Ubuntu] MySQL服务启动停止与用户登录