Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gradle8.0 ,想要动态配置variantConfig中的变体名称 #93

Open
x-fp opened this issue Nov 19, 2024 · 0 comments
Open

gradle8.0 ,想要动态配置variantConfig中的变体名称 #93

x-fp opened this issue Nov 19, 2024 · 0 comments

Comments

@x-fp
Copy link

x-fp commented Nov 19, 2024

AndroidJunkCode版本

gradle版本:8.0

AGP版本:8.1.1

JDK版本:17

productFlavors配置
productFlavors {
zhuntikuztk {}
zhuntikuaq {}
zhuntikucaikuai {}
zhuntikucbzg {}
zhuntikucet {}
zhuntikuccbp {}
zhuntikucfe {}
zhuntikuchs {}
zhuntikucjjs {}
zhuntikucjkjzc {}
}

androidJunkCode配置

def tempName = variant.productFlavors[0].manifestPlaceholders.ztkname
def apkName = tempName + "_" + variant.mergedFlavor.versionName + SubjectIdentificationString + appSeries + appName.trim() + IsUseLeaguePayName + OPPOLjdmType + ".apk"
outputFileName = apkName
def variantName = variant.name + ""
System.out.println("apkName==" + apkName)
System.out.println("variantName==" + variantName)

        //以下是生成垃圾代码的配置
        if (rootProject.ext.isAddRubbishCode) {
            androidJunkCode {
                def junkConfig = {
                    packageBase = "cn." + tempName + ".fgh"  //生成java类根包名
                    packageCount = 30 //生成包数量
                    activityCountPerPackage = 100 //每个包下生成Activity类数量
                    excludeActivityJavaFile = false
                    otherCountPerPackage = 200  //每个包下生成其它类的数量
                    methodCountPerClass = 200  //每个类下生成方法数量
                    resPrefix = tempName + "_"  //生成的layout、drawable、string等资源名前缀
                    drawableCount = 300  //生成drawable资源数量
                    stringCount = 300  //生成string数量
                }

                variantConfig {
                    variantName junkConfig
                }
            }
        }

bug描述
想要动态配置variantConfig里边的变体名称值,但是一直报错
No signature of method: java.lang.String.call() is applicable for argument types:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant