Closed ihrthk closed 7 years ago
System.out.println("apply plugin is " + 'com.android.library'); project.afterEvaluate { Task assembleReleaseTask = project.tasks.findByPath("assembleRelease") if (assembleReleaseTask != null) { assembleReleaseTask.doLast { File infile = project.file("build/outputs/aar/$module-release.aar") File outfile = project.file("../componentrelease") File desFile = project.file("$module-release.aar"); project.copy { from infile into outfile rename { String fileName -> desFile.name } } System.out.println("$module-release.aar copy success "); } } }
这个是发布才会用到的,需要两个条件:一是isRunAlone设置为false,二是运行module:assembleRelease,不能运行assembleRelease,后者默认是运行app。这个规则在文章中有讲,可以再回顾一下