admin管理员组

文章数量:1530020

马甲包:意指对一个app包,通过改变其UI、样式,保留大部分功能及结构而构造出一个新的不同的app,就叫马甲包(意思是换个马甲)

接入:在app的build.gradle中加入以下代码:

flavorDimensions 'product'
    productFlavors {
        def productPath = "../products.txt"
        file(productPath).eachLine { line ->
            if (line != "" && !line.startsWith("#")) {
                String[] str = line.split(",")
                if (str.length >= 4) {
//                    def signing = str[2] == "kedui" ? signingConfigs.release : signingConfigs.dubug
                    "${str[0]}" {
                        dimension = 'product'
                        applicationId = str[1]
//                        signingConfig = signing
                        manifestPlaceholders = [productValue : str[0],
                                                appNameValue : str[4],
                                                JPUSH_PKGNAME: applicationId,
                        ]
                        matchingFallbacks = ['jiaoyou']
                    }
                }

            }
        }
        project.dependencies.add("implementation", project(":resources"))

    }

其中products文件为:

#product,package name,bugliId,appname
jiaoyou,tv.kedui.jiaoyou,jiaoyou,11101,可对
ailiao,tv.kedui.ailiao,ailiao,11102,爱聊

然后在勾选变体,即可打出对应的马甲包:

 遇到的问题:

 问题1:Execution failed for task ‘:app:processAppgalleryconnectLatestDebugAGCPlugin’ ERROR: Failed to verify AGConnect-Config ’/client/package_name‘,excepted 'xxx',but was 'xxx'

解决:[Solved] Execution failed for task ':app:processAppgalleryconnectLatestDebugAGCPlugin' ERROR: Failed to verify AGConnect-Config - Exception Error

受这篇文章启发,想到可能在项目中哪里写死了包名,导致变体打包时包名无法更新,后进行排查,果然发现在一个json配置文件中发现了写死的包名,通过修改此处包名解决了这个问题

问题2:

打包成功后,发现与手机上安装的另一个马甲包不兼容,无法安装,后来经过排查发现也是在清单文件里的provider的android:authorities写死了包名导致,修改后就可以了

本文标签: 马甲过程