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

新的androidStudio 用最新的AndroidJunkCode版本,为啥AndroidJunkCode这个插件不生效了,代码插入不了,老版本可以 #79

Open
longkehuawei opened this issue Oct 27, 2023 · 3 comments

Comments

@longkehuawei
Copy link

AndroidJunkCode版本: classpath 'com.android.tools.build:gradle:'

gradle版本:7.2

AGP版本:7.1.3

JDK版本: 11

productFlavors配置:

androidJunkCode配置:
androidJunkCode {
def config = {
packageBase = "com.aitemaadxx.app.ui"
packageCount = 30
activityCountPerPackage = 3
excludeActivityJavaFile = false
otherCountPerPackage = 50
methodCountPerClass = 20
resPrefix = "junk_"
drawableCount = 300
stringCount = 300
}
variantConfig {
//注意:这里的debug,release为变体名称,如果没有设置productFlavors就是buildType名称,如果有设置productFlavors就是flavor+buildType,例如(freeRelease、proRelease)
debug config
release config
}
}

applicationVariants.all { variant ->

variant.outputs.all { output ->
    def newName
    newName = "${output.baseName}-V${versionName}" + "-" + buildCode+".apk"
    outputFileName = new File(newName)
    println "outputPath:" + variant.getPackageApplication().outputDirectory
}
variant.assemble.doLast {
    println "outputPath:" + variant.getPackageApplication().outputDirectory + "/output.json"
    delete "${variant.getPackageApplication().outputDirectory}/output.json"
}

}

@longkehuawei
Copy link
Author

多渠道包如何弄配置了这种,//多渠道配置
productFlavors {
aitemaad {
applicationId "com.aitemaadxx.money"
versionName "1.0.3"
versionCode 4
}
dinerosa {//主包app
applicationId "com.dineroswaxxx.cash"
versionName "1.2.2"
versionCode 14
buildConfigField "String", "channel", ""10000""

    }

@qq549631030
Copy link
Owner

variantConfig {
//注意:这里的debug,release为变体名称,如果没有设置productFlavors就是buildType名称,如果有设置productFlavors就是flavor+buildType,例如(freeRelease、proRelease)
debug config
release config
}

上面的注意里不是说的很清楚吗
debug release 要换成你的
aitemaadRelease、dinerosaRelease这样的variant name

@longkehuawei
Copy link
Author

这样是可以插入垃圾代码,遇到一个问题aab包崩溃,单独打出来的apk包不会

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

2 participants