Android???????????ú?Gradle??
???????????? ???????[ 2015/8/12 10:48:28 ] ??????????????? ???????
??????????????п????????飬??????????????????????????????????????????????????棬?????????????????????????????????????????Щ???????????Gradle?????????????????????о???????
????Gradle????????????????о?????????????Gradle User Guide?????????е????????????????Gradle Plugin User Guide?????????????Android????????????????о???????????????????????Щ????????????????????????????????????????????Android??????ú?Gradle?????????????????
???????Groovy????????
???????Gradle User Guide??Gradle Plugin User Guide??
??????????????????(???飬????)
?????漰????????????????????????????????????????????????е??Щ??????????Щ????????????飬?????????????Щ????????????????
????Groovy????
????Gradle????Groovy???????????Gradle?????????д?????Groovy?????????????????????????Groovy???Groovy??????JVM?????Java??????????????????????????????????Java???????????Groovy????Java?????????Groovy??Java???????????????????Java???
????Groovy??????????????????Differences with Java??IBM developerWorks????Groovy?????????????????дgradle????????а????????????????漸???????
?????????????gradle????????InputStream????import?????????ZipFile???import???????groovy???import??????????????????import.
????java.io.*
????java.lang.*
????java.math.BigDecimal
????java.math.BigInteger
????java.net.*
????java.util.*
????groovy.lang.*
????groovy.util.*
????????????${var1}???÷?????????£? ????Groovy?е?GString?????????????????????????????????????????
????def dx = tasks.findByName("dex${variant.name.capitalize()}")
????????????????????????
????//apply???????????plugin??????????'com.android.application'
????apply plugin: 'com.android.application'
????/**
????*buildscript??repositories??dependencies?????????????
????*??????????????????????????????????????????
????*??????????????????????????????
????*/
????buildscript {
????repositories {
????jcenter()
????}
????dependencies {
????classpath 'com.android.tools.build:gradle:1.2.3'
????}
????}
????//groovy?????????д?? each????????
????android.applicationVariants.each { variant ->
????}
????Gradle????
???????潲????Gradle????????????????????????????????????????Gradle User Guide??
????????????
????Gradle????????????????????????????????ú???????????Ρ?
???????????Σ???????????????setting.gradle?е?include???????????????????????????????project????????????????????????include ‘:app’?? ‘:lib1′?? ‘:lib2′
???????y?Σ??????????й????build.gradle?????????project?????????????????????????????????????????task??????????
???????н?Σ?????gradle???????????task???????????????????
??????????
????????????????????????????????
????task hello {
????doLast {
????println "hello"
????}
????}
??????????<<?滻doLast????????????????????????????鷳?????????doLast?????????????????
????task hello {
????println "hello"
????}
?????????????д????“hello” ????gradle?????y?δ???????????????д??????gradle?????н?δ????????????????д?????????????
????????task???????action list??task?????????????action list?е?action??doLast????doFirst??????????????action??doLast???action????list????棬??doFirst???action????list????檔
????????????
????????????Android?????????./gradlew build????????к?????????У????build????????????????????????????????????е????????????????????dependsOn???????????????
????task A << {println 'Hello from A'}
????task B << {println 'Hello from B'}
????task C << {println 'Hello from C'}
????B.dependsOn A
????C.dependsOn B
??????????????????????????Gradle tip #3-Task???
????????????
???????????gradle??????????????????????Щ??????????[UP-TO-DATE]????????????£?
??????Gradle?У?????task????inputs??outputs?????????????Task??????????????????????????????з????仯?????Gradle????????Task???μ?????Gradle????????У?????????????????
???????task??inputs??outputs????????????????????????????У?????????project?????property????????????????????????????????????task????????У?????????inputs??outputs?????????????????Ч????
????????????
????Gradle????????????????????統(tǒng)???????????A????A??????B??????????????????????B??????Gradle????????????????????
?????????????AAR??????????д??
????compile 'com.somepackage:LIBRARY_NAME:1.0.0@aar'
?????????д???????????????????????????????????????????????@aar?????????????????????????????????????????????pom?????packaging??????????@???????????????Artifact only notation???????????????????????????????????????????????????????????sf???????????????transitive=true???????????????????????pom????????compile??????????????”@aar”?????????????????????
??????
???·???
??????????????????
2023/3/23 14:23:39???д?ò??????????
2023/3/22 16:17:39????????????????????Щ??
2022/6/14 16:14:27??????????????????????????
2021/10/18 15:37:44???????????????
2021/9/17 15:19:29???·???????·
2021/9/14 15:42:25?????????????
2021/5/28 17:25:47??????APP??????????
2021/5/8 17:01:11