├── app
├── .gitignore
├── src
│ └── main
│ │ ├── res
│ │ ├── values
│ │ │ ├── strings.xml
│ │ │ ├── colors.xml
│ │ │ ├── dimens.xml
│ │ │ └── styles.xml
│ │ ├── mipmap-hdpi
│ │ │ └── ic_launcher.png
│ │ ├── mipmap-mdpi
│ │ │ └── ic_launcher.png
│ │ ├── mipmap-xhdpi
│ │ │ └── ic_launcher.png
│ │ ├── mipmap-xxhdpi
│ │ │ └── ic_launcher.png
│ │ ├── mipmap-xxxhdpi
│ │ │ └── ic_launcher.png
│ │ ├── values-w820dp
│ │ │ └── dimens.xml
│ │ └── layout
│ │ │ └── activity_main.xml
│ │ ├── java
│ │ └── com
│ │ │ └── example
│ │ │ └── gradle_config
│ │ │ ├── BaseApplication.java
│ │ │ └── MainActivity.kt
│ │ └── AndroidManifest.xml
├── proguard-rules.pro
├── google-services.json
├── build.gradle
└── app.iml
├── mylib
├── .gitignore
├── src
│ └── main
│ │ ├── res
│ │ └── values
│ │ │ └── strings.xml
│ │ └── AndroidManifest.xml
├── proguard-rules.pro
├── build.gradle
└── mylib.iml
├── Modularization1
├── .gitignore
├── consumer-rules.pro
├── src
│ └── main
│ │ └── AndroidManifest.xml
├── proguard-rules.pro
└── build.gradle
├── Modularization2
├── .gitignore
├── consumer-rules.pro
├── src
│ └── main
│ │ └── AndroidManifest.xml
├── proguard-rules.pro
└── build.gradle
├── includedBuild
├── .gitignore
├── src
│ └── main
│ │ └── java
│ │ └── me
│ │ └── hacket
│ │ └── deps
│ │ ├── DependenciesPlugin.kt
│ │ └── Config.kt
├── build.gradle.kts
└── build-backup.gradle
├── testBuildTypeFlavor
├── .gitignore
├── consumer-rules.pro
├── src
│ ├── main
│ │ ├── AndroidManifest.xml
│ │ └── java
│ │ │ └── com
│ │ │ └── example
│ │ │ └── mylibrary
│ │ │ ├── ILogin.kt
│ │ │ └── ICrash.kt
│ ├── huawei
│ │ └── java
│ │ │ └── com
│ │ │ └── example
│ │ │ └── mylibrary
│ │ │ └── LoginImpl.kt
│ ├── google
│ │ └── java
│ │ │ └── com
│ │ │ └── example
│ │ │ └── mylibrary
│ │ │ └── LoginImpl.kt
│ ├── release
│ │ └── java
│ │ │ └── com
│ │ │ └── example
│ │ │ └── mylibrary
│ │ │ └── crash
│ │ │ └── CrashImpl.kt
│ └── debug
│ │ └── java
│ │ └── com
│ │ └── example
│ │ └── mylibrary
│ │ └── crash
│ │ └── CrashImpl.kt
├── proguard-rules.pro
└── build.gradle
├── ComposingBuildTest
├── .gitignore
├── src
│ └── main
│ │ ├── res
│ │ ├── mipmap-hdpi
│ │ │ └── ic_launcher.png
│ │ ├── mipmap-mdpi
│ │ │ └── ic_launcher.png
│ │ ├── mipmap-xhdpi
│ │ │ └── ic_launcher.png
│ │ ├── mipmap-xxhdpi
│ │ │ └── ic_launcher.png
│ │ ├── mipmap-xxxhdpi
│ │ │ └── ic_launcher.png
│ │ ├── values-w820dp
│ │ │ └── dimens.xml
│ │ └── layout
│ │ │ └── activity_main.xml
│ │ └── AndroidManifest.xml
├── proguard-rules.pro
├── build.gradle
└── app.iml
├── plugins
├── pgyer_dingtalk
│ ├── .gitignore
│ ├── src
│ │ └── main
│ │ │ ├── resources
│ │ │ └── META-INF
│ │ │ │ └── gradle-plugins
│ │ │ │ └── dingPgyerPlugin.properties
│ │ │ └── groovy
│ │ │ └── me
│ │ │ └── hacket
│ │ │ └── plugins
│ │ │ ├── dingtalk
│ │ │ ├── api
│ │ │ │ ├── DingResponse.groovy
│ │ │ │ ├── SendToDingTalkHelper.groovy
│ │ │ │ └── DingRequest.groovy
│ │ │ └── task
│ │ │ │ └── SendBuildResultToDingTalkTask.groovy
│ │ │ ├── Constants.groovy
│ │ │ ├── pgyer
│ │ │ ├── api
│ │ │ │ ├── PgyerRequest.groovy
│ │ │ │ ├── PgyerResponse.groovy
│ │ │ │ └── UploadApkToPgyerHelper.groovy
│ │ │ └── task
│ │ │ │ └── PgyUploadApkTask.groovy
│ │ │ ├── DingPgyerExtension.groovy
│ │ │ ├── DingPgyerPlugin.groovy
│ │ │ └── utils
│ │ │ ├── Utils.groovy
│ │ │ └── Jenkins.groovy
│ └── build.gradle
└── switch_module_dependency
│ ├── module_dependency.json
│ └── module_dependency.gradle
├── debug.keystore
├── hacket.keystore
├── repo
└── me
│ └── hacket
│ ├── Modularization1
│ ├── maven-metadata.xml.md5
│ ├── 1.0.0
│ │ ├── Modularization1-1.0.0.aar.md5
│ │ ├── Modularization1-1.0.0.pom.md5
│ │ ├── Modularization1-1.0.0.module.md5
│ │ ├── Modularization1-1.0.0.aar.sha1
│ │ ├── Modularization1-1.0.0.pom.sha1
│ │ ├── Modularization1-1.0.0.module.sha1
│ │ ├── Modularization1-1.0.0.aar.sha256
│ │ ├── Modularization1-1.0.0.pom.sha256
│ │ ├── Modularization1-1.0.0.module.sha256
│ │ ├── Modularization1-1.0.0.aar
│ │ ├── Modularization1-1.0.0.aar.sha512
│ │ ├── Modularization1-1.0.0.pom.sha512
│ │ ├── Modularization1-1.0.0.module.sha512
│ │ ├── Modularization1-1.0.0.pom
│ │ └── Modularization1-1.0.0.module
│ ├── maven-metadata.xml.sha1
│ ├── maven-metadata.xml.sha256
│ ├── maven-metadata.xml.sha512
│ └── maven-metadata.xml
│ ├── Modularization2
│ ├── maven-metadata.xml.md5
│ ├── 1.0.0
│ │ ├── Modularization2-1.0.0.aar.md5
│ │ ├── Modularization2-1.0.0.pom.md5
│ │ ├── Modularization2-1.0.0.module.md5
│ │ ├── Modularization2-1.0.0.aar.sha1
│ │ ├── Modularization2-1.0.0.pom.sha1
│ │ ├── Modularization2-1.0.0.module.sha1
│ │ ├── Modularization2-1.0.0.aar.sha256
│ │ ├── Modularization2-1.0.0.pom.sha256
│ │ ├── Modularization2-1.0.0.module.sha256
│ │ ├── Modularization2-1.0.0.aar
│ │ ├── Modularization2-1.0.0.aar.sha512
│ │ ├── Modularization2-1.0.0.pom.sha512
│ │ ├── Modularization2-1.0.0.module.sha512
│ │ ├── Modularization2-1.0.0.pom
│ │ └── Modularization2-1.0.0.module
│ ├── maven-metadata.xml.sha1
│ ├── maven-metadata.xml.sha256
│ ├── maven-metadata.xml.sha512
│ └── maven-metadata.xml
│ └── composingbuild
│ ├── maven-metadata.xml.md5
│ ├── maven-metadata.xml.sha1
│ ├── 1.0.0
│ ├── composingbuild-1.0.0.jar.md5
│ ├── composingbuild-1.0.0.pom.md5
│ ├── composingbuild-1.0.0.module.md5
│ ├── composingbuild-1.0.0.jar.sha1
│ ├── composingbuild-1.0.0.module.sha1
│ ├── composingbuild-1.0.0.pom.sha1
│ ├── composingbuild-1.0.0.jar.sha256
│ ├── composingbuild-1.0.0.pom.sha256
│ ├── composingbuild-1.0.0.module.sha256
│ ├── composingbuild-1.0.0.jar
│ ├── composingbuild-1.0.0.jar.sha512
│ ├── composingbuild-1.0.0.module.sha512
│ ├── composingbuild-1.0.0.pom.sha512
│ ├── composingbuild-1.0.0.pom
│ └── composingbuild-1.0.0.module
│ ├── maven-metadata.xml.sha256
│ ├── maven-metadata.xml.sha512
│ └── maven-metadata.xml
├── imgs
└── dingtalk_pgyer.jpg
├── gradle
└── wrapper
│ ├── gradle-wrapper.jar
│ └── gradle-wrapper.properties
├── tips
├── 06_加速gradle编译
│ ├── img
│ │ ├── gradle_config1.png
│ │ └── gradle_config2.png
│ └── README.md
├── 03_gradle代理
│ └── README.md
├── buildSrc_composingbuild
│ └── buildSrc和composingBuild.md
├── 04_dex突破65535的限制
│ └── README.md
├── 07_compile, provided, apk
│ └── README.md
├── 02_gradle自带变量和引用属性值
│ └── README.md
├── 01_gradle_custom_property
│ └── README.md
└── 05_gradle依赖的统一管理
│ └── README.md
├── settings.gradle
├── .gitignore
├── Gradle-config.iml
├── config.gradle
├── gradle.properties
├── gradlew.bat
├── README.md
├── initgradle
└── init.gradle
├── gradlew
└── LICENSE
/app/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/mylib/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/Modularization1/.gitignore:
--------------------------------------------------------------------------------
1 | /build
--------------------------------------------------------------------------------
/Modularization2/.gitignore:
--------------------------------------------------------------------------------
1 | /build
--------------------------------------------------------------------------------
/Modularization1/consumer-rules.pro:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/Modularization2/consumer-rules.pro:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/includedBuild/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/testBuildTypeFlavor/.gitignore:
--------------------------------------------------------------------------------
1 | /build
--------------------------------------------------------------------------------
/testBuildTypeFlavor/consumer-rules.pro:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/ComposingBuildTest/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/plugins/pgyer_dingtalk/.gitignore:
--------------------------------------------------------------------------------
1 | /build
--------------------------------------------------------------------------------
/debug.keystore:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hacket/gradle-tips/HEAD/debug.keystore
--------------------------------------------------------------------------------
/hacket.keystore:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hacket/gradle-tips/HEAD/hacket.keystore
--------------------------------------------------------------------------------
/repo/me/hacket/Modularization1/maven-metadata.xml.md5:
--------------------------------------------------------------------------------
1 | 1f2339dff39c0d858b44695ad001e308
--------------------------------------------------------------------------------
/repo/me/hacket/Modularization2/maven-metadata.xml.md5:
--------------------------------------------------------------------------------
1 | 9f7af5ebaebb4f62462667838b7ed21a
--------------------------------------------------------------------------------
/repo/me/hacket/composingbuild/maven-metadata.xml.md5:
--------------------------------------------------------------------------------
1 | 9201df2de6ab233f0dc24cba26b84d8d
--------------------------------------------------------------------------------
/repo/me/hacket/composingbuild/maven-metadata.xml.sha1:
--------------------------------------------------------------------------------
1 | 80e9ba93e24f372f0d008a50679a5f9ca08bd4a5
--------------------------------------------------------------------------------
/repo/me/hacket/Modularization1/1.0.0/Modularization1-1.0.0.aar.md5:
--------------------------------------------------------------------------------
1 | 8ed2966de9ce191dc8f35720269b2a2a
--------------------------------------------------------------------------------
/repo/me/hacket/Modularization1/1.0.0/Modularization1-1.0.0.pom.md5:
--------------------------------------------------------------------------------
1 | 9c8fb372c53aed95c26d00ce96db594b
--------------------------------------------------------------------------------
/repo/me/hacket/Modularization1/maven-metadata.xml.sha1:
--------------------------------------------------------------------------------
1 | 59040ddfc5e29a87bfc5505336e547aa2cdff1e1
--------------------------------------------------------------------------------
/repo/me/hacket/Modularization2/1.0.0/Modularization2-1.0.0.aar.md5:
--------------------------------------------------------------------------------
1 | 9b6783e7caa5b6d758e3afb7bd838157
--------------------------------------------------------------------------------
/repo/me/hacket/Modularization2/1.0.0/Modularization2-1.0.0.pom.md5:
--------------------------------------------------------------------------------
1 | f5a3df802b720b851d993f7add514b39
--------------------------------------------------------------------------------
/repo/me/hacket/Modularization2/maven-metadata.xml.sha1:
--------------------------------------------------------------------------------
1 | ee5712bdd4ba9c69e9e3fd0ef859549172adf13c
--------------------------------------------------------------------------------
/repo/me/hacket/composingbuild/1.0.0/composingbuild-1.0.0.jar.md5:
--------------------------------------------------------------------------------
1 | 3c2fd431e49a86571054f5215957e61b
--------------------------------------------------------------------------------
/repo/me/hacket/composingbuild/1.0.0/composingbuild-1.0.0.pom.md5:
--------------------------------------------------------------------------------
1 | b5ef9182bc026563f5e00d98edc75924
--------------------------------------------------------------------------------
/imgs/dingtalk_pgyer.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hacket/gradle-tips/HEAD/imgs/dingtalk_pgyer.jpg
--------------------------------------------------------------------------------
/repo/me/hacket/Modularization1/1.0.0/Modularization1-1.0.0.module.md5:
--------------------------------------------------------------------------------
1 | 0b60b72b64c3f2a12c5699f5f16a1722
--------------------------------------------------------------------------------
/repo/me/hacket/Modularization2/1.0.0/Modularization2-1.0.0.module.md5:
--------------------------------------------------------------------------------
1 | 4606a4122939d9321af312e5658444d9
--------------------------------------------------------------------------------
/repo/me/hacket/composingbuild/1.0.0/composingbuild-1.0.0.module.md5:
--------------------------------------------------------------------------------
1 | b549d493ddf65f3480fb979915d3b08c
--------------------------------------------------------------------------------
/repo/me/hacket/Modularization1/1.0.0/Modularization1-1.0.0.aar.sha1:
--------------------------------------------------------------------------------
1 | 29775732a449856efc25118886311aa0218bad3b
--------------------------------------------------------------------------------
/repo/me/hacket/Modularization1/1.0.0/Modularization1-1.0.0.pom.sha1:
--------------------------------------------------------------------------------
1 | 180a09e6f14045c9b99725b657adbf8021ca3567
--------------------------------------------------------------------------------
/repo/me/hacket/Modularization2/1.0.0/Modularization2-1.0.0.aar.sha1:
--------------------------------------------------------------------------------
1 | c8190dc67dea7a78c92441968b4c35a98c8e9384
--------------------------------------------------------------------------------
/repo/me/hacket/Modularization2/1.0.0/Modularization2-1.0.0.pom.sha1:
--------------------------------------------------------------------------------
1 | 41ee66f891f21e4167107b457265c392733e1f33
--------------------------------------------------------------------------------
/repo/me/hacket/composingbuild/1.0.0/composingbuild-1.0.0.jar.sha1:
--------------------------------------------------------------------------------
1 | 2f2c4d0b6532b96f65ee06c3a3ea226ebb7a5430
--------------------------------------------------------------------------------
/repo/me/hacket/composingbuild/1.0.0/composingbuild-1.0.0.module.sha1:
--------------------------------------------------------------------------------
1 | 0768b68b2c256a886f10d5e188e06ec4dac63d36
--------------------------------------------------------------------------------
/repo/me/hacket/composingbuild/1.0.0/composingbuild-1.0.0.pom.sha1:
--------------------------------------------------------------------------------
1 | b2c177e0494d1512b60f100474fc71c915fa7abb
--------------------------------------------------------------------------------
/repo/me/hacket/Modularization1/1.0.0/Modularization1-1.0.0.module.sha1:
--------------------------------------------------------------------------------
1 | 8251d772a3ad8c705de959d179e858f3256448c7
--------------------------------------------------------------------------------
/repo/me/hacket/Modularization2/1.0.0/Modularization2-1.0.0.module.sha1:
--------------------------------------------------------------------------------
1 | 763b79eced5e866d65a28656f4a9c3c96d6e6c76
--------------------------------------------------------------------------------
/mylib/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | Mylib
3 |
4 |
--------------------------------------------------------------------------------
/app/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | Gradle-config
3 |
4 |
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hacket/gradle-tips/HEAD/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/repo/me/hacket/Modularization1/maven-metadata.xml.sha256:
--------------------------------------------------------------------------------
1 | 12ea4fea771c1deac73bdbc6860c4386f749a5d1e9196d8bb5b167cafbb38e99
--------------------------------------------------------------------------------
/repo/me/hacket/Modularization2/maven-metadata.xml.sha256:
--------------------------------------------------------------------------------
1 | 628e91dcd2f3ccc830806fd96a7c475b0aa24d797e32c6bb21b5146044bf8e4e
--------------------------------------------------------------------------------
/repo/me/hacket/composingbuild/maven-metadata.xml.sha256:
--------------------------------------------------------------------------------
1 | 44652f593afda92736840bcdc50939564b67ae62b3a8ed470094d1479ce916eb
--------------------------------------------------------------------------------
/repo/me/hacket/Modularization1/1.0.0/Modularization1-1.0.0.aar.sha256:
--------------------------------------------------------------------------------
1 | 83afd3664fa19aa9d4876affee2cf2887d6d34c801a0248c93ca196c9556df32
--------------------------------------------------------------------------------
/repo/me/hacket/Modularization1/1.0.0/Modularization1-1.0.0.pom.sha256:
--------------------------------------------------------------------------------
1 | 0a0bc4bcfdc64d34b49a473a2bbd70fe79b6bec02f8b360bf6c4160233fa3804
--------------------------------------------------------------------------------
/repo/me/hacket/Modularization2/1.0.0/Modularization2-1.0.0.aar.sha256:
--------------------------------------------------------------------------------
1 | ad93b957e3a41666ed8c80391aa0421b44dcf93e71cd49598af2db597879cafd
--------------------------------------------------------------------------------
/repo/me/hacket/Modularization2/1.0.0/Modularization2-1.0.0.pom.sha256:
--------------------------------------------------------------------------------
1 | 4ecccfd40516ee978f39ab22909d01801785afb3c494b061a0ed97f1929b9490
--------------------------------------------------------------------------------
/repo/me/hacket/composingbuild/1.0.0/composingbuild-1.0.0.jar.sha256:
--------------------------------------------------------------------------------
1 | 9abc6cdc8c0e979cc8c445a7cdf9601d2e9a869620fc6b06f07844fbb942f46c
--------------------------------------------------------------------------------
/repo/me/hacket/composingbuild/1.0.0/composingbuild-1.0.0.pom.sha256:
--------------------------------------------------------------------------------
1 | ccd351fc3123a1640d52f8e6e113b1c422b1d0b54cd509914291a7d921ac1bf5
--------------------------------------------------------------------------------
/repo/me/hacket/Modularization1/1.0.0/Modularization1-1.0.0.module.sha256:
--------------------------------------------------------------------------------
1 | 9107b8056c5c90190a43173cbc52f67c598a7af97a769dc2be48342a1951ef71
--------------------------------------------------------------------------------
/repo/me/hacket/Modularization2/1.0.0/Modularization2-1.0.0.module.sha256:
--------------------------------------------------------------------------------
1 | a5f269836f1435496caff5e965d580ca6cda89e553436a72bf9a810f8d412eaf
--------------------------------------------------------------------------------
/repo/me/hacket/composingbuild/1.0.0/composingbuild-1.0.0.module.sha256:
--------------------------------------------------------------------------------
1 | 4682c37eaae15e427d02cb3e7297403bf07e4b321c3365d72aa606fa48fddebb
--------------------------------------------------------------------------------
/tips/06_加速gradle编译/img/gradle_config1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hacket/gradle-tips/HEAD/tips/06_加速gradle编译/img/gradle_config1.png
--------------------------------------------------------------------------------
/tips/06_加速gradle编译/img/gradle_config2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hacket/gradle-tips/HEAD/tips/06_加速gradle编译/img/gradle_config2.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hacket/gradle-tips/HEAD/app/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hacket/gradle-tips/HEAD/app/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hacket/gradle-tips/HEAD/app/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hacket/gradle-tips/HEAD/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hacket/gradle-tips/HEAD/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/plugins/pgyer_dingtalk/src/main/resources/META-INF/gradle-plugins/dingPgyerPlugin.properties:
--------------------------------------------------------------------------------
1 | implementation-class=me.hacket.plugins.DingPgyerPlugin
--------------------------------------------------------------------------------
/ComposingBuildTest/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hacket/gradle-tips/HEAD/ComposingBuildTest/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/ComposingBuildTest/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hacket/gradle-tips/HEAD/ComposingBuildTest/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/ComposingBuildTest/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hacket/gradle-tips/HEAD/ComposingBuildTest/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/ComposingBuildTest/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hacket/gradle-tips/HEAD/ComposingBuildTest/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/ComposingBuildTest/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hacket/gradle-tips/HEAD/ComposingBuildTest/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/repo/me/hacket/Modularization1/1.0.0/Modularization1-1.0.0.aar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hacket/gradle-tips/HEAD/repo/me/hacket/Modularization1/1.0.0/Modularization1-1.0.0.aar
--------------------------------------------------------------------------------
/repo/me/hacket/Modularization2/1.0.0/Modularization2-1.0.0.aar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hacket/gradle-tips/HEAD/repo/me/hacket/Modularization2/1.0.0/Modularization2-1.0.0.aar
--------------------------------------------------------------------------------
/repo/me/hacket/composingbuild/1.0.0/composingbuild-1.0.0.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hacket/gradle-tips/HEAD/repo/me/hacket/composingbuild/1.0.0/composingbuild-1.0.0.jar
--------------------------------------------------------------------------------
/repo/me/hacket/composingbuild/maven-metadata.xml.sha512:
--------------------------------------------------------------------------------
1 | 95ef084f293a6a470d43dfc208e3b89a9e1a813ab2e27d906d1f369bc96802540e75094e3b1c13e4542b3fd8f171d81687a1d177ddf4ce34a39151c46b16d6c9
--------------------------------------------------------------------------------
/repo/me/hacket/Modularization1/maven-metadata.xml.sha512:
--------------------------------------------------------------------------------
1 | 838c38e53f909fd8b812eb44c6b5663b9b35b776ee2024c44cda6362aca56eb516d75ceea9ef8f4c5c8a6ceb9741514aee26e7d5de6d0e055d4f2eb6e9fdfe9a
--------------------------------------------------------------------------------
/repo/me/hacket/Modularization2/maven-metadata.xml.sha512:
--------------------------------------------------------------------------------
1 | 575182b09d89f8e21bdce196a2db5b3613579a423f241fbb160af132c0c2550ac59cc4bb82cd3ae9cfd295086dab828a2d48862b883799c9335566f3a315de49
--------------------------------------------------------------------------------
/repo/me/hacket/Modularization1/1.0.0/Modularization1-1.0.0.aar.sha512:
--------------------------------------------------------------------------------
1 | a3f87e4ae616b66539a406caa0158d25f1e26ae08a57cbdf2f27c01baa40b078a94f09dff704fe440fdbf52ed0045da181a8815fa30b8fe66e408099825a4cbf
--------------------------------------------------------------------------------
/repo/me/hacket/Modularization1/1.0.0/Modularization1-1.0.0.pom.sha512:
--------------------------------------------------------------------------------
1 | 85cb333ddc066a087434320c4c73b4fc7aa49eb55a276a498b7d05343602f646b892fd3a51ef4a52edde64aefd593c15d4ff3e3c1c36ee75668470d5d4ba3791
--------------------------------------------------------------------------------
/repo/me/hacket/Modularization2/1.0.0/Modularization2-1.0.0.aar.sha512:
--------------------------------------------------------------------------------
1 | 8a50af3d79e22f965a206e2d8260f83f23a0a1176e3878e59003e5a3be57ae9ee3fcabe0168326fbc1db9f400a2da62df0d93839cc56d7c4bf6c4c61b7f38b94
--------------------------------------------------------------------------------
/repo/me/hacket/Modularization2/1.0.0/Modularization2-1.0.0.pom.sha512:
--------------------------------------------------------------------------------
1 | bef2dc3b9e84208286c276458731303325217a50433060d8ef95059362f411e6bdf749ca5282112497f0aa4c07898bc05ff73ddb173cd3e98707296d01824c9e
--------------------------------------------------------------------------------
/repo/me/hacket/composingbuild/1.0.0/composingbuild-1.0.0.jar.sha512:
--------------------------------------------------------------------------------
1 | c6f9e82ea4823e0950342e8ddfd9fb7a7e3d73d7b43e007293808f6ba2cc9122583b76a99047ce3da4d32de1869d28381512e2c700a770a2bdc0d0b4c06e92d1
--------------------------------------------------------------------------------
/repo/me/hacket/composingbuild/1.0.0/composingbuild-1.0.0.module.sha512:
--------------------------------------------------------------------------------
1 | c8cd698c3596dedb6952df64a0640c016f6a7f6da94886158b4b1685d840ffe49ad1cb797562842defcec73a2fc2d4bdbe81625aeff6cbebcfa3e65cbb01af46
--------------------------------------------------------------------------------
/repo/me/hacket/composingbuild/1.0.0/composingbuild-1.0.0.pom.sha512:
--------------------------------------------------------------------------------
1 | be56d62abc886a034d1659f5ce4e07f01c7ea3a8780070dc2c1f28b128385459d3c49c708e402472a1b9fbe033dfb0eecb677e7db22e0981486d0a45a8c06702
--------------------------------------------------------------------------------
/repo/me/hacket/Modularization1/1.0.0/Modularization1-1.0.0.module.sha512:
--------------------------------------------------------------------------------
1 | 918720be3078ecd2930789a30c6f1090cf221a42cc32b315ff1f50bf0400f5da6ab0d30bd12f47182ec97834eef3153e3bca4cd9c5bb5a252229b0ca96a7d063
--------------------------------------------------------------------------------
/repo/me/hacket/Modularization2/1.0.0/Modularization2-1.0.0.module.sha512:
--------------------------------------------------------------------------------
1 | 723f05270c1f1257111b1c16a67f6ff401a7c8a46944782110940a40f5ed1bfbace53444980b985d3d96832a879f4448ccd8c78c8f3a78b704659665b765862e
--------------------------------------------------------------------------------
/testBuildTypeFlavor/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/Modularization1/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
--------------------------------------------------------------------------------
/Modularization2/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
--------------------------------------------------------------------------------
/ComposingBuildTest/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/testBuildTypeFlavor/src/main/java/com/example/mylibrary/ILogin.kt:
--------------------------------------------------------------------------------
1 | package com.example.mylibrary
2 |
3 | /**
4 | *
5 | * Created by Admin at 2023/3/23
6 | */
7 | interface ILogin {
8 |
9 | fun login(name: String, pwd: String)
10 | }
--------------------------------------------------------------------------------
/app/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #3F51B5
4 | #303F9F
5 | #FF4081
6 |
7 |
--------------------------------------------------------------------------------
/app/src/main/res/values/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | 16dp
4 | 16dp
5 |
6 |
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Wed Nov 16 01:00:06 CST 2022
2 | distributionBase=GRADLE_USER_HOME
3 | distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-bin.zip
4 | distributionPath=wrapper/dists
5 | zipStorePath=wrapper/dists
6 | zipStoreBase=GRADLE_USER_HOME
--------------------------------------------------------------------------------
/testBuildTypeFlavor/src/main/java/com/example/mylibrary/ICrash.kt:
--------------------------------------------------------------------------------
1 | package com.example.mylibrary
2 |
3 | import android.app.Application
4 | import android.content.Context
5 |
6 | /**
7 | *
8 | * Created by Admin at 2023/3/23
9 | */
10 | interface ICrash {
11 |
12 | fun init(context: Application): String
13 | }
--------------------------------------------------------------------------------
/includedBuild/src/main/java/me/hacket/deps/DependenciesPlugin.kt:
--------------------------------------------------------------------------------
1 | package me.hacket.deps
2 |
3 | import org.gradle.api.Plugin
4 | import org.gradle.api.Project
5 |
6 | class DependenciesPlugin : Plugin {
7 | override fun apply(project: Project) {
8 | println("------------>>> apply VersionPlugin")
9 | }
10 | }
11 |
--------------------------------------------------------------------------------
/testBuildTypeFlavor/src/huawei/java/com/example/mylibrary/LoginImpl.kt:
--------------------------------------------------------------------------------
1 | package com.example.mylibrary
2 |
3 | import android.util.Log
4 |
5 | /**
6 | *
7 | * Created by Admin at 2023/3/23
8 | */
9 | class LoginImpl : ILogin {
10 | override fun login(name: String, pwd: String) {
11 | Log.d("hacket", "hw login $name $pwd.")
12 | }
13 | }
--------------------------------------------------------------------------------
/testBuildTypeFlavor/src/google/java/com/example/mylibrary/LoginImpl.kt:
--------------------------------------------------------------------------------
1 | package com.example.mylibrary
2 |
3 | import android.util.Log
4 |
5 | /**
6 | *
7 | * Created by Admin at 2023/3/23
8 | */
9 | class LoginImpl : ILogin {
10 | override fun login(name: String, pwd: String) {
11 | Log.d("hacket", "google login $name $pwd.")
12 | }
13 | }
--------------------------------------------------------------------------------
/mylib/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
3 |
4 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/app/src/main/java/com/example/gradle_config/BaseApplication.java:
--------------------------------------------------------------------------------
1 | package com.example.gradle_config;
2 |
3 | import androidx.multidex.MultiDexApplication;
4 |
5 | public class BaseApplication extends MultiDexApplication {
6 |
7 | @Override
8 | public void onCreate() {
9 | super.onCreate();
10 |
11 | // MultiDex.install(this);
12 | }
13 |
14 | }
--------------------------------------------------------------------------------
/plugins/switch_module_dependency/module_dependency.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "useModule": true,
4 | "module_name": "Modularization1",
5 | "module_dir": "",
6 | "module_group": "me.hacket:Modularization1"
7 | },
8 | {
9 | "useModule": true,
10 | "module_name": "Modularization2",
11 | "module_dir": "",
12 | "module_group": "me.hacket:Modularization2"
13 | }
14 | ]
--------------------------------------------------------------------------------
/app/src/main/res/values-w820dp/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 | 64dp
6 |
7 |
--------------------------------------------------------------------------------
/plugins/pgyer_dingtalk/src/main/groovy/me/hacket/plugins/dingtalk/api/DingResponse.groovy:
--------------------------------------------------------------------------------
1 | package me.hacket.plugins.dingtalk.api
2 |
3 | class DingResponse {
4 |
5 | public int errcode
6 | public String errmsg
7 |
8 | boolean isSuccessFul() {
9 | return errcode == 0
10 | }
11 |
12 | @Override
13 | String toString() {
14 | return Utils.sGson.toJson(this)
15 | }
16 | }
--------------------------------------------------------------------------------
/ComposingBuildTest/src/main/res/values-w820dp/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 | 64dp
6 |
7 |
--------------------------------------------------------------------------------
/includedBuild/build.gradle.kts:
--------------------------------------------------------------------------------
1 | plugins {
2 | `kotlin-dsl`
3 | `java-gradle-plugin`
4 | }
5 | repositories {
6 | mavenCentral()
7 | google()
8 | }
9 |
10 | kotlinDslPluginOptions {
11 | experimentalWarning.set(false)
12 | }
13 | gradlePlugin {
14 | plugins.register("dependencies") {
15 | id = "dependencies"
16 | implementationClass = "me.hacket.deps.DependenciesPlugin"
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/repo/me/hacket/Modularization1/maven-metadata.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | me.hacket
4 | Modularization1
5 |
6 | 1.0.0
7 | 1.0.0
8 |
9 | 1.0.0
10 |
11 | 20221124034502
12 |
13 |
14 |
--------------------------------------------------------------------------------
/repo/me/hacket/Modularization2/maven-metadata.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | me.hacket
4 | Modularization2
5 |
6 | 1.0.0
7 | 1.0.0
8 |
9 | 1.0.0
10 |
11 | 20221124034519
12 |
13 |
14 |
--------------------------------------------------------------------------------
/repo/me/hacket/composingbuild/maven-metadata.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | me.hacket
4 | composingbuild
5 |
6 | 1.0.0
7 | 1.0.0
8 |
9 | 1.0.0
10 |
11 | 20221201030410
12 |
13 |
14 |
--------------------------------------------------------------------------------
/settings.gradle:
--------------------------------------------------------------------------------
1 | includeBuild("includedBuild")
2 |
3 | include ':app'
4 | //include ':mylib', 'ComposingBuildTest'
5 | //include ':pgyer_dingtalk'
6 | //project(':pgyer_dingtalk').projectDir = new File('./plugins/pgyer_dingtalk/')
7 |
8 | include ':testBuildTypeFlavor'
9 |
10 | //try {
11 | // apply from: "$rootDir/plugins/switch_module_dependency/module_dependency.gradle"
12 | //} catch (Exception e) {
13 | // e.printStackTrace()
14 | //}
--------------------------------------------------------------------------------
/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/testBuildTypeFlavor/src/release/java/com/example/mylibrary/crash/CrashImpl.kt:
--------------------------------------------------------------------------------
1 | package com.example.mylibrary.crash
2 |
3 | import android.content.Context
4 | import android.util.Log
5 | import com.example.mylibrary.ICrash
6 |
7 | /**
8 | *
9 | * Created by Admin at 2023/3/23
10 | */
11 | class CrashImpl : ICrash {
12 | override fun init(context: Context): String {
13 | Log.i("hacket", "Firebase crash")
14 | return "Firebase"
15 | }
16 | }
--------------------------------------------------------------------------------
/tips/03_gradle代理/README.md:
--------------------------------------------------------------------------------
1 | # gradle代理
2 |
3 | > 我们经常会遇到,出现gradle编译时出现Connection to https://jcenter.bintray.com refused错误,无法连接到jcenter服务器,这时需要挂代理
4 |
5 | **为gradle配置代理,gradle.properties文件加上下面几句:**
6 |
7 | ```java
8 | systemProp.https.proxyPort=1080
9 | systemProp.http.proxyHost=172.18.188.42
10 | systemProp.https.proxyHost=172.18.188.42
11 | systemProp.http.proxyPort=1080
12 | ```
13 |
14 | ## Reference
15 | [Accessing the web via a proxy](https://docs.gradle.org/current/userguide/userguide_single.html#sec%3aaccessing_the_web_via_a_proxy)
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # Built application files
2 | *.apk
3 | *.ap_
4 |
5 | # Files for the Dalvik VM
6 | *.dex
7 |
8 | # Java class files
9 | *.class
10 |
11 | # Generated files
12 | bin/
13 | gen/
14 |
15 | # Gradle files
16 | .gradle/
17 | build/
18 |
19 | # Local configuration file (sdk path, etc)
20 | local.properties
21 |
22 | # Proguard folder generated by Eclipse
23 | proguard/
24 |
25 | # Log Files
26 | *.log
27 |
28 | # Android Studio Navigation editor temp files
29 | .navigation/
30 |
31 | # Android Studio captures folder
32 | captures/
33 | .idea
34 |
--------------------------------------------------------------------------------
/plugins/pgyer_dingtalk/src/main/groovy/me/hacket/plugins/Constants.groovy:
--------------------------------------------------------------------------------
1 | package me.hacket.plugins
2 |
3 | class Constants {
4 |
5 | public static final String GROUP = "ding_pgyer"
6 |
7 | public static final String EXTENSION_NAME = "dingPgyerConfig"
8 | public static final String ANDROID_EXTENSION_NAME = "android"
9 |
10 | public static final String TASK_UPLOAD_PGYER = "uploadPgyer"
11 | public static final String TASK_SEND_DINGTALK = "sendDingTalk"
12 |
13 | public static final def ERR_CODE_APK_NOT_EXISTS = -1000
14 | public static final def ERR_CODE_UPLOAD_PGYER = -1001
15 |
16 | }
17 |
--------------------------------------------------------------------------------
/tips/buildSrc_composingbuild/buildSrc和composingBuild.md:
--------------------------------------------------------------------------------
1 | # buildSrc 和 Composing Builds
2 |
3 | ## 什么是 buildSrc?
4 | 当运行 Gradle 时会检查项目中是否存在一个名为 buildSrc 的目录。然后 Gradle 会自动编译并测试这段代码,并将其放入构建脚本的类路径中, 对于多项目构建,只能有一个 buildSrc 目录,该目录必须位于根项目目录中。
5 |
6 |
7 | ## 什么是Composing Builds?
8 | 复合构建只是包含其他构建的构建. 在许多方面,复合构建类似于 Gradle 多项目构建,不同之处在于,它包括完整的 builds ,而不是包含单个 projects
9 | - 组合通常独立开发的构建,例如,在应用程序使用的库中尝试错误修复时
10 | - 将大型的多项目构建分解为更小,更孤立的块,可以根据需要独立或一起工作
11 |
12 |
13 | ## buildSrc vs Composing Builds
14 | - 都支持自动补全和单击跳转
15 | - buildSrc可用来实现自定义插件、gradle task和一些公共的配置(如dependencies、版本号等配置);buildSrc种有依赖有更新时,会让build cache失效,将重新构建整个项目
16 | - Composing Builds中有依赖更新时 不会重新构建整个项目;更推荐用这种方式来统一管理依赖
--------------------------------------------------------------------------------
/app/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # By default, the flags in this file are appended to flags specified
3 | # in G:\adt-bundle-windows-x86_64-20140702\sdk/tools/proguard/proguard-android.txt
4 | # You can edit the include path and order by changing the proguardFiles
5 | # directive in build.gradle.
6 | #
7 | # For more details, see
8 | # http://developer.android.com/guide/developing/tools/proguard.html
9 |
10 | # Add any project specific keep options here:
11 |
12 | # If your project uses WebView with JS, uncomment the following
13 | # and specify the fully qualified class name to the JavaScript interface
14 | # class:
15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
16 | # public *;
17 | #}
18 |
--------------------------------------------------------------------------------
/mylib/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # By default, the flags in this file are appended to flags specified
3 | # in G:\adt-bundle-windows-x86_64-20140702\sdk/tools/proguard/proguard-android.txt
4 | # You can edit the include path and order by changing the proguardFiles
5 | # directive in build.gradle.
6 | #
7 | # For more details, see
8 | # http://developer.android.com/guide/developing/tools/proguard.html
9 |
10 | # Add any project specific keep options here:
11 |
12 | # If your project uses WebView with JS, uncomment the following
13 | # and specify the fully qualified class name to the JavaScript interface
14 | # class:
15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
16 | # public *;
17 | #}
18 |
--------------------------------------------------------------------------------
/ComposingBuildTest/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # By default, the flags in this file are appended to flags specified
3 | # in G:\adt-bundle-windows-x86_64-20140702\sdk/tools/proguard/proguard-android.txt
4 | # You can edit the include path and order by changing the proguardFiles
5 | # directive in build.gradle.
6 | #
7 | # For more details, see
8 | # http://developer.android.com/guide/developing/tools/proguard.html
9 |
10 | # Add any project specific keep options here:
11 |
12 | # If your project uses WebView with JS, uncomment the following
13 | # and specify the fully qualified class name to the JavaScript interface
14 | # class:
15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
16 | # public *;
17 | #}
18 |
--------------------------------------------------------------------------------
/ComposingBuildTest/src/main/res/layout/activity_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
11 |
12 |
16 |
17 |
--------------------------------------------------------------------------------
/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
11 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/Modularization1/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # You can control the set of applied configuration files using the
3 | # proguardFiles setting in build.gradle.
4 | #
5 | # For more details, see
6 | # http://developer.android.com/guide/developing/tools/proguard.html
7 |
8 | # If your project uses WebView with JS, uncomment the following
9 | # and specify the fully qualified class name to the JavaScript interface
10 | # class:
11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
12 | # public *;
13 | #}
14 |
15 | # Uncomment this to preserve the line number information for
16 | # debugging stack traces.
17 | #-keepattributes SourceFile,LineNumberTable
18 |
19 | # If you keep the line number information, uncomment this to
20 | # hide the original source file name.
21 | #-renamesourcefileattribute SourceFile
--------------------------------------------------------------------------------
/Modularization2/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # You can control the set of applied configuration files using the
3 | # proguardFiles setting in build.gradle.
4 | #
5 | # For more details, see
6 | # http://developer.android.com/guide/developing/tools/proguard.html
7 |
8 | # If your project uses WebView with JS, uncomment the following
9 | # and specify the fully qualified class name to the JavaScript interface
10 | # class:
11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
12 | # public *;
13 | #}
14 |
15 | # Uncomment this to preserve the line number information for
16 | # debugging stack traces.
17 | #-keepattributes SourceFile,LineNumberTable
18 |
19 | # If you keep the line number information, uncomment this to
20 | # hide the original source file name.
21 | #-renamesourcefileattribute SourceFile
--------------------------------------------------------------------------------
/testBuildTypeFlavor/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # You can control the set of applied configuration files using the
3 | # proguardFiles setting in build.gradle.
4 | #
5 | # For more details, see
6 | # http://developer.android.com/guide/developing/tools/proguard.html
7 |
8 | # If your project uses WebView with JS, uncomment the following
9 | # and specify the fully qualified class name to the JavaScript interface
10 | # class:
11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
12 | # public *;
13 | #}
14 |
15 | # Uncomment this to preserve the line number information for
16 | # debugging stack traces.
17 | #-keepattributes SourceFile,LineNumberTable
18 |
19 | # If you keep the line number information, uncomment this to
20 | # hide the original source file name.
21 | #-renamesourcefileattribute SourceFile
--------------------------------------------------------------------------------
/tips/04_dex突破65535的限制/README.md:
--------------------------------------------------------------------------------
1 | # dex突破65535的限制
2 | 随着项目的一天天变大,慢慢的都会遇到单个dex最多65535个方法数的瓶颈,如果是ANT构建的项目就会比较麻烦,但是Gradle已经帮我们处理好了,而添加的方法也很简单,总共就分三步 :
3 |
4 | 1.首先是在defaultConfig节点使能多DEX功能
5 |
6 | ```groovy
7 | android {
8 | defaultConfig {
9 | // dex突破65535的限制
10 | multiDexEnabled true
11 | }
12 | }
13 | ```
14 |
15 | 2.然后就是引入multidex库文件
16 |
17 | ```groovy
18 | dependencies {
19 | compile 'com.android.support:multidex:1.0.0'
20 | }
21 | ```
22 |
23 | 3.最后就是你的BaseApplication继承一下MultiDexApplication或者在Application的onCreate()方法加入这句:
24 | ```java
25 | MultiDex.install(this);
26 | ```
27 |
28 | ## Reference
29 | [Building Apps with Over 64K Methods](http://developer.android.com/intl/zh-cn/tools/building/multidex.html "http://developer.android.com/intl/zh-cn/tools/building/multidex.html")
30 |
31 | [关于『65535问题』的一点研究与思考](http://blog.csdn.net/zhaokaiqiang1992/article/details/50412975 "http://blog.csdn.net/zhaokaiqiang1992/article/details/50412975")
--------------------------------------------------------------------------------
/includedBuild/build-backup.gradle:
--------------------------------------------------------------------------------
1 | plugins {
2 | id 'groovy'
3 | id 'java-gradle-plugin'
4 | id 'maven-publish'
5 | }
6 |
7 |
8 | dependencies {
9 | implementation gradleApi()
10 |
11 | }
12 |
13 | gradlePlugin {
14 | plugins {
15 | version {
16 | // 在 app 模块需要通过 id 引用这个插件
17 | id = "me.hacket.config"
18 | // 实现这个插件的类的路径
19 | implementationClass = "me.hacket.deps.VersionPlugin"
20 | }
21 | }
22 | }
23 | afterEvaluate {
24 | publishing {
25 | publications {
26 | repo(MavenPublication) {
27 | from components.java
28 | groupId = "me.hacket"
29 | artifactId = "composingbuild"
30 | version = "1.0.0"
31 | }
32 | }
33 | repositories {
34 | // mavenLocal()
35 | maven {
36 | url = "${rootDir}/repo"
37 | }
38 | }
39 | }
40 | }
--------------------------------------------------------------------------------
/mylib/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.library'
2 |
3 | android {
4 | compileSdkVersion rootProject.ext.android.compileSdkVersion
5 | buildToolsVersion rootProject.ext.android.buildToolsVersion
6 |
7 | defaultConfig {
8 | minSdkVersion rootProject.ext.android.minSdkVersion
9 | targetSdkVersion rootProject.ext.android.targetSdkVersion
10 | }
11 | buildTypes {
12 | release {
13 | minifyEnabled false
14 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
15 | }
16 | }
17 | }
18 |
19 | dependencies {
20 | implementation fileTree(dir: 'libs', include: ['*.jar'])
21 |
22 | implementation rootProject.ext.dependencies['appcompat-v7']
23 | implementation rootProject.ext.dependencies['butterknife']
24 | implementation rootProject.ext.dependencies['glide']
25 | implementation rootProject.ext.dependencies['glide-okhttp-integration']
26 |
27 | }
28 |
--------------------------------------------------------------------------------
/tips/07_compile, provided, apk/README.md:
--------------------------------------------------------------------------------
1 | # compile,provided,apk
2 | 在`File→ProjectStructure→Dependencies`可配置
3 | http://stackoverflow.com/questions/28472785/compile-provided-apk-android-dependency-scope
4 |
5 | ## compile参与编译和打包
6 | 1.**compile**
7 | 所有的*build_type*以及*flavors*参与编译并且打包的apk中去。运行时需要。
8 | *`compilefileTree(include:'*.jar',dir:'libs')`编译打包libs下所有的jar包
9 | *`compilefiles('libs/picasso-2.4.0.jar')`编译打包picasso-2.4.0.jar包
10 | *`compileproject(':common')`编译打包commonmodule
11 |
12 | 1.**debugCompile**
13 | 所有debug的flavors参与编译并且打包到apk中去
14 |
15 |
16 | 2.**releaseCompile**
17 | 所有release的flavors参与编译并且打包到apk中去
18 |
19 |
20 | 3.**testCompile**
21 | 仅仅是针对单元测试代码的编译编译以及最终打包测试apk时有效,而对正常的debug或者releaseapk包不起作用。
22 |
23 |
24 | 4.**xxxCompile**
25 | 所有xxx的flavors参与编译并且打包到apk中去,如releaseLogCompile
26 |
27 | ## provided只参与编译不参与打包
28 | Provided是对所有的buildtype以及favlors只在编译时使用,类似eclipse中的external-libs,只参与编译,不打包到最终apk。
29 |
30 | ## apk只参与打包不参与编译
31 | 只会打包到apk文件中,而不参与编译,所以不能再代码中直接调用jar中的类或方法,否则在编译时会报错
--------------------------------------------------------------------------------
/Gradle-config.iml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/repo/me/hacket/composingbuild/1.0.0/composingbuild-1.0.0.pom:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 | 4.0.0
9 | me.hacket
10 | composingbuild
11 | 1.0.0
12 |
13 |
14 | org.jetbrains.kotlin
15 | kotlin-stdlib-jdk8
16 | 1.7.21
17 | runtime
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/app/src/main/java/com/example/gradle_config/MainActivity.kt:
--------------------------------------------------------------------------------
1 | package com.example.gradle_config
2 |
3 | import android.os.Bundle
4 | import android.widget.Button
5 | import android.widget.EditText
6 | import android.widget.TextView
7 | import androidx.appcompat.app.AppCompatActivity
8 | import androidx.multidex.BuildConfig
9 | import com.example.mylibrary.LoginImpl
10 | import com.example.mylibrary.crash.CrashImpl
11 |
12 | class MainActivity : AppCompatActivity() {
13 | override fun onCreate(savedInstanceState: Bundle?) {
14 | super.onCreate(savedInstanceState)
15 | setContentView(R.layout.activity_main)
16 |
17 | val init = CrashImpl().init(application)
18 | val tvInfo = findViewById(R.id.tv_info)
19 | tvInfo.text = "${BuildConfig.BUILD_TYPE}-${BuildConfig.FLAVOR}- $init"
20 |
21 | findViewById