本文共 1646 字,大约阅读时间需要 5 分钟。
只写实用性
out/target/common/obj/JAVA_LIBRARIES/framework_intermediates/classes_full_debug.jar或是classes.jar
dependencies { ...}preBuild { doLast { def imlFile = file(project.name + ".iml") println('Change ' + project.name + '.iml order') try { def parsedXml = (new XmlParser()).parse(imlFile) def jdkNode = parsedXml.component[1].orderEntry.find { it.'@type' == 'jdk' } parsedXml.component[1].remove(jdkNode) def sdkString = "Android API " + android.compileSdkVersion.substring("android-".length()) + " Platform" new groovy.util.Node(parsedXml.component[1], 'orderEntry', ['type': 'jdk', 'jdkName': sdkString, 'jdkType': 'Android SDK']) groovy.xml.XmlUtil.serialize(parsedXml, new FileOutputStream(imlFile)) } catch (FileNotFoundException e) { // nop, iml not found } }}
dependencies { ... //以只读的方式打开 my_build.jar,在打包app的时候不会将其打包进去。这就解决了方法数超过64k的问题了 compileOnly files('libs/my_build.jar')}
allprojects { repositories { google() jcenter() } gradle.projectsEvaluated { tasks.withType(JavaCompile) { options.compilerArgs.add('-Xbootclasspath/p:app/libs/my_build.jar') } } // 原文链接:https://blog.csdn.net/lei1217/article/details/71627916}