Android Notes

maven 版本发布

1、小于 AGP7+

使用 maven 插件

groovy 复制代码
apply plugin: 'maven'
uploadArchives {
    repositories {
        mavenDeployer {
            pom.groupId = GROUP_ID
            pom.artifactId = ARTIFACT_ID
            pom.version = VERSION
            //正式版本
            repository(url: RELEASE_URL) {
    			authentication(userName: userName, password: pwd)
			}
			//快照版本
			snapshotRepository(url: SNAPSHOT_URL) {
			    authentication(userName: userName, password: pwd)
			}
        }
    }
}

2、大于等于 AGP7+

Goodle Android

使用 maven-publish 插件

groovy 复制代码
plugins {
    id 'maven-publish'
}


afterEvaluate {
    publishing {
        publications {
            release(MavenPublication) {
                from components.release
                groupId = GROUP_ID
                artifactId = ARTIFACT_ID
                version = "$sample_version"
            }
        }

        repositories {
            maven {
            	//如果仓库地址是 http,https 则不需要
                allowInsecureProtocol true
                url 'http://****/repository/primer-snapshot'
                credentials {
                    username "123456"
                    password "123456"
                }
            }
        }
    }
}

More than one file was found with OS

问题

groovy 复制代码
Execution failed for task ':app:mergeCommonReleaseNativeLibs'.
> A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
   > More than one file was found with OS independent path 'lib/x86/liblog.so'.
If you are using jniLibs and CMake IMPORTED targets,
see https://developer.android.com/studio/preview/features#automatic_packaging_of_prebuilt_dependencies_used_by_cmake

解决

groovy 复制代码
 defaultConfig {
    packagingOptions {
        exclude 'lib/x86_64/liblog.so'
        exclude 'lib/x86/liblog.so'
        exclude 'lib/arm64-v8a/liblog.so'
        exclude 'lib/armeabi-v7a/liblog.so'
    }
}

导出设备安装包

实现比较简单,前提是已安装 adb ,利用 adb pm、adb pull 命令可以实现

js 复制代码
@echo
echo Please wait while the script is executing ... ... 

for /f "tokens=2 delims=:" %%a in ('adb shell pm list packages') do (
	for /f "tokens=2 delims=:" %%p in ('adb shell pm path %%a') do (
		adb pull %%p . > null
	)
)

echo The execution is complete.
pause
相关推荐
冬奇Lab1 小时前
AMS核心机制:Activity生命周期与进程管理深度解析
android·源码阅读
西邮彭于晏2 小时前
安卓app发布
android
游戏开发爱好者83 小时前
完整教程:App上架苹果App Store全流程指南
android·ios·小程序·https·uni-app·iphone·webview
YIN_尹4 小时前
【MySQL】SQL里的“连连看”:从笛卡尔积到自连接
android·sql·mysql
bisal(Chen Liu)4 小时前
0.5 hour还是0.5 hours?
android
特立独行的猫a4 小时前
Kuikly多端框架(KMP)实战:现代Android/KMP状态管理指南:基于StateFlow与UDF架构的实践
android·架构·harmonyos·状态管理·kmp·stateflow·kuikly
范桂飓5 小时前
Google 提示词工程最佳实践白皮书解读
android·人工智能
贤泽6 小时前
Android 15 Service 源码解析
android
吴声子夜歌6 小时前
RxJava——并行编程
android·echarts·rxjava
小飞学编程...7 小时前
【Java相关八股文(二)】
android·java·开发语言