国产成人精品亚洲777人妖,欧美日韩精品一区视频,最新亚洲国产,国产乱码精品一区二区亚洲

您的位置:首頁技術文章
文章詳情頁

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

瀏覽:79日期:2022-09-20 13:49:53
1、創建 Android 庫

按以下步驟在項目中創建新的庫模塊:

依次點擊 File > New > New Module。 在隨即顯示的 Create New Module 窗口中,依次點擊 Android Library 和 Next。 為您的庫命名,并為庫中的代碼選擇一個最低 SDK 版本,然后點擊 Finish。 2、上傳aar包至Maven私服

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

plugins { id ’com.android.library’ // 庫模塊 id ’kotlin-android’ id ’maven’// 引入maven plugin}def snapshotVersionCode = 101def snapshotVersion = '1.0.1'/* 此處省略 android{} 相關配置 */dependencies { // 友盟基礎組件庫(所有友盟業務SDK都依賴基礎組件庫) 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選擇右側Gradle > Module Name > upload ,雙擊uploadArchives運行

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

3、其他項目使用

Project build.gradle添加 maven

allprojects { repositories {/* 此處省略了其他配置 */ maven { url ’https://dl.bintray.com/umsdk/release’ } // umeng.umsdk相關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’ 標記:-SNAPSHOT

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

以上就是Android打包上傳AAR文件到Maven倉庫的示例的詳細內容,更多關于Android打包上傳文件到Maven倉庫的資料請關注好吧啦網其它相關文章!

標簽: Android
相關文章:
主站蜘蛛池模板: 诸暨市| 丹江口市| 宁海县| 扎囊县| 长海县| 瓦房店市| 苍梧县| 咸丰县| 正宁县| 清丰县| 芜湖县| 侯马市| 柘城县| 曲阳县| 凌云县| 垫江县| 山东省| 平原县| 盐城市| 襄汾县| 喀什市| 治县。| 石楼县| 八宿县| 临清市| 万荣县| 沙坪坝区| 普安县| 中阳县| 陇南市| 永新县| 峨眉山市| 金寨县| 弋阳县| 应城市| 新平| 万安县| 南乐县| 开化县| 廉江市| 平潭县|