android模块打包arr到github并在其他项目引用

使用的工具准备:git,android studio;

git的安装与androidstudio的安装方法我们不再这里说了

1.在github上面创建repository
这里写图片描述

一.首先在github上Create a new repository
二.同步github上的文件夹到本地,等下要上传文件上去
三.打包需要上传的模块
1.在需要打包的模块的bulid.gradle里面加入

apply plugin: 'maven'
android {
    ...
    defaultConfig {
        ...
        versionCode 1
        versionName "1.0"
    }
}
ext {
    PUBLISH_GROUP_ID = 'com.xx'
    PUBLISH_ARTIFACT_ID = 'loadingdialog'
    PUBLISH_VERSION = android.defaultConfig.versionName
}
uploadArchives {
    repositories.mavenDeployer {
        def deployPath = file(getProperty('aar.deployPath'))
        repository(url: "file://${deployPath.absolutePath}")
        pom.project {
            groupId project.PUBLISH_GROUP_ID
            artifactId project.PUBLISH_ARTIFACT_ID
            version project.PUBLISH_VERSION
        }
    }
}

2.在项目根目录的gradle.properties里面加入

aar.deployPath=D:\\gradlelib\\xxrepo

这里是上面需要的地址,这个是我从github上面同步下的文件夹,就是需要把打包的文件输出到这里,然后上传。

3.gradle输出arr
这里写图片描述
选中需要打包的模块,点击upload/uploadArchives就行了,然后等待文件输出上传到githup
我的地址:https://github.com/baoya/xxrepo
4.通过gradle引用

复制出当前界面的连接地址,比如
https://github.com/baoya/xxrepo
对其进行修改:
https://raw.githubusercontent.com/baoya/xxrepo/master

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

allprojects {
    repositories {
        jcenter()
        mavenCentral()
        ...
        maven {url "https://raw.githubusercontent.com/baoya/xxrepo/master"}
    }
}

在需要用到的地方

    compile 'com.xx:loadingdialog:1.0'
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

走到无路可退

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值