android repository github

来源:互联网 发布:eia数据美国公布时间 编辑:程序博客网 时间:2024/06/04 18:39

使用github作为远程仓库repository,封装功能模块。之后,通过gradle dependency方式集成,方便调用。

1.github repository

登录github->new repository,作为maven仓库,得到远程地址,如:https://github.com/FreeLeo/AAR.git

2.安装git工具

下载地址:https://git-scm.com/downloads

选择一个文件夹,作为本地的repository,与github关联

使用【Git Bash Here】关联

git init 

git add .

git clone https://github.com/FreeLeo/AAR.git


3.library

使用Android studio,建立Moudle.

build.gradle 中修改如下部分:

apply plugin: 'com.android.library'apply plugin: 'maven'
uploadArchives {    repositories.mavenDeployer {        def mavenRepositoryPath = file(getProperty('aar.Utils'))        repository(url: "file://${mavenRepositoryPath.absolutePath}")        pom.project {            groupId "com.android.open.utils"            artifactId "Utils"            version 1.0        }    }


Project Properties gradle.properties修改

aar.Utils=D:\\aar\\AAR

4.编译生成aar

使用命令:gradlew uploadArchives 

若编译成功,会在配置的本地repository中生成。


5.git上传到github

将未缓存的改动添加到已缓存的活动;

提交

上传

之后到github确认是否上传成功。


6.远程依赖

6.1 复制git当前界面地址,并修改,添加到根目录build.gradle中,位置如下:

即 github.com ——> raw.githubusercontent.com
再在末尾追加/master
表示当前要选用的是master分支的内容

如https://github.com/FreeLeo/AAR 修改为https://raw.githubusercontent.com/FreeLeo/AAR/master

allprojects {    repositories {        jcenter()        maven { url "https://raw.githubusercontent.com/FreeLeo/AAR/master"}    }}

6.2 在需要引用的module的build.gradle  dependencies中添加:

compile 'com.android.open.utils:Utils:1.0'

0 0
原创粉丝点击
热门问题 老师的惩罚 人脸识别 我在镇武司摸鱼那些年 重生之率土为王 我在大康的咸鱼生活 盘龙之生命进化 天生仙种 凡人之先天五行 春回大明朝 姑娘不必设防,我是瞎子 脚扭伤脚面肿了怎么办 腰突然扭了好痛怎么办 腰扭伤了怎么办最有效 腰扭伤了不能动怎么办 前交叉韧带增粗怎么办 膝盖前交叉韧带损伤怎么办 狗的腿肌肉拉伤怎么办 胳膊上的筋拉伤怎么办 肩周炎胳膊抬不起来怎么办 脖子上的筋拉伤怎么办 脚踝骨扭伤肿了怎么办 脚扭伤肿起来了怎么办 月经量特别少该怎么办 月经血沾床单上怎么办 月经弄到棉被上怎么办 血弄床单上干了怎么办 不小心吃了指甲怎么办 月经没有干净同房了怎么办 撞红了怎么办要吃药吗 自己长得太丑怎么办 长得丑特别自卑怎么办 手挤了有淤血怎么办 手指肚夹淤血了怎么办 指甲被夹了变黑怎么办 孩子手指夹肿了怎么办 指甲压了有淤血怎么办 挤到手指有淤血怎么办 指甲上有黑线是怎么办 指甲被压了要掉怎么办 脚趾肿了有脓怎么办 手指甲上的死皮怎么办 手被东西砸肿了怎么办 手被夹住有淤血怎么办 指头被车门夹了怎么办 手背夹伤了肿了怎么办 剪完指甲边肿了怎么办 手心长水泡又痒怎么办 指甲肿了有脓怎么办 手指肿了有脓包怎么办 手指头肿了有脓怎么办 指甲弄肿了很痛怎么办