You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
methodGenerator = { methodBuilder ->
switch (random.nextInt(6)) {
case 0:
methodBuilder.returns(String.class)
.addParameter(Long.class, "time")
.addStatement("long now = \$T.currentTimeMillis()", System.class)
.beginControlFlow("if (time < now)")
.addStatement("return \$S", "now")
.nextControlFlow("else if (time == now)")
.addStatement("return \$S", "stop")
.nextControlFlow("else")
.addStatement("return \$S", "forwart")
.endControlFlow()
break
case 1:
methodBuilder.returns(Integer.class)
.addCode(""
+ "int total = 0;\n"
+ "for (int i = 0; i < 10; i++) {\n"
+ " total += i;\n"
+ "}\n")
.addStatement("return total")
break
case 2:
methodBuilder.returns(Boolean.class)
.addParameter(File.class, "dir")
.beginControlFlow("try")
.beginControlFlow("if (dir.exists())")
.addStatement("dir.delete()")
.addStatement("return true")
.nextControlFlow("else")
.addStatement("throw new Exception(\$S)", "Failed")
.endControlFlow()
.nextControlFlow("catch (\$T e)", Exception.class)
.addStatement("throw new \$T(e)", RuntimeException.class)
.endControlFlow()
break
case 3:
methodBuilder.returns(Date.class)
.addStatement("return new \$T()", Date.class)
break
case 4:
methodBuilder.addModifiers(Modifier.PUBLIC, Modifier.STATIC)
.returns(void.class)
.addParameter(String.class, "message")
.addStatement("\$T.out.println(message)", System.class)
break
default:
methodBuilder.addModifiers(Modifier.PUBLIC, Modifier.STATIC)
.returns(void.class)
.addParameter(String[].class, "args")
.addStatement("\$T.out.println(\$S)", System.class, "Hello")
}
}
}
variantConfig {
developTestRelease config
paysentePreReleasePre config
paysenteProdReleaseProd config
}
}
bug描述:
Failed to apply plugin 'io.github.qq549631030.android-junk-code'.
No signature of method: cn.hx.plugin.junkcode.plugin.AndroidJunkCodePlugin.IllegalArgumentException() is applicable for argument types: (String) values: [must apply this plugin after 'com.android.application']
但是我的com.android.application就是在前面
plugins {
id 'com.android.application'
id 'stringfog'
id 'com.google.gms.google-services'
id 'io.github.qq549631030.android-junk-code' version '1.3.3'
}
The text was updated successfully, but these errors were encountered:
AndroidJunkCode版本:1.3.3
gradle版本:7.2
AGP版本:4.2.2
JDK版本:11
productFlavors配置:
productFlavors {
developDev {
dimension "SolesPresta"
}
androidJunkCode配置:
androidJunkCode {
def config = {
//注意:这里的release是变体名称,如果没有设置productFlavors就是buildType名称,如果有设置productFlavors就是flavor+buildType,例如(freeRelease、proRelease)
packageBase = "com.v.c.ui" //生成java类根包名
resPrefix = "k_" //生成的layout、drawable、string等资源名前缀
packageCount = 2 //生成包数量
activityCountPerPackage = 4 //每个包下生成Activity类数量
excludeActivityJavaFile = false
//是否排除生成Activity的Java文件,默认false(layout和写入AndroidManifest.xml还会执行),主要用于处理类似神策全埋点编译过慢问题
otherCountPerPackage = 2 //每个包下生成其它类的数量
methodCountPerClass = 2 //每个类下生成方法数量
drawableCount = 40 //生成drawable资源数量
stringCount = 50 //生成string数量
}
bug描述:
The text was updated successfully, but these errors were encountered: