Android Studio 打包module (包含第三方库) 发布到Github 以及遇到的一些问题

499 阅读1分钟

1, 在module里面头部 加入apply plugin: 'maven'


2,在module 底部加入  

uploadArchives {    
   repositories.mavenDeployer { 
      
   def mavenDirPath = file('D:\\work\\code_manager\\jack\\Tex\\test')
      
    repository(url: "file://${mavenDirPath.absolutePath}")    
    pom.project {          
    groupId "com.github.jack"       
    artifactId "test"          
    version "1.0.0"     
   } 
   }}


a, mavenDirPath 为项目 lib地址 

3,在 Android studio 的 Terminal 执行 

 gradlew : Your module Name :uploadArchives

  中间为你module 名字


成功了 ---  失败 就看看你 module 写错没得  ---第一次 会下载很多东西

mavenDirPath  设置的地址里面会多出 一些文件来


4,上传都github ----


取出最上面的链接:   github.com/hyyz3293/Ga… ---当然是你的链接哈

拷贝下来,在你需要使用这个moudle的项目中,在他的根目录里加入

maven {    url "https://raw.githubusercontent.com/hyyz3293/GarbageSorting /master"}

implementation 'com.github.jack:test:1.0.1'


错误 ----下面写法 才不会 类冲突




implementation group: 'com.android.support', name: 'appcompat-v7', version: '26.1.0'
implementation group: 'org.java-websocket', name: 'Java-WebSocket', version: '1.4.0'
implementation group: 'com.google.code.gson', name: 'gson', version: '2.8.5'