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
相关推荐
贤泽2 小时前
Android 15 Lock Task 模式深度分析(第二部分)
android
huohuopro2 小时前
Vue3 Webview 转 Android 虚拟导航栏遮挡问题记录
android·vue
zh_xuan2 小时前
kotlin 挂起函数
android·开发语言·kotlin
贤泽3 小时前
Android 15 Lock Task 模式深度分析(第一部分)
android
zh_xuan3 小时前
kotlin launch函数
android·kotlin·协程·launch
贤泽4 小时前
android 15 AOSP Broadcast 广播机制源码分析
android·aosp
啥都想学点4 小时前
第1天:搭建 flutter 和 Android 环境
android·flutter
huohuopro4 小时前
Android WebView 输入法同步问题解决方案
android
草莓熊Lotso4 小时前
Ext 系列文件系统核心:块、分区、inode 与块组结构详解
android·linux·c语言·开发语言·c++·人工智能·文件
桂花很香,旭很美5 小时前
ADB 安卓实战手册
android·adb