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 Binder(二):传递自定义对象和 AIDL 回调
android·java·android studio
androidwork2 小时前
OkHttp 3.0源码解析:从设计理念到核心实现
android·java·okhttp·kotlin
像风一样自由3 小时前
【001】frida API分类 总览
android·frida
casual_clover3 小时前
Android 之 kotlin 语言学习笔记四(Android KTX)
android·学习·kotlin
移动开发者1号4 小时前
Android 大文件分块上传实战:突破表单数据限制的完整方案
android·java·kotlin
移动开发者1号4 小时前
单线程模型中消息机制解析
android·kotlin
每次的天空7 小时前
Android第十五次面试总结(第三方组件和adb命令)
android
追随远方7 小时前
Android音频开发:Speex固定帧与变长帧编解码深度解析
android·音视频
消失的旧时光-19437 小时前
Android和硬件通信
android
0wioiw07 小时前
安卓基础(编译.Class)
android