最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

Android打包上傳AAR文件到Maven倉庫的示例

 更新時間:2021年03月22日 10:01:52   作者:李大騰騰  
這篇文章主要介紹了Android打包上傳AAR文件到Maven倉庫的示例,幫助大家更好的理解和學(xué)習(xí)使用Android開發(fā),感興趣的朋友可以了解下

1、創(chuàng)建 Android 庫

按以下步驟在項目中創(chuàng)建新的庫模塊:

  1. 依次點擊 File > New > New Module。
  2. 在隨即顯示的 Create New Module 窗口中,依次點擊 Android Library 和 Next。
  3. 為您的庫命名,并為庫中的代碼選擇一個最低 SDK 版本,然后點擊 Finish。

2、上傳aar包至Maven私服

打開新模塊 build.gradle 文件,按如下說明修改:

plugins {
  id 'com.android.library'  // 庫模塊
  id 'kotlin-android'   
  id 'maven'			// 引入maven plugin
}

def snapshotVersionCode = 101
def snapshotVersion = "1.0.1"

/* 此處省略 android{} 相關(guān)配置 */

dependencies {
  // 友盟基礎(chǔ)組件庫(所有友盟業(yè)務(wù)SDK都依賴基礎(chǔ)組件庫)
  implementation "com.umeng.umsdk:common:9.3.6"
  implementation "com.umeng.umsdk:asms:1.2.0"
  implementation "com.umeng.umsdk:apm:1.1.1"
}

/*快照版 maven上傳*/
uploadArchives {
  configuration = configurations.archives
  repositories {
    mavenDeployer {
      repository(url: 'http://nexus.xxxxx.com/repository/maven-snapshots') {
        authentication(userName: 'userNameXXXX', password: 'passwordXXXXX')
      }

      pom.project {
        version snapshotVersion + '-SNAPSHOT'
        artifactId 'lib-umeng'
        groupId 'com.xxxxx'
        packaging 'aar'
        description 'lib-umeng Initial submission'
      }
    }
  }
}

上傳aar 到maven
選擇右側(cè)Gradle > Module Name > upload ,雙擊uploadArchives運行

3、其他項目使用

Project build.gradle添加 maven

allprojects {
  repositories {

	/* 此處省略了其他配置 */
   
    maven { url 'https://dl.bintray.com/umsdk/release' }  // umeng.umsdk相關(guān)maven
    maven { url 'https://nexus.xxxxx.com/repository/maven-snapshots' }  // 剛剛aar上傳的maven
  }
}

Module 中引用,build.gradle添加如下引用

dependencies {
  api ('com.xxxxx:lib-umeng:1.0.1-SNAPSHOT@aar') {		// 剛剛生成的aar
    implementation "com.umeng.umsdk:common:9.3.6"		// 注意,aar implementation的依賴需要重新引用
    implementation "com.umeng.umsdk:asms:1.2.0"
    implementation "com.umeng.umsdk:apm:1.1.1"
  }
}

4、QA

maven上傳報錯:

Execution failed for task ':lib-umeng:uploadArchives'.
\> Could not publish configuration 'archives'
 \> Failed to deploy artifacts: Could not transfer artifact com.xxxxx:lib-umeng:aar:1.0.1 from/to remote (http://nexus.xxxxx.asia/repository/maven-snapshots): Failed to transfer file: http://nexus.xxxxx.asia/repository/maven-snapshots/com/xxxxx/lib-umeng/1.0.1/lib-umeng-1.0.1.aar. Return code is: 400, ReasonPhrase: Repository version policy: SNAPSHOT does not allow version: 1.0.1.

解決:version snapshotVersion + '-SNAPSHOT' 標(biāo)記:-SNAPSHOT

參考:developer.android.com/studio/proj…

以上就是Android打包上傳AAR文件到Maven倉庫的示例的詳細(xì)內(nèi)容,更多關(guān)于Android打包上傳文件到Maven倉庫的資料請關(guān)注腳本之家其它相關(guān)文章!

相關(guān)文章

最新評論

滨海县| 类乌齐县| 南宫市| 齐河县| 正蓝旗| 大方县| 和平县| 百色市| 大关县| 久治县| 靖州| 额尔古纳市| 辽宁省| 屯留县| 赤城县| 伊通| 大渡口区| 马关县| 自治县| 中宁县| 高陵县| 大关县| 玉山县| 白银市| 略阳县| 正安县| 阳新县| 乌拉特前旗| 清远市| 徐水县| 巨野县| 腾冲县| 外汇| 江安县| 绩溪县| 柳林县| 芒康县| 滨州市| 旬邑县| 鄂州市| 宁强县|