美文网首页移动端
安卓AS 打包时分开生成32位和64位包

安卓AS 打包时分开生成32位和64位包

作者: 远在远方的风yzyfdf | 来源:发表于2021-06-24 10:54 被阅读0次

    app的gradle中

    android {
        splits {
            abi {
                enable true
                reset()
                include 'armeabi-v7a', 'arm64-v8a' //select ABIs to build APKs for
                universalApk true //generate an additional APK that contains all the ABIs
            }
        }
    
        android.applicationVariants.all { variant ->
            variant.outputs.all { output ->
                def aid = variant.applicationId.split("\\.")
                def name = aid[aid.length - 1]
                def flavor = variant.productFlavors[0].name
                def buildType = env
                def abi = output.getFilter(com.android.build.OutputFile.ABI)
                if (abi == null) abi = "all"//兼容
                def version = variant.versionName
                def versionCode = variant.versionCode
                def date = new Date()
                def formattedDate = date.format('yyyyMMdd_HHmm')
                outputFileName = "${name}" +
                        "${flavor}" +
                        "${buildType}" +
                        "${abi}" +
                        "${"v"}${version}" +
                        "${"b"}${versionCode}" +
                        "${formattedDate}.apk"
                if (variant.buildType.name == "release") {
                    variant.getPackageApplicationProvider().get().outputDirectory = new File(project.rootDir.absolutePath
                            + "/releaseOutputs")
                }
            }
        }
    }
    

    相关文章

      网友评论

        本文标题:安卓AS 打包时分开生成32位和64位包

        本文链接:https://www.haomeiwen.com/subject/zfewyltx.html