├── .gitattributes ├── .gitignore ├── .idea ├── codeStyles │ └── Project.xml ├── dbnavigator.xml ├── gradle.xml ├── misc.xml └── vcs.xml ├── README.md ├── app ├── .gitignore ├── jniLibs │ ├── armeabi-v7a │ │ └── zinc.so │ └── x86 │ │ └── zinc.so ├── keep │ └── keep_in_main_dex.txt ├── keep_in_main_dex.txt ├── lint │ └── rule_lint.xml ├── proguard-rules.pro ├── report │ ├── zincHtmlReport.html │ ├── zincTextReport.txt │ └── zincXmlReport.xml ├── src │ ├── androidTest │ │ └── java │ │ │ └── com │ │ │ └── zinc │ │ │ └── gradlestudy │ │ │ └── ExampleInstrumentedTest.java │ ├── free │ │ └── java │ │ │ └── com │ │ │ └── zinc │ │ │ └── gradlestudy │ │ │ └── TestUtils.java │ ├── main │ │ ├── AndroidManifest.xml │ │ ├── ZincManifest.xml │ │ ├── aidl │ │ │ └── com │ │ │ │ └── zinc │ │ │ │ └── gradlestudy │ │ │ │ └── IMyAidlInterface.aidl │ │ ├── assets │ │ │ ├── t112.bat │ │ │ ├── t121212.png │ │ │ └── t3123123.jpg │ │ ├── java │ │ │ └── com │ │ │ │ └── zinc │ │ │ │ └── gradlestudy │ │ │ │ ├── App.java │ │ │ │ ├── MainActivity.java │ │ │ │ └── ZincPower.java │ │ ├── jniLibs │ │ │ ├── armeabi-v7a │ │ │ │ └── libtest.so │ │ │ └── x86 │ │ │ │ └── libtest.so │ │ ├── res │ │ │ ├── drawable-hdpi │ │ │ │ └── ic_gradle_study.png │ │ │ ├── drawable-ldpi │ │ │ │ └── ic_gradle_study.png │ │ │ ├── drawable-mdpi │ │ │ │ └── ic_gradle_study.png │ │ │ ├── drawable-xhdpi │ │ │ │ └── ic_gradle_study.png │ │ │ ├── drawable-xxhdpi │ │ │ │ └── ic_gradle_study.png │ │ │ ├── drawable-xxxhdpi │ │ │ │ └── ic_gradle_study.png │ │ │ ├── drawable │ │ │ │ ├── ic_arrow_drop_down_black_24dp.xml │ │ │ │ └── ic_gradle_study.png │ │ │ ├── layout │ │ │ │ └── activity_main.xml │ │ │ ├── mipmap-hdpi │ │ │ │ ├── ic_launcher.png │ │ │ │ ├── t1.jpg │ │ │ │ └── t11.jpg │ │ │ ├── mipmap-ldpi │ │ │ │ ├── ic_launcher.png │ │ │ │ ├── t1.jpg │ │ │ │ └── t11.jpg │ │ │ ├── mipmap-mdpi │ │ │ │ ├── ic_launcher.png │ │ │ │ ├── t1.jpg │ │ │ │ └── t11.jpg │ │ │ ├── mipmap-xhdpi │ │ │ │ ├── ic_launcher.png │ │ │ │ ├── t1.jpg │ │ │ │ └── t11.jpg │ │ │ ├── mipmap-xxhdpi │ │ │ │ ├── ic_launcher.png │ │ │ │ ├── t1.jpg │ │ │ │ └── t11.jpg │ │ │ ├── mipmap-xxxhdpi │ │ │ │ ├── ic_launcher.png │ │ │ │ ├── t1.jpg │ │ │ │ └── t11.jpg │ │ │ ├── values-en │ │ │ │ └── strings.xml │ │ │ ├── values-fr │ │ │ │ └── strings.xml │ │ │ ├── values-zh │ │ │ │ └── strings.xml │ │ │ └── values │ │ │ │ ├── colors.xml │ │ │ │ ├── strings.xml │ │ │ │ └── styles.xml │ │ ├── res2 │ │ │ └── values │ │ │ │ └── strings.xml │ │ ├── zinc-res │ │ │ └── values │ │ │ │ └── strings.xml │ │ ├── zincAidl │ │ │ └── com │ │ │ │ └── zinc │ │ │ │ └── gradlestudy │ │ │ │ └── IMyAidlInterface.aidl │ │ └── zincAssets │ │ │ └── zinc11.bat │ ├── test │ │ └── java │ │ │ └── com │ │ │ └── zinc │ │ │ └── gradlestudy │ │ │ ├── ExampleUnitTest.java │ │ │ └── JTest.java │ └── zincPower │ │ ├── AndroidManifest.xml │ │ ├── java │ │ └── com │ │ │ └── zinc │ │ │ └── ZincPower.java │ │ └── res │ │ └── values │ │ └── zincValue.xml ├── zinc ├── zinc_AppExtension.gradle ├── zinc_LibraryExtension.gradle ├── zinc_PackagingOptions.gradle ├── zinc_aaptOptions.gradle ├── zinc_adbOptions.gradle ├── zinc_buildTypes.gradle ├── zinc_compileOptions.gradle ├── zinc_databinding.gradle ├── zinc_defaultConfig.gradle ├── zinc_dexOptions.gradle ├── zinc_externalNativeBuild.gradle ├── zinc_flavor.gradle ├── zinc_implementation.gradle ├── zinc_lintOptions.gradle ├── zinc_sigingConfigs.gradle ├── zinc_sourceSets.gradle ├── zinc_splits.gradle ├── zinc_testOptions.gradle └── zinc_value.gradle ├── build.gradle ├── gradle.properties ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat ├── img ├── logo.png ├── zincPay.jpg └── 公众号.png ├── key └── gradleStudy.jks ├── lib └── library │ ├── .gitignore │ ├── build.gradle │ ├── consumer-rules.pro │ ├── proguard-rules.pro │ └── src │ ├── androidTest │ └── java │ │ └── com │ │ └── zinc │ │ └── library │ │ └── ExampleInstrumentedTest.java │ ├── main │ ├── AndroidManifest.xml │ ├── java │ │ └── com │ │ │ └── zinc │ │ │ └── library │ │ │ └── Test.java │ └── res │ │ └── values │ │ └── strings.xml │ └── test │ └── java │ └── com │ └── zinc │ └── library │ └── ExampleUnitTest.java ├── matchingalibrary ├── .gitignore ├── build.gradle ├── consumer-rules.pro ├── proguard-rules.pro └── src │ ├── androidTest │ └── java │ │ └── com │ │ └── zinc │ │ └── matchingalibrary │ │ └── ExampleInstrumentedTest.java │ ├── main │ ├── AndroidManifest.xml │ └── res │ │ └── values │ │ └── strings.xml │ └── test │ └── java │ └── com │ └── zinc │ └── matchingalibrary │ └── ExampleUnitTest.java ├── settings.gradle └── zinclibrary ├── .gitignore ├── build.gradle ├── consumer-rules.pro ├── proguard-rules.pro └── src ├── androidTest └── java │ └── com │ └── zinc │ └── zinclibrary │ └── ExampleInstrumentedTest.java ├── main ├── AndroidManifest.xml └── res │ └── values │ └── strings.xml └── test └── java └── com └── zinc └── zinclibrary └── ExampleUnitTest.java /.gitattributes: -------------------------------------------------------------------------------- 1 | *.html linguist-language=gradle -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.iml 2 | .gradle 3 | /local.properties 4 | /.idea/caches 5 | /.idea/libraries 6 | /.idea/modules.xml 7 | /.idea/workspace.xml 8 | /.idea/navEditor.xml 9 | /.idea/assetWizardSettings.xml 10 | .DS_Store 11 | /build 12 | /captures 13 | .externalNativeBuild 14 | .cxx 15 | -------------------------------------------------------------------------------- /.idea/codeStyles/Project.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 11 | 12 | 13 | 14 | 15 | 21 | 22 | 26 | 27 | 28 | 29 | 31 | 32 | 33 |
34 | 35 | 36 | 37 | xmlns:android 38 | 39 | ^$ 40 | 41 | 42 | 43 |
44 |
45 | 46 | 47 | 48 | xmlns:.* 49 | 50 | ^$ 51 | 52 | 53 | BY_NAME 54 | 55 |
56 |
57 | 58 | 59 | 60 | .*:id 61 | 62 | http://schemas.android.com/apk/res/android 63 | 64 | 65 | 66 |
67 |
68 | 69 | 70 | 71 | .*:name 72 | 73 | http://schemas.android.com/apk/res/android 74 | 75 | 76 | 77 |
78 |
79 | 80 | 81 | 82 | name 83 | 84 | ^$ 85 | 86 | 87 | 88 |
89 |
90 | 91 | 92 | 93 | style 94 | 95 | ^$ 96 | 97 | 98 | 99 |
100 |
101 | 102 | 103 | 104 | .* 105 | 106 | ^$ 107 | 108 | 109 | BY_NAME 110 | 111 |
112 |
113 | 114 | 115 | 116 | .* 117 | 118 | http://schemas.android.com/apk/res/android 119 | 120 | 121 | ANDROID_ATTRIBUTE_ORDER 122 | 123 |
124 |
125 | 126 | 127 | 128 | .* 129 | 130 | .* 131 | 132 | 133 | BY_NAME 134 | 135 |
136 |
137 |
138 |
139 |
140 |
-------------------------------------------------------------------------------- /.idea/dbnavigator.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 | 170 | 171 | 172 | 173 | 174 | 175 | 176 | 177 | 178 | 179 | 180 | 181 | 182 | 183 | 184 | 185 | 186 | 187 | 188 | 189 | 190 | 191 | 192 | 193 | 194 | 195 | 196 | 197 | 198 | 199 | 200 | 201 | 202 | 203 | 204 | 205 | 206 | 207 | 208 | 209 | 210 | 211 | 212 | 213 | 214 | 215 | 216 | 217 | 218 | 219 | 220 | 221 | 222 | 223 | 224 | 225 | 226 | 227 | 228 | 229 | 230 | 231 | 232 | 233 | 234 | 235 | 236 | 237 | 238 | 239 | 240 | 241 | 242 | 243 | 244 | 245 | 246 | 247 | 248 | 249 | 250 | 251 | 252 | 253 | 254 | 255 | 256 | 257 | 258 | 259 | 260 | 261 | 262 | 263 | 264 | 265 | 266 | 267 | 268 | 269 | 270 | 271 | 272 | 273 | 274 | 275 | 276 | 277 | 278 | 279 | 280 | 281 | 282 | 283 | 284 | 285 | 286 | 287 | 288 | 289 | 290 | 291 | 292 | 293 | 294 | 295 | 296 | 297 | 298 | 299 | 300 | 301 | 302 | 303 | 304 | 305 | 306 | 307 | 308 | 309 | 310 | 311 | 312 | 313 | 314 | 315 | 316 | 317 | 318 | 319 | 320 | 321 | 322 | 323 | 324 | 325 | 326 | 327 | 328 | 329 | 330 | 331 | 332 | 333 | 334 | 335 | 336 | 337 | 338 | 339 | 340 | 341 | 342 | 343 | 344 | 345 | 346 | 347 | 348 | 349 | 350 | 351 | 352 | 353 | 354 | 355 | 356 | 357 | 358 | 359 | 360 | 361 | 362 | 363 | 364 | 365 | 366 | 367 | 368 | 369 | 370 | 371 | 372 | 373 | 374 | 375 | 376 | 377 | 378 | 379 | 380 | 381 | 382 | 383 | 384 | 385 | 386 | 387 | 388 | 389 | 390 | 391 | 392 | 393 | 394 | 395 | 396 | 397 | 398 | 399 | 400 | 401 | 402 | 403 | 404 | 405 | 406 | 407 | 408 | 409 | 410 | 411 | 412 | 413 | 414 | 415 | 416 | 417 | 418 | 419 | 420 | 421 | 422 | 423 | 424 | 425 | 426 | 427 | 428 | 429 | 430 | 431 | 432 | 433 | 434 | 435 | 436 | 437 | 438 | 439 | 440 | 441 | 442 | 443 | 444 | 445 | 446 | 447 | 448 | 449 | 450 | 451 | 452 | 453 | 454 | 455 | 456 | -------------------------------------------------------------------------------- /.idea/gradle.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 15 | 16 | -------------------------------------------------------------------------------- /.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 13 | -------------------------------------------------------------------------------- /.idea/vcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # GradleStudy 2 | 3 | >目录
4 | >一、项目宗旨
5 | >二、已有章节
6 | >三、后续章节
7 | >四、如何使用该项目
8 | >五、其他项目推荐
9 | >六、作者简介 10 | 11 | ## 一、项目宗旨 12 | 13 | 本项目主要用于分享 Android Gradle 中配置属性如何使用,形成知识体系,使用起来更加游刃有余 14 | 15 | ![](https://github.com/zincPower/GradleStudy/blob/master/img/logo.png) 16 | 17 | ### 1、博文讲解可移步至以下两个地方: 18 | 19 | CSDN: [Android Gradle](https://blog.csdn.net/weixin_37625173/category_9350766.html) 20 | 21 | 掘金:[猛猛的小盆友](https://juejin.im/user/5c3033ef51882524ec3a88ba/posts) 22 | 23 | ### 2、代码: 24 | 25 | github: [GradleStudy](https://github.com/zincPower/GradleStudy) 26 | 27 | ## 二、已有章节 28 | 29 | ### 1、buildTypes 30 | 31 | - CSDN: [buildTypes——安卓gradle](https://blog.csdn.net/weixin_37625173/article/details/100824010) 32 | 33 | - 掘金: [buildTypes——安卓gradle](https://juejin.im/post/5d7e01125188253a8305480a) 34 | 35 | - github代码: [传送门](https://github.com/zincPower/GradleStudy/blob/master/app/zinc_buildTypes.gradle) 36 | 37 | ### 2、defaultConfig 38 | 39 | - CSDN: [defaultConfig——安卓gradle](https://blog.csdn.net/weixin_37625173/article/details/100641538) 40 | 41 | - 掘金: [defaultConfig——安卓gradle](https://juejin.im/post/5d7baa7d51882554841c50d5) 42 | 43 | - github代码: [传送门](https://github.com/zincPower/GradleStudy/blob/master/app/zinc_defaultConfig.gradle) 44 | 45 | ### 3、productFlavors 46 | 47 | - CSDN: [flavorDimensions和productFlavors——安卓gradle](https://blog.csdn.net/weixin_37625173/article/details/100867037) 48 | 49 | - 掘金: [flavorDimensions和productFlavors——安卓gradle](https://juejin.im/post/5da7215ef265da5b576bebbd) 50 | 51 | - github代码: [传送门](https://github.com/zincPower/GradleStudy/blob/master/app/zinc_flavor.gradle) 52 | 53 | ### 4、风味包配置 54 | 55 | - CSDN: [android多渠道包(风味包)——安卓gradle](https://blog.csdn.net/weixin_37625173/article/details/102510549) 56 | 57 | - 掘金: [android多渠道包(风味包)——安卓gradle](https://juejin.im/post/5da722dbf265da5b8e0f1773) 58 | 59 | - github代码: [传送门](https://github.com/zincPower/FlavorDemo) 60 | 61 | ### 5、sourceSets 62 | 63 | - CSDN: [sourceSets——安卓gradle](https://blog.csdn.net/weixin_37625173/article/details/102616036) 64 | 65 | - 掘金: [sourceSets——安卓gradle](https://juejin.im/post/5dd9eda7f265da7de667d2bc) 66 | 67 | - github代码: [传送门](https://github.com/zincPower/GradleStudy/blob/master/app/zinc_sourceSets.gradle) 68 | 69 | ### 6、lintOptions 70 | 71 | - CSDN: [lintOptions——安卓gradle](https://blog.csdn.net/weixin_37625173/article/details/103236227) 72 | 73 | - 掘金: [lintOptions——安卓gradle](https://juejin.im/post/5ddca7a0518825730753a31e) 74 | 75 | - github代码: [传送门](https://github.com/zincPower/GradleStudy/blob/master/app/zinc_lintOptions.gradle) 76 | 77 | ### 7、splits 78 | 79 | - CSDN: [splits——安卓gradle](https://blog.csdn.net/weixin_37625173/article/details/103284575) 80 | 81 | - 掘金: [splits——安卓gradle](https://juejin.im/post/5ddfe513e51d45027e2a7e96) 82 | 83 | - github代码: [传送门](https://github.com/zincPower/GradleStudy/blob/master/app/zinc_splits.gradle) 84 | 85 | ### 8、signingConfigs 86 | 87 | - CSDN: [signingConfigs——安卓 gradle](https://blog.csdn.net/weixin_37625173/article/details/103322670) 88 | 89 | - 掘金: [signingConfigs——安卓 gradle](https://juejin.im/post/5de298266fb9a0719f649a6d) 90 | 91 | - github代码: [传送门](https://github.com/zincPower/GradleStudy/blob/master/app/zinc_sigingConfigs.gradle) 92 | 93 | ### 9、dexOptions 94 | 95 | - CSDN: [dexOptions——安卓gradle](https://blog.csdn.net/weixin_37625173/article/details/103334208) 96 | 97 | - 掘金: [dexOptions——安卓gradle](https://juejin.im/post/5de71632f265da33d74406fa) 98 | 99 | - github代码: [传送门](https://github.com/zincPower/GradleStudy/blob/master/app/zinc_dexOptions.gradle) 100 | 101 | ### 10、externalNativeBuild 102 | 103 | - CSDN: [externalNativeBuild——安卓gradle](https://blog.csdn.net/weixin_37625173/article/details/103680701) 104 | 105 | - 掘金: [externalNativeBuild——安卓gradle](https://juejin.im/post/5e01b3df5188251255041356) 106 | 107 | - github代码: [传送门](https://github.com/zincPower/GradleStudy/blob/master/app/zinc_externalNativeBuild.gradle) 108 | 109 | ### 11、aaptOptions 110 | 111 | - CSDN: [aaptOptions——安卓gradle](https://blog.csdn.net/weixin_37625173/article/details/103685230) 112 | 113 | - 掘金: [aaptOptions——安卓gradle](https://juejin.im/post/5e02d116f265da339e4647fa) 114 | 115 | - github代码: [传送门](https://github.com/zincPower/GradleStudy/blob/master/app/zinc_aaptOptions.gradle) 116 | 117 | ### 12、adbOptions 118 | 119 | - CSDN: [adbOptions——安卓gradle](https://blog.csdn.net/weixin_37625173/article/details/103696703) 120 | 121 | - 掘金: [adbOptions——安卓gradle](https://juejin.im/post/5e08b4cd6fb9a01624455b57) 122 | 123 | - github代码: [传送门](https://github.com/zincPower/GradleStudy/blob/master/app/zinc_adbOptions.gradle) 124 | 125 | 126 | ## 三、后续章节 127 | 128 | - packagingOptions 129 | - compileOptions 130 | - dataBinding 131 | - testOptions 132 | 133 | ## 四、如何使用该项目 134 | 135 | 1. 打开根目录下的 settings.gradle 文件 136 | 137 | 2. 修改下面这段代码 138 | ``` 139 | // xxx 即我们想运行的 gradle 配置 140 | // 例如:我们想运行 lintOptions 的配置,此处的 xxx 替换为 zinc_lintOptions 141 | project(':app').buildFileName = 'xxx.gradle' 142 | ``` 143 | 144 | ## 五、其他项目推荐 145 | 146 | ### 1、知识体系 147 | 148 | Android 高级 UI:https://github.com/zincPower/UI2018 149 | 150 | Android Gradle:https://github.com/zincPower/GradleStudy 151 | 152 | Lua:https://github.com/zincPower/lua_study_2022 153 | 154 | ### 2、开源框架 155 | 156 | #### JRecycleView 157 | 158 | 简介:简单的让RecycleView更有趣 159 | 160 | 项目地址:https://github.com/zincPower/JRecycleView 161 | 162 | #### JPermission 163 | 164 | 简介:Android(安卓)基于注解的6.0权限动态申请 165 | 166 | 项目地址:https://github.com/zincPower/JPermission 167 | 168 | ## 六、作者简介 169 | 170 | ### 1、个人博客 171 | 172 | 掘金:https://juejin.im/user/5c3033ef51882524ec3a88ba/posts 173 | 174 | csdn:https://blog.csdn.net/weixin_37625173 175 | 176 | 公众号:微信搜索 "江澎涌" ,或扫描二维码 177 | 178 | ![](https://github.com/zincPower/GradleStudy/blob/master/img/公众号.png) 179 | 180 | ### 2、赞赏 181 | 182 | 如果觉得博客对您有所帮助或启发,请我喝杯水果茶吧 😄 183 | 184 | ![](https://github.com/zincPower/GradleStudy/blob/master/img/zincPay.jpg) 185 | -------------------------------------------------------------------------------- /app/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /app/jniLibs/armeabi-v7a/zinc.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zincPower/GradleStudy/d8da754d8c5d378d05c5b32684b6f2e09a154884/app/jniLibs/armeabi-v7a/zinc.so -------------------------------------------------------------------------------- /app/jniLibs/x86/zinc.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zincPower/GradleStudy/d8da754d8c5d378d05c5b32684b6f2e09a154884/app/jniLibs/x86/zinc.so -------------------------------------------------------------------------------- /app/keep/keep_in_main_dex.txt: -------------------------------------------------------------------------------- 1 | com/zinc/gradlestudy/MainActivity.class -------------------------------------------------------------------------------- /app/keep_in_main_dex.txt: -------------------------------------------------------------------------------- 1 | com/zinc/gradlestudy/MainActivity.class -------------------------------------------------------------------------------- /app/lint/rule_lint.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /app/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 22 | -keep class com.zinc.gradlestudy.com.zinc.ZincPower { *; } -------------------------------------------------------------------------------- /app/report/zincHtmlReport.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Lint Report 7 | 8 | 9 | 10 | 11 | 156 | 171 | 172 | 173 |
174 |
175 |
176 | Lint Report: 6 errors and 2 warnings 177 |
178 | 180 |
181 |
182 |
183 | Issue Types 184 | 190 |
191 |
192 |
193 | 194 |
195 |
196 |
197 |

Overview

198 |
199 |
200 | 201 | 203 | 204 | 206 | 208 | 209 | 211 | 213 | 214 | 216 |
Security 202 |
1warning 205 | AllowBackup: AllowBackup/FullBackupContent Problems
Performance 207 |
6error 210 | UnusedResources: Unused resources
Usability:Icons 212 |
1warning 215 | IconDuplicates: Duplicated icons under different names
Disabled Checks (34) 217 |
218 |
219 |
220 |
222 |
223 |
224 | 225 | 226 |
227 |
228 |
229 |

AllowBackup/FullBackupContent Problems

230 |
231 |
232 |
233 |
234 | ../src/main/AndroidManifest.xml:5: On SDK version 23 and up, your app data will be automatically backed up and restored on app install. Consider adding the attribute android:fullBackupContent to specify an @xml resource which configures which files to backup. More info: https://developer.android.com/training/backup/autosyncapi.html
235 |   2 <manifest xmlns:android="http://schemas.android.com/apk/res/android"
236 |   3     package="com.zinc.gradlestudy">
237 |   4 
238 |   5     <application                                                                                    
239 |   6         android:allowBackup="true"
240 |   7         android:icon="@mipmap/ic_launcher"
241 |   8         android:label="@string/app_name"
242 | 243 |
244 | 261 |
262 |
263 | 264 | AllowBackup 265 | 266 | 267 | Security 268 | 269 | 270 | Warning 271 | 272 | 273 | Priority 3/10 274 | 275 |
276 |
277 |
278 |
281 |
282 |
283 | 284 | 285 |
286 |
287 |
288 |

Unused resources

289 |
290 |
291 |
292 |
293 | ../src/main/res/drawable/ic_arrow_drop_down_black_24dp.xml:1: The resource R.drawable.ic_arrow_drop_down_black_24dp appears to be unused
294 |   1 <vector xmlns:android="http://schemas.android.com/apk/res/android"                                  
295 |   2         android:width="24dp"
296 |   3         android:height="24dp"
297 |   4         android:viewportWidth="24.0"
298 | 299 | ../src/main/res/drawable/ic_launcher_background.xml:2: The resource R.drawable.ic_launcher_background appears to be unused
300 |    1 <?xml version="1.0" encoding="utf-8"?>
301 |    2 <vector xmlns:android="http://schemas.android.com/apk/res/android"                                  
302 |    3     android:width="108dp"
303 |    4     android:height="108dp"
304 |    5     android:viewportWidth="108"
305 | 306 | ../src/main/res/mipmap-xhdpi/ic_launcher_round.png: The resource R.mipmap.ic_launcher_round appears to be unused
307 | ../src/main/res/values/strings.xml:5: The resource R.string.zincName appears to be unused
308 |  2     <string name="app_name">GradleStudy</string>
309 |  3     <string name="test_content">zinc Power test Content</string>
310 |  4 
311 |  5     <string name="zincName">zinc</string>                                                           
312 |  6 
313 |  7 </resources>
314 | 
315 | 316 |
    317 |

    324 | ../src/main/res/mipmap-xhdpi/t1.jpg: The resource R.mipmap.t1 appears to be unused
    325 | ../src/main/res/mipmap-xhdpi/t11.jpg: The resource R.mipmap.t11 appears to be unused
    326 |
    327 | 336 |
    337 |
    338 | 339 | UnusedResources 340 | 341 | 342 | Performance 343 | 344 | 345 | Error 346 | 347 | 348 | Priority 3/10 349 | 350 |
    351 |
    352 |
    353 |
    356 |
    357 |
    358 | 359 | 360 |
    361 |
    362 |
    363 |

    Duplicated icons under different names

    364 |
    365 |
    366 |
    367 |
    368 | ../src/main/res/mipmap-xhdpi/t11.jpg: The following unrelated icon files have identical contents: t1.jpg, t11.jpg
    369 |
      370 |

      375 | 376 | 379 |
      377 | 378 |
      380 |
      381 | 385 |
      386 |
      387 | 388 | IconDuplicates 389 | 390 | 391 | Icons 392 | 393 | 394 | Usability 395 | 396 | 397 | Warning 398 | 399 | 400 | Priority 3/10 401 | 402 |
      403 |
      404 |
      405 |
      408 |
      409 |
      410 | 411 |
      412 |
      413 |
      414 |

      Disabled Checks

      415 |
      416 |
      417 | One or more issues were not run by lint, either 418 | because the check is not enabled by default, or because 419 | it was disabled with a command line flag or via one or 420 | more lint.xml configuration files in the project directories. 421 |
      810 |
      811 |
      814 |
      815 |
      816 | 817 |
      818 |
      819 |
      820 |

      Suppressing Warnings and Errors

      821 |
      822 |
      823 | Lint errors can be suppressed in a variety of ways:
      824 |
      825 | 1. With a @SuppressLint annotation in the Java code
      826 | 2. With a tools:ignore attribute in the XML file
      827 | 3. With a //noinspection comment in the source code
      828 | 4. With ignore flags specified in the build.gradle file, as explained below
      829 | 5. With a lint.xml configuration file in the project
      830 | 6. With a lint.xml configuration file passed to lint via the --config flag
      831 | 7. With the --ignore flag passed to lint.
      832 |
      833 | To suppress a lint warning with an annotation, add a @SuppressLint("id") annotation on the class, method or variable declaration closest to the warning instance you want to disable. The id can be one or more issue id's, such as "UnusedResources" or {"UnusedResources","UnusedIds"}, or it can be "all" to suppress all lint warnings in the given scope.
      834 |
      835 | To suppress a lint warning with a comment, add a //noinspection id comment on the line before the statement with the error.
      836 |
      837 | To suppress a lint warning in an XML file, add a tools:ignore="id" attribute on the element containing the error, or one of its surrounding elements. You also need to define the namespace for the tools prefix on the root element in your document, next to the xmlns:android declaration:
      838 | xmlns:tools="http://schemas.android.com/tools"
      839 |
      840 | To suppress a lint warning in a build.gradle file, add a section like this:
      841 |
      842 | android {
      843 |     lintOptions {
      844 |         disable 'TypographyFractions','TypographyQuotes'
      845 |     }
      846 | }
      847 |
      848 | Here we specify a comma separated list of issue id's after the disable command. You can also use warning or error instead of disable to change the severity of issues.
      849 |
      850 | To suppress lint warnings with a configuration XML file, create a file named lint.xml and place it at the root directory of the module in which it applies.
      851 |
      852 | The format of the lint.xml file is something like the following:
      853 |
      854 | <?xml version="1.0" encoding="UTF-8"?>
      855 | <lint>
      856 |     <!-- Ignore everything in the test source set -->
      857 |     <issue id="all">
      858 |         <ignore path="*/test/*" />
      859 |     </issue>
      860 |
      861 |     <!-- Disable this given check in this project -->
      862 |     <issue id="IconMissingDensityFolder" severity="ignore" />
      863 |
      864 |     <!-- Ignore the ObsoleteLayoutParam issue in the given files -->
      865 |     <issue id="ObsoleteLayoutParam">
      866 |         <ignore path="res/layout/activation.xml" />
      867 |         <ignore path="res/layout-xlarge/activation.xml" />
      868 |         <ignore regexp="(foo|bar).java" />
      869 |     </issue>
      870 |
      871 |     <!-- Ignore the UselessLeaf issue in the given file -->
      872 |     <issue id="UselessLeaf">
      873 |         <ignore path="res/layout/main.xml" />
      874 |     </issue>
      875 |
      876 |     <!-- Change the severity of hardcoded strings to "error" -->
      877 |     <issue id="HardcodedText" severity="error" />
      878 | </lint>
      879 |
      880 | To suppress lint checks from the command line, pass the --ignore flag with a comma separated list of ids to be suppressed, such as:
      881 | $ lint --ignore UnusedResources,UselessLeaf /my/project/path
      882 |
      883 | For more information, see http://g.co/androidstudio/suppressing-lint-warnings
      884 | 885 |
      886 |
      887 |
      888 |
      889 |
      890 | 891 | -------------------------------------------------------------------------------- /app/report/zincTextReport.txt: -------------------------------------------------------------------------------- 1 | /Users/zinc/Documents/code/gradle/GradleStudy/app/src/main/AndroidManifest.xml:5: Warning: On SDK version 23 and up, your app data will be automatically backed up and restored on app install. Consider adding the attribute android:fullBackupContent to specify an @xml resource which configures which files to backup. More info: https://developer.android.com/training/backup/autosyncapi.html [AllowBackup] 2 | zinc 42 | ~~~~~~~~~~~~~~~ 43 | Also affects: 44 | /Users/zinc/Documents/code/gradle/GradleStudy/app/src/main/res/values-en/ 45 | strings.xml:4, 46 | /Users/zinc/Documents/code/gradle/GradleStudy/app/src/main/res/values-fr/ 47 | strings.xml:4, 48 | /Users/zinc/Documents/code/gradle/GradleStudy/app/src/main/res/values-zh/ 49 | strings.xml:4 50 | /Users/zinc/Documents/code/gradle/GradleStudy/app/src/main/res/mipmap-xhdpi/t1.jpg: Error: The resource R.mipmap.t1 appears to be unused [UnusedResources] 51 | /Users/zinc/Documents/code/gradle/GradleStudy/app/src/main/res/mipmap-xhdpi/t11.jpg: Error: The resource R.mipmap.t11 appears to be unused [UnusedResources] 52 | 53 | Explanation for issues of type "UnusedResources": 54 | Unused resources make applications larger and slow down builds. 55 | 56 | The unused resource check can ignore tests. If you want to include 57 | resources that are only referenced from tests, consider packaging them in a 58 | test source set instead. 59 | 60 | You can include test sources in the unused resource check by setting the 61 | system property lint.unused-resources.include-tests=true, and to exclude 62 | them (usually for performance reasons), use 63 | lint.unused-resources.exclude-tests=true. 64 | 65 | /Users/zinc/Documents/code/gradle/GradleStudy/app/src/main/res/mipmap-xhdpi/t11.jpg: Warning: The following unrelated icon files have identical contents: t1.jpg, t11.jpg [IconDuplicates] 66 | Also affects: 67 | /Users/zinc/Documents/code/gradle/GradleStudy/app/src/main/res/mipmap-xhd 68 | pi/t1.jpg 69 | 70 | Explanation for issues of type "IconDuplicates": 71 | If an icon is repeated under different names, you can consolidate and just 72 | use one of the icons and delete the others to make your application 73 | smaller. However, duplicated icons usually are not intentional and can 74 | sometimes point to icons that were accidentally overwritten or accidentally 75 | not updated. 76 | 77 | 6 errors, 2 warnings 78 | -------------------------------------------------------------------------------- /app/report/zincXmlReport.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 16 | 20 | 21 | 22 | 32 | 36 | 37 | 38 | 48 | 52 | 53 | 54 | 62 | 64 | 65 | 66 | 76 | 80 | 84 | 88 | 92 | 93 | 94 | 102 | 104 | 105 | 106 | 114 | 116 | 117 | 118 | 126 | 128 | 130 | 131 | 132 | 133 | -------------------------------------------------------------------------------- /app/src/androidTest/java/com/zinc/gradlestudy/ExampleInstrumentedTest.java: -------------------------------------------------------------------------------- 1 | package com.zinc.gradlestudy; 2 | 3 | import android.content.Context; 4 | 5 | import androidx.test.platform.app.InstrumentationRegistry; 6 | import androidx.test.runner.AndroidJUnit4; 7 | 8 | import org.junit.Test; 9 | import org.junit.runner.RunWith; 10 | 11 | import static org.junit.Assert.*; 12 | 13 | /** 14 | * Instrumented test, which will execute on an Android device. 15 | * 16 | * @see Testing documentation 17 | */ 18 | @RunWith(AndroidJUnit4.class) 19 | public class ExampleInstrumentedTest { 20 | @Test 21 | public void useAppContext() { 22 | // Context of the app under test. 23 | Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext(); 24 | 25 | assertEquals("com.zinc.gradlestudy.real.debug", appContext.getPackageName()); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /app/src/free/java/com/zinc/gradlestudy/TestUtils.java: -------------------------------------------------------------------------------- 1 | package com.zinc.gradlestudy; 2 | 3 | /** 4 | * author : zinc 5 | * time : 2019-09-07 11:33 6 | * desc : 7 | * version : 8 | */ 9 | public class TestUtils { 10 | 11 | public static void test(){ 12 | 13 | } 14 | 15 | } 16 | -------------------------------------------------------------------------------- /app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 33 | 34 | 35 | 36 | -------------------------------------------------------------------------------- /app/src/main/ZincManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /app/src/main/aidl/com/zinc/gradlestudy/IMyAidlInterface.aidl: -------------------------------------------------------------------------------- 1 | // IMyAidlInterface.aidl 2 | package com.zinc.gradlestudy; 3 | 4 | // Declare any non-default types here with import statements 5 | 6 | interface IMyAidlInterface { 7 | /** 8 | * Demonstrates some basic types that you can use as parameters 9 | * and return values in AIDL. 10 | */ 11 | void basicTypes(int anInt, long aLong, boolean aBoolean, float aFloat, 12 | double aDouble, String aString); 13 | } 14 | -------------------------------------------------------------------------------- /app/src/main/assets/t112.bat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zincPower/GradleStudy/d8da754d8c5d378d05c5b32684b6f2e09a154884/app/src/main/assets/t112.bat -------------------------------------------------------------------------------- /app/src/main/assets/t121212.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zincPower/GradleStudy/d8da754d8c5d378d05c5b32684b6f2e09a154884/app/src/main/assets/t121212.png -------------------------------------------------------------------------------- /app/src/main/assets/t3123123.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zincPower/GradleStudy/d8da754d8c5d378d05c5b32684b6f2e09a154884/app/src/main/assets/t3123123.jpg -------------------------------------------------------------------------------- /app/src/main/java/com/zinc/gradlestudy/App.java: -------------------------------------------------------------------------------- 1 | package com.zinc.gradlestudy; 2 | 3 | /** 4 | * author : zinc 5 | * time : 2019-09-14 17:07 6 | * desc : 7 | * version : 8 | */ 9 | public class App { 10 | } 11 | -------------------------------------------------------------------------------- /app/src/main/java/com/zinc/gradlestudy/MainActivity.java: -------------------------------------------------------------------------------- 1 | package com.zinc.gradlestudy; 2 | 3 | import androidx.appcompat.app.AppCompatActivity; 4 | 5 | import android.os.Bundle; 6 | import android.widget.TextView; 7 | 8 | public class MainActivity extends AppCompatActivity { 9 | 10 | @Override 11 | protected void onCreate(Bundle savedInstanceState) { 12 | super.onCreate(savedInstanceState); 13 | setContentView(R.layout.activity_main); 14 | 15 | ((TextView) findViewById(R.id.tv)) 16 | .setText(BuildConfig.VERSION_CODE + "--" + BuildConfig.VERSION_NAME); 17 | 18 | // TestUtils.test(); 19 | 20 | // Test test = new Test(); 21 | // test.show(this); 22 | // 23 | // int hi = test.hi(1, 4); 24 | // ((TextView) findViewById(R.id.tv_content)).setText("江澎涌 zinc " + hi); 25 | // 26 | // String name = BuildConfig.name; 27 | // int age = BuildConfig.age; 28 | 29 | // com.zinc.ZincPower zincPower = new com.zinc.ZincPower(); 30 | // int zinc = zincPower.hi(1, 4); 31 | // zincPower.show(this, zinc + ""); 32 | 33 | // Jpy jpy = new Jpy(); 34 | // jpy.say(); 35 | 36 | // Xpy xpy = new Xpy(); 37 | // xpy.say(); 38 | 39 | // Zinc zinc1 = new Zinc(); 40 | // zinc1.say(); 41 | 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /app/src/main/java/com/zinc/gradlestudy/ZincPower.java: -------------------------------------------------------------------------------- 1 | package com.zinc.gradlestudy; 2 | 3 | import android.content.Context; 4 | import android.widget.Toast; 5 | 6 | /** 7 | * author : zinc 8 | * time : 2019-09-15 16:17 9 | * desc : 10 | * version : 11 | */ 12 | public class ZincPower { 13 | 14 | public void show(Context context,String content) { 15 | int hi = hi(1, 2); 16 | Toast.makeText(context, "zinc" + +hi+" "+content, Toast.LENGTH_SHORT).show(); 17 | } 18 | 19 | public int hi(int i, int j) { 20 | return i + j; 21 | } 22 | 23 | } 24 | -------------------------------------------------------------------------------- /app/src/main/jniLibs/armeabi-v7a/libtest.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zincPower/GradleStudy/d8da754d8c5d378d05c5b32684b6f2e09a154884/app/src/main/jniLibs/armeabi-v7a/libtest.so -------------------------------------------------------------------------------- /app/src/main/jniLibs/x86/libtest.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zincPower/GradleStudy/d8da754d8c5d378d05c5b32684b6f2e09a154884/app/src/main/jniLibs/x86/libtest.so -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/ic_gradle_study.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zincPower/GradleStudy/d8da754d8c5d378d05c5b32684b6f2e09a154884/app/src/main/res/drawable-hdpi/ic_gradle_study.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-ldpi/ic_gradle_study.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zincPower/GradleStudy/d8da754d8c5d378d05c5b32684b6f2e09a154884/app/src/main/res/drawable-ldpi/ic_gradle_study.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-mdpi/ic_gradle_study.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zincPower/GradleStudy/d8da754d8c5d378d05c5b32684b6f2e09a154884/app/src/main/res/drawable-mdpi/ic_gradle_study.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/ic_gradle_study.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zincPower/GradleStudy/d8da754d8c5d378d05c5b32684b6f2e09a154884/app/src/main/res/drawable-xhdpi/ic_gradle_study.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/ic_gradle_study.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zincPower/GradleStudy/d8da754d8c5d378d05c5b32684b6f2e09a154884/app/src/main/res/drawable-xxhdpi/ic_gradle_study.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxxhdpi/ic_gradle_study.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zincPower/GradleStudy/d8da754d8c5d378d05c5b32684b6f2e09a154884/app/src/main/res/drawable-xxxhdpi/ic_gradle_study.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_arrow_drop_down_black_24dp.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 10 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_gradle_study.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zincPower/GradleStudy/d8da754d8c5d378d05c5b32684b6f2e09a154884/app/src/main/res/drawable/ic_gradle_study.png -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_main.xml: -------------------------------------------------------------------------------- 1 | 2 | 9 | 10 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zincPower/GradleStudy/d8da754d8c5d378d05c5b32684b6f2e09a154884/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/t1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zincPower/GradleStudy/d8da754d8c5d378d05c5b32684b6f2e09a154884/app/src/main/res/mipmap-hdpi/t1.jpg -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/t11.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zincPower/GradleStudy/d8da754d8c5d378d05c5b32684b6f2e09a154884/app/src/main/res/mipmap-hdpi/t11.jpg -------------------------------------------------------------------------------- /app/src/main/res/mipmap-ldpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zincPower/GradleStudy/d8da754d8c5d378d05c5b32684b6f2e09a154884/app/src/main/res/mipmap-ldpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-ldpi/t1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zincPower/GradleStudy/d8da754d8c5d378d05c5b32684b6f2e09a154884/app/src/main/res/mipmap-ldpi/t1.jpg -------------------------------------------------------------------------------- /app/src/main/res/mipmap-ldpi/t11.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zincPower/GradleStudy/d8da754d8c5d378d05c5b32684b6f2e09a154884/app/src/main/res/mipmap-ldpi/t11.jpg -------------------------------------------------------------------------------- /app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zincPower/GradleStudy/d8da754d8c5d378d05c5b32684b6f2e09a154884/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-mdpi/t1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zincPower/GradleStudy/d8da754d8c5d378d05c5b32684b6f2e09a154884/app/src/main/res/mipmap-mdpi/t1.jpg -------------------------------------------------------------------------------- /app/src/main/res/mipmap-mdpi/t11.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zincPower/GradleStudy/d8da754d8c5d378d05c5b32684b6f2e09a154884/app/src/main/res/mipmap-mdpi/t11.jpg -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zincPower/GradleStudy/d8da754d8c5d378d05c5b32684b6f2e09a154884/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/t1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zincPower/GradleStudy/d8da754d8c5d378d05c5b32684b6f2e09a154884/app/src/main/res/mipmap-xhdpi/t1.jpg -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/t11.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zincPower/GradleStudy/d8da754d8c5d378d05c5b32684b6f2e09a154884/app/src/main/res/mipmap-xhdpi/t11.jpg -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zincPower/GradleStudy/d8da754d8c5d378d05c5b32684b6f2e09a154884/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/t1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zincPower/GradleStudy/d8da754d8c5d378d05c5b32684b6f2e09a154884/app/src/main/res/mipmap-xxhdpi/t1.jpg -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/t11.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zincPower/GradleStudy/d8da754d8c5d378d05c5b32684b6f2e09a154884/app/src/main/res/mipmap-xxhdpi/t11.jpg -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zincPower/GradleStudy/d8da754d8c5d378d05c5b32684b6f2e09a154884/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxxhdpi/t1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zincPower/GradleStudy/d8da754d8c5d378d05c5b32684b6f2e09a154884/app/src/main/res/mipmap-xxxhdpi/t1.jpg -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxxhdpi/t11.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zincPower/GradleStudy/d8da754d8c5d378d05c5b32684b6f2e09a154884/app/src/main/res/mipmap-xxxhdpi/t11.jpg -------------------------------------------------------------------------------- /app/src/main/res/values-en/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | GradleStudy-en 3 | zinc Power test Content 4 | zinc 5 | 6 | -------------------------------------------------------------------------------- /app/src/main/res/values-fr/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | GradleStudy-fr 3 | zinc Power test Content 4 | 小盆友 5 | 6 | -------------------------------------------------------------------------------- /app/src/main/res/values-zh/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | GradleStudy-zh 3 | zinc Power test Content 4 | 小盆友 5 | 6 | -------------------------------------------------------------------------------- /app/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #008577 4 | #00574B 5 | #D81B60 6 | 7 | -------------------------------------------------------------------------------- /app/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | GradleStudy 3 | zinc Power test Content 4 | 5 | zinc 6 | 7 | 8 | -------------------------------------------------------------------------------- /app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /app/src/main/res2/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | GradleStudy 3 | zinc Power test Content 4 | 小盆友 5 | 6 | -------------------------------------------------------------------------------- /app/src/main/zinc-res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 小盆友 5 | 6 | -------------------------------------------------------------------------------- /app/src/main/zincAidl/com/zinc/gradlestudy/IMyAidlInterface.aidl: -------------------------------------------------------------------------------- 1 | // IMyAidlInterface.aidl 2 | package com.zinc.gradlestudy; 3 | 4 | // Declare any non-default types here with import statements 5 | 6 | interface IMyAidlInterface { 7 | /** 8 | * Demonstrates some basic types that you can use as parameters 9 | * and return values in AIDL. 10 | */ 11 | void basicTypes(int anInt, long aLong, boolean aBoolean, float aFloat, 12 | double aDouble, String aString); 13 | } 14 | -------------------------------------------------------------------------------- /app/src/main/zincAssets/zinc11.bat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zincPower/GradleStudy/d8da754d8c5d378d05c5b32684b6f2e09a154884/app/src/main/zincAssets/zinc11.bat -------------------------------------------------------------------------------- /app/src/test/java/com/zinc/gradlestudy/ExampleUnitTest.java: -------------------------------------------------------------------------------- 1 | package com.zinc.gradlestudy; 2 | 3 | import org.junit.Test; 4 | 5 | import static org.junit.Assert.*; 6 | 7 | /** 8 | * Example local unit test, which will execute on the development machine (host). 9 | * 10 | * @see Testing documentation 11 | */ 12 | public class ExampleUnitTest { 13 | @Test 14 | public void addition_isCorrect() { 15 | assertEquals(4, 2 + 2); 16 | System.out.println(System.getProperty("zinc")); 17 | } 18 | } -------------------------------------------------------------------------------- /app/src/test/java/com/zinc/gradlestudy/JTest.java: -------------------------------------------------------------------------------- 1 | package com.zinc.gradlestudy; 2 | 3 | import org.junit.Test; 4 | 5 | import static org.junit.Assert.assertEquals; 6 | 7 | /** 8 | * Example local unit test, which will execute on the development machine (host). 9 | * 10 | * @see Testing documentation 11 | */ 12 | public class JTest { 13 | @Test 14 | public void addition_isCorrect() { 15 | assertEquals(4, 2 + 2); 16 | System.out.println(System.getProperty("zinc")); 17 | } 18 | } -------------------------------------------------------------------------------- /app/src/zincPower/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /app/src/zincPower/java/com/zinc/ZincPower.java: -------------------------------------------------------------------------------- 1 | package com.zinc; 2 | 3 | /** 4 | * author : zinc 5 | * time : 2019-11-19 09:23 6 | * desc : 7 | * version : 8 | */ 9 | public class ZincPower { 10 | } 11 | -------------------------------------------------------------------------------- /app/src/zincPower/res/values/zincValue.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | zinc 5 | 6 | -------------------------------------------------------------------------------- /app/zinc: -------------------------------------------------------------------------------- 1 | test...... -------------------------------------------------------------------------------- /app/zinc_AppExtension.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.application' 2 | 3 | android { 4 | compileSdkVersion 28 5 | buildToolsVersion "29.0.1" 6 | defaultConfig { 7 | applicationId "com.zinc.gradlestudy" 8 | minSdkVersion 19 9 | targetSdkVersion 28 10 | versionCode 1 11 | versionName "1.0" 12 | testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" 13 | } 14 | 15 | buildTypes { 16 | release { 17 | minifyEnabled false 18 | proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' 19 | } 20 | } 21 | 22 | // http://google.github.io/android-gradle-dsl/3.3/com.android.build.gradle.AppExtension.html 23 | android.applicationVariants.all { variant -> 24 | // def mergedFlavor = variant.getMergedFlavor() 25 | // Defines the value of a build variable you can use in the manifest. 26 | // mergedFlavor.manifestPlaceholders = [hostName:"www.example.com/${variant.versionName}"] 27 | 28 | println variant.name 29 | 30 | println variant.outputs*.outputFile 31 | } 32 | 33 | } 34 | 35 | dependencies { 36 | implementation fileTree(dir: 'libs', include: ['*.jar']) 37 | implementation 'androidx.appcompat:appcompat:1.0.2' 38 | implementation 'androidx.constraintlayout:constraintlayout:1.1.3' 39 | testImplementation 'junit:junit:4.12' 40 | androidTestImplementation 'androidx.test:runner:1.1.1' 41 | androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1' 42 | } 43 | -------------------------------------------------------------------------------- /app/zinc_LibraryExtension.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.application' 2 | 3 | android { 4 | compileSdkVersion 28 5 | buildToolsVersion "29.0.1" 6 | defaultConfig { 7 | applicationId "com.zinc.gradlestudy" 8 | minSdkVersion 19 9 | targetSdkVersion 28 10 | versionCode 1 11 | versionName "1.0" 12 | testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" 13 | } 14 | 15 | buildTypes { 16 | release { 17 | minifyEnabled false 18 | proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' 19 | } 20 | } 21 | 22 | } 23 | 24 | dependencies { 25 | implementation fileTree(dir: 'libs', include: ['*.jar']) 26 | implementation 'androidx.appcompat:appcompat:1.0.2' 27 | implementation 'androidx.constraintlayout:constraintlayout:1.1.3' 28 | testImplementation 'junit:junit:4.12' 29 | androidTestImplementation 'androidx.test:runner:1.1.1' 30 | androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1' 31 | 32 | // implementation project(path: ':zinclibrary', configuration: 'release') 33 | } 34 | -------------------------------------------------------------------------------- /app/zinc_PackagingOptions.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.application' 2 | 3 | android { 4 | compileSdkVersion 28 5 | buildToolsVersion "29.0.1" 6 | defaultConfig { 7 | applicationId "com.zinc.gradlestudy" 8 | minSdkVersion 19 9 | targetSdkVersion 28 10 | versionCode 1 11 | versionName "1.0" 12 | testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" 13 | } 14 | 15 | buildTypes { 16 | release { 17 | minifyEnabled false 18 | proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' 19 | } 20 | } 21 | 22 | packagingOptions{ 23 | // http://google.github.io/android-gradle-dsl/3.3/com.android.build.gradle.internal.dsl.PackagingOptions.html 24 | // 当多个时,取第一个,没有默认值 25 | pickFirsts = [] 26 | // 合并,默认为 /META-INF/services/** 27 | merges = [] 28 | // 排除 29 | excludes = [] 30 | } 31 | 32 | } 33 | 34 | dependencies { 35 | implementation fileTree(dir: 'libs', include: ['*.jar']) 36 | implementation 'androidx.appcompat:appcompat:1.0.2' 37 | implementation 'androidx.constraintlayout:constraintlayout:1.1.3' 38 | testImplementation 'junit:junit:4.12' 39 | androidTestImplementation 'androidx.test:runner:1.1.1' 40 | androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1' 41 | } 42 | -------------------------------------------------------------------------------- /app/zinc_aaptOptions.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.application' 2 | 3 | android { 4 | compileSdkVersion 28 5 | buildToolsVersion "29.0.1" 6 | defaultConfig { 7 | applicationId "com.zinc.gradlestudy" 8 | minSdkVersion 19 9 | targetSdkVersion 28 10 | versionCode 1 11 | versionName "1.0" 12 | testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" 13 | } 14 | 15 | buildTypes { 16 | release { 17 | minifyEnabled false 18 | proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' 19 | } 20 | } 21 | 22 | // 资源合并优先级: 23 | // Variant(helloDebug) > buildType(Debug) > zinc_flavor(hello) > (main > aapt -S) > dependencies 24 | 25 | // aapt 编译资源文件 26 | // 命令行通过 aapt 可以查看可输入的 27 | // https://developer.android.com/studio/command-line/aapt2 28 | aaptOptions{ 29 | // // aapt 执行的额外参数 30 | // // --rename-manifest-package 更改包名 31 | // additionalParameters '--rename-manifest-package','com.zinc.test' 32 | // additionalParameters '-R', 'src/main/res2/', '--auto-add-overlay' 33 | // additionalParameters '-v' 34 | 35 | // 对 png 进行优化检查 36 | // cruncherEnabled false 37 | 38 | // failOnMissingConfigEntry true 39 | 40 | // cruncherProcesses 4 41 | 42 | // 忽略掉 png 后缀的图像,只会排除 assets 下的资源,res下的资源不会排除 43 | // ignoreAssets "*.png" 44 | // ignoreAssetsPattern '*.png' 45 | 46 | // 是否对资源进行压缩,如果传入'',则表明不会进行压缩,默认不对"jpg"、"png"压缩 47 | // aapt l -v apk路径 进行查看 48 | // noCompress '' 49 | // 不对 bat 进行压缩 50 | // noCompress '.bat' 51 | } 52 | 53 | } 54 | 55 | dependencies { 56 | implementation fileTree(dir: 'libs', include: ['*.jar']) 57 | implementation 'androidx.appcompat:appcompat:1.0.2' 58 | implementation 'androidx.constraintlayout:constraintlayout:1.1.3' 59 | testImplementation 'junit:junit:4.12' 60 | androidTestImplementation 'androidx.test:runner:1.1.1' 61 | androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1' 62 | } 63 | -------------------------------------------------------------------------------- /app/zinc_adbOptions.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.application' 2 | 3 | android { 4 | compileSdkVersion 28 5 | buildToolsVersion "29.0.1" 6 | defaultConfig { 7 | applicationId "com.zinc.gradlestudy" 8 | minSdkVersion 19 9 | targetSdkVersion 28 10 | versionCode 10000 11 | versionName "1.1.0" 12 | testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" 13 | } 14 | 15 | buildTypes { 16 | release { 17 | minifyEnabled false 18 | proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' 19 | } 20 | } 21 | 22 | // terminal 输入 adb 可以查看 23 | adbOptions { 24 | // apk 安装时候可选参数 25 | // adb install -d 26 | installOptions '-d' 27 | // adb 执行超时时间 毫秒 28 | timeOutInMs 5 * 1000 29 | } 30 | 31 | } 32 | 33 | dependencies { 34 | implementation fileTree(dir: 'libs', include: ['*.jar']) 35 | implementation 'androidx.appcompat:appcompat:1.0.2' 36 | implementation 'androidx.constraintlayout:constraintlayout:1.1.3' 37 | testImplementation 'junit:junit:4.12' 38 | androidTestImplementation 'androidx.test:runner:1.1.1' 39 | androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1' 40 | } 41 | -------------------------------------------------------------------------------- /app/zinc_buildTypes.gradle: -------------------------------------------------------------------------------- 1 | // abc.gradle 会被映射为 project 2 | 3 | // 传递了一个 map集合 4 | apply plugin: 'com.android.application' 5 | 6 | android { 7 | // 编译源代码时,使用的sdk版本 使用/Users/zinc/Library/Android/sdk/platforms/android-28/android.jar 8 | // 作为classPath 进行编译 9 | compileSdkVersion 28 10 | // 这里会找到 /Users/zinc/Library/Android/sdk/build-tools/29.0.1 里的工具进行编译, 11 | // eg: aapt、aidl 12 | buildToolsVersion "29.0.1" 13 | 14 | defaultConfig { 15 | minSdkVersion 19 16 | targetSdkVersion 28 17 | versionCode 1000 18 | versionName "1.0" 19 | 20 | testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" 21 | 22 | } 23 | 24 | // http://google.github.io/android-gradle-dsl/3.3/com.android.build.gradle.internal.dsl.BuildType.html 25 | buildTypes { 26 | release { 27 | minifyEnabled true 28 | // proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' 29 | proguardFiles = [getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'] 30 | } 31 | 32 | debug { 33 | // 和风味是一样的,会追加 34 | applicationIdSuffix '.debug' 35 | // debug 分支默认为 true, 设置为 false 则无法启用调试模式 36 | debuggable false 37 | // debug 分支默认为 true, 设置为 false 则无法启用调试模式, ndk调试 38 | jniDebuggable false 39 | 40 | // manifestPlaceholders = [] 41 | 42 | // 开启混淆,代码优化 https://developer.android.com/studio/build/shrink-code 43 | minifyEnabled false 44 | proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' 45 | 46 | // 这三个会覆盖在风味中设置的值 47 | multiDexEnabled false 48 | // multiDexKeepFile 49 | // multiDexKeepProguard 50 | 51 | // 渲染脚本等级 52 | // renderscriptOptimLevel 53 | 54 | // 是否压缩资源 55 | shrinkResources false 56 | 57 | // 签名 58 | // signingConfig signingConfigs.mySign 59 | 60 | // 测试覆盖率,记得把混淆关上 61 | // ./gradlew :app:tasks 查看所有任务 62 | // ./gradlew cFAVDCR 用驼峰式进行运行 63 | // 产生报告路径 64 | // Users/zinc/Documents/code/gradle/GradleStudy/app/build/reports/coverage/freeArmeabiV7a/debug/index.html 65 | testCoverageEnabled true 66 | 67 | pseudoLocalesEnabled true 68 | 69 | renderscriptDebuggable true 70 | 71 | // setProguardFiles() 72 | 73 | } 74 | 75 | local { 76 | initWith debug { 77 | minifyEnabled false 78 | proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' 79 | matchingFallbacks = ['zinc', 'release', 'debug'] 80 | versionNameSuffix ".1000" 81 | } 82 | } 83 | 84 | } 85 | 86 | } 87 | 88 | dependencies { 89 | implementation fileTree(dir: 'libs', include: ['*.jar']) 90 | implementation 'androidx.appcompat:appcompat:1.0.2' 91 | implementation 'androidx.constraintlayout:constraintlayout:1.1.3' 92 | testImplementation 'junit:junit:4.12' 93 | androidTestImplementation 'androidx.test:runner:1.1.1' 94 | androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1' 95 | 96 | androidTestImplementation 'com.android.support:support-annotations:28.0.0' 97 | androidTestImplementation 'com.android.support.test:runner:1.0.2' 98 | 99 | implementation project(":lib:library") 100 | implementation project(":zinclibrary") 101 | implementation project(":matchingalibrary") 102 | } 103 | -------------------------------------------------------------------------------- /app/zinc_compileOptions.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.application' 2 | 3 | android { 4 | compileSdkVersion 28 5 | buildToolsVersion "29.0.1" 6 | defaultConfig { 7 | applicationId "com.zinc.gradlestudy" 8 | minSdkVersion 19 9 | targetSdkVersion 28 10 | versionCode 1 11 | versionName "1.0" 12 | testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" 13 | } 14 | 15 | buildTypes { 16 | release { 17 | minifyEnabled false 18 | proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' 19 | } 20 | } 21 | 22 | compileOptions{ 23 | 24 | // Java source files encoding. 25 | // JAVA 源文件编码,默认为 utf-8 26 | encoding 'UTF-8' 27 | 28 | // Whether Java compilation should be incremental or not. 29 | // java编译是否使用增量模式 30 | incremental true 31 | 32 | // Language level of the java source code. 33 | sourceCompatibility JavaVersion.VERSION_1_8 34 | 35 | // Version of the generated Java bytecode. 36 | targetCompatibility JavaVersion.VERSION_1_8 37 | 38 | } 39 | 40 | } 41 | 42 | dependencies { 43 | implementation fileTree(dir: 'libs', include: ['*.jar']) 44 | implementation 'androidx.appcompat:appcompat:1.0.2' 45 | implementation 'androidx.constraintlayout:constraintlayout:1.1.3' 46 | testImplementation 'junit:junit:4.12' 47 | androidTestImplementation 'androidx.test:runner:1.1.1' 48 | androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1' 49 | } 50 | -------------------------------------------------------------------------------- /app/zinc_databinding.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.application' 2 | 3 | android { 4 | compileSdkVersion 28 5 | buildToolsVersion "29.0.1" 6 | defaultConfig { 7 | applicationId "com.zinc.gradlestudy" 8 | minSdkVersion 19 9 | targetSdkVersion 28 10 | versionCode 1 11 | versionName "1.0" 12 | testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" 13 | } 14 | buildTypes { 15 | release { 16 | minifyEnabled false 17 | proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' 18 | } 19 | } 20 | 21 | // 开启则会帮我把 /Users/zinc/Library/Android/sdk/extras/android/m2repository/com/android/databinding 的资源引入 22 | // https://developer.android.com/topic/libraries/data-binding/start 23 | dataBinding{ 24 | enabled true 25 | } 26 | 27 | } 28 | 29 | dependencies { 30 | implementation fileTree(dir: 'libs', include: ['*.jar']) 31 | implementation 'androidx.appcompat:appcompat:1.0.2' 32 | implementation 'androidx.constraintlayout:constraintlayout:1.1.3' 33 | testImplementation 'junit:junit:4.12' 34 | androidTestImplementation 'androidx.test:runner:1.1.1' 35 | androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1' 36 | } 37 | -------------------------------------------------------------------------------- /app/zinc_defaultConfig.gradle: -------------------------------------------------------------------------------- 1 | // abc.gradle 会被映射为 project 2 | 3 | // 传递了一个 map集合 4 | apply plugin: 'com.android.application' 5 | 6 | android { 7 | // 编译源代码时,使用的sdk版本 使用/Users/zinc/Library/Android/sdk/platforms/android-28/android.jar 8 | // 作为classPath 进行编译 9 | compileSdkVersion 28 10 | // 这里会找到 /Users/zinc/Library/Android/sdk/build-tools/29.0.1 里的工具进行编译, 11 | // eg: aapt、aidl 12 | buildToolsVersion "29.0.1" 13 | defaultConfig { 14 | // applicationId 应用的包名 15 | // applicationId 会替换 AndroidManifest.xml 中的 manifest 标签下 package 的 value 16 | applicationId "com.zinc.gradlestudy.real" 17 | // applicationIdSuffix "test" 18 | 19 | minSdkVersion 19 20 | // maxSdkVersion 28 21 | targetSdkVersion 28 22 | versionCode 1 23 | versionName "1.0" 24 | // versionNameSuffix "test" 25 | testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" 26 | 27 | // svg 支持 28 | vectorDrawables { 29 | // 如果 minSdkVersion 小于 21,只生成mdpi的png 30 | generatedDensities 'mdpi' 31 | 32 | // 设置为 true,会忽略 generatedDensities ,会加入svg兼容包 33 | useSupportLibrary true 34 | } 35 | 36 | // native "构建配置"!!! 定义在BaseFlavor,查看 ExternalNativeBuildOptions 37 | externalNativeBuild { 38 | // 例如过滤一些 cpu架构 39 | ndkBuild { 40 | // Passes an optional argument to ndk-build. 41 | arguments "NDK_MODULE_PATH+=../../third_party/modules" 42 | } 43 | // For ndk-build, instead use the ndkBuild block. 44 | cmake { 45 | // Passes optional arguments to CMake. 46 | arguments "-DANDROID_ARM_NEON=TRUE", "-DANDROID_TOOLCHAIN=clang" 47 | 48 | // Sets a flag to enable format macro constants for the C compiler. 49 | cFlags "-D__STDC_FORMAT_MACROS" 50 | 51 | // Sets optional flags for the C++ compiler. 52 | cppFlags "-fexceptions", "-frtti" 53 | 54 | // Specifies the library and executable targets from your CMake project 55 | // that Gradle should build. 56 | targets "libexample-one", "my-executible-demo" 57 | } 58 | } 59 | 60 | // 配置 java apt 61 | javaCompileOptions { 62 | annotationProcessorOptions { 63 | // arguments = ['':''] 64 | } 65 | } 66 | 67 | // 用来占位 manifest 68 | manifestPlaceholders = [ 69 | key: '123' 70 | ] 71 | 72 | // 是否开启分包 65k问题 索引值为两个字节,所以最大为0xffff,需要进行dex分包 73 | // multiDexEnabled true 74 | // 分包规则 每一行表示需要配置到主dex的一个类 com/a/c/c.class 75 | // multiDexKeepFile file('multidex-config.txt') 76 | // -keep com.a.b.c.**{*;} 和上面写法一样 77 | // multiDexKeepProguard file('multidex-config.pro') 78 | 79 | // 打包到ndk的配置,这样产生的apk包只包含'armeabi-v7a' 80 | ndk { 81 | abiFilter 'armeabi-v7a' 82 | } 83 | 84 | // 可以通过 BuildConfig 进行获取 85 | buildConfigField('String', 'name', '"zinc"') 86 | buildConfigField('int', 'age', '26') 87 | 88 | // 添加至 res/value,通过 R.string.age 获取 89 | resValue('string', 'age', '12year') 90 | 91 | // 剔除掉 Library 带来的 风味维度 92 | missingDimensionStrategy 'zinc', 'minApi13', 'minApi23' 93 | missingDimensionStrategy 'handsome', 'x86', 'arm64' 94 | 95 | // resConfig "zh" 96 | // resConfigs "zh","en" 97 | 98 | } 99 | 100 | buildTypes { 101 | release { 102 | minifyEnabled true 103 | proguardFiles = [getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'] 104 | } 105 | 106 | } 107 | 108 | } 109 | 110 | dependencies { 111 | implementation fileTree(dir: 'libs', include: ['*.jar']) 112 | implementation 'androidx.appcompat:appcompat:1.0.2' 113 | implementation 'androidx.constraintlayout:constraintlayout:1.1.3' 114 | testImplementation 'junit:junit:4.12' 115 | androidTestImplementation 'androidx.test:runner:1.1.1' 116 | androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1' 117 | 118 | androidTestImplementation 'com.android.support:support-annotations:28.0.0' 119 | androidTestImplementation 'com.android.support.test:runner:1.0.2' 120 | 121 | implementation project(":lib:library") 122 | implementation project(":zinclibrary") 123 | implementation project(":matchingalibrary") 124 | } 125 | -------------------------------------------------------------------------------- /app/zinc_dexOptions.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.application' 2 | 3 | android { 4 | compileSdkVersion 28 5 | buildToolsVersion "29.0.1" 6 | defaultConfig { 7 | applicationId "com.zinc.gradlestudy" 8 | minSdkVersion 19 9 | targetSdkVersion 28 10 | versionCode 1 11 | versionName "1.0" 12 | testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" 13 | } 14 | 15 | buildTypes { 16 | release { 17 | minifyEnabled false 18 | proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' 19 | } 20 | 21 | debug { 22 | // 开启 dex 分包 23 | multiDexEnabled true 24 | // 设置将需要保存至主dex的文件 25 | multiDexKeepFile file('keep/keep_in_main_dex.txt') 26 | } 27 | } 28 | 29 | dexOptions { 30 | // 可以使用 "dx --help" 进行查看 31 | // 例如:dex 的 分包 [--multi-dex [--main-dex-list= [--minimal-main-dex]] 32 | // dex 的 分包需要达到65,而如果设置了--minimal-main-dex ,则会让 proguardFile 设置的文件放进主dex文件 33 | // 1. multiDexEnabled --> --multi-dex 34 | // 2. proguardFile --> --main-dex-list= 35 | additionalParameters '--minimal-main-dex' 36 | 37 | // 设置运行内存 38 | javaMaxHeapSize '2048m' 39 | 40 | // 大模式 41 | jumboMode true 42 | 43 | // 是否保存 被运行时注解的类 保存至主dex 44 | keepRuntimeAnnotatedClasses false 45 | 46 | // 最大进程数 默认为4 47 | maxProcessCount 4 48 | 49 | // 线程数 50 | threadCount 4 51 | 52 | // 预编译 dex lib,在我们build的时候会快些,但clean时便会慢,默认开启 53 | preDexLibraries true 54 | } 55 | 56 | } 57 | 58 | dependencies { 59 | implementation fileTree(dir: 'libs', include: ['*.jar']) 60 | implementation 'androidx.appcompat:appcompat:1.0.2' 61 | implementation 'androidx.constraintlayout:constraintlayout:1.1.3' 62 | testImplementation 'junit:junit:4.12' 63 | androidTestImplementation 'androidx.test:runner:1.1.1' 64 | androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1' 65 | } 66 | -------------------------------------------------------------------------------- /app/zinc_externalNativeBuild.gradle: -------------------------------------------------------------------------------- 1 | // abc.gradle 会被映射为 project 2 | 3 | // 传递了一个 map集合 4 | apply plugin: 'com.android.application' 5 | 6 | android { 7 | // 编译源代码时,使用的sdk版本 使用/Users/zinc/Library/Android/sdk/platforms/android-28/android.jar 8 | // 作为classPath 进行编译 9 | compileSdkVersion 28 10 | // 这里会找到 /Users/zinc/Library/Android/sdk/build-tools/29.0.1 里的工具进行编译, 11 | // eg: aapt、aidl 12 | buildToolsVersion "29.0.1" 13 | 14 | defaultConfig { 15 | minSdkVersion 19 16 | targetSdkVersion 28 17 | versionCode 1000 18 | versionName "1.0" 19 | 20 | testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" 21 | 22 | } 23 | 24 | externalNativeBuild { 25 | 26 | ndkBuild { 27 | path 'Android.mk' 28 | buildStagingDirectory "./outputs/ndk-build" 29 | } 30 | 31 | cmake { 32 | path "src/main/cpp/CMakeLists.txt" 33 | version "3.10.2" 34 | buildStagingDirectory "./outputs/cmake" 35 | } 36 | 37 | } 38 | 39 | buildTypes { 40 | release { 41 | minifyEnabled true 42 | proguardFiles = [getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'] 43 | } 44 | 45 | } 46 | 47 | } 48 | 49 | dependencies { 50 | implementation fileTree(dir: 'libs', include: ['*.jar']) 51 | implementation 'androidx.appcompat:appcompat:1.0.2' 52 | implementation 'androidx.constraintlayout:constraintlayout:1.1.3' 53 | testImplementation 'junit:junit:4.12' 54 | androidTestImplementation 'androidx.test:runner:1.1.1' 55 | androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1' 56 | 57 | androidTestImplementation 'com.android.support:support-annotations:28.0.0' 58 | androidTestImplementation 'com.android.support.test:runner:1.0.2' 59 | 60 | implementation project(":lib:library") 61 | implementation project(":zinclibrary") 62 | implementation project(":matchingalibrary") 63 | } 64 | -------------------------------------------------------------------------------- /app/zinc_flavor.gradle: -------------------------------------------------------------------------------- 1 | // abc.gradle 会被映射为 project 2 | 3 | // 传递了一个 map集合 4 | apply plugin: 'com.android.application' 5 | 6 | android { 7 | // 编译源代码时,使用的sdk版本 使用/Users/zinc/Library/Android/sdk/platforms/android-28/android.jar 8 | // 作为classPath 进行编译 9 | compileSdkVersion 28 10 | // 这里会找到 /Users/zinc/Library/Android/sdk/build-tools/29.0.1 里的工具进行编译, 11 | // eg: aapt、aidl 12 | buildToolsVersion "29.0.1" 13 | 14 | defaultConfig { 15 | minSdkVersion 19 16 | targetSdkVersion 28 17 | versionCode 1000 18 | versionName "1.0" 19 | 20 | testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" 21 | 22 | } 23 | 24 | buildTypes { 25 | release { 26 | minifyEnabled true 27 | proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' 28 | } 29 | } 30 | 31 | // 创建 风味 纬度 32 | flavorDimensions('product', 'abi') 33 | // 创建产品风味 34 | productFlavors { 35 | free { 36 | // applicationIdSuffix '.free' 37 | // 关联纬度 38 | dimension 'product' 39 | } 40 | 41 | pro { 42 | dimension 'product' 43 | } 44 | 45 | x86 { 46 | dimension 'abi' 47 | } 48 | 49 | armeabiV7a { 50 | dimension 'abi' 51 | } 52 | } 53 | 54 | // 过滤 风味 ,即 productFlavors 中设置的 55 | // variantFilter { 56 | // variant -> 57 | // variant.flavors.each{ 58 | // // 将 所有包含 pro 的风味去除 59 | // if(it.name.contains('pro')){ 60 | // setIgnore(true) 61 | // } 62 | // } 63 | // } 64 | 65 | } 66 | 67 | dependencies { 68 | implementation fileTree(dir: 'libs', include: ['*.jar']) 69 | implementation 'androidx.appcompat:appcompat:1.0.2' 70 | implementation 'androidx.constraintlayout:constraintlayout:1.1.3' 71 | testImplementation 'junit:junit:4.12' 72 | androidTestImplementation 'androidx.test:runner:1.1.1' 73 | androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1' 74 | 75 | androidTestImplementation 'com.android.support:support-annotations:28.0.0' 76 | androidTestImplementation 'com.android.support.test:runner:1.0.2' 77 | 78 | // implementation project(":lib:library") 79 | implementation project(":zinclibrary") 80 | implementation project(":matchingalibrary") 81 | } 82 | -------------------------------------------------------------------------------- /app/zinc_implementation.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.application' 2 | 3 | android { 4 | compileSdkVersion 28 5 | buildToolsVersion "29.0.1" 6 | defaultConfig { 7 | applicationId "com.zinc.gradlestudy" 8 | minSdkVersion 19 9 | targetSdkVersion 28 10 | versionCode 1 11 | versionName "1.0" 12 | testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" 13 | } 14 | 15 | buildTypes { 16 | release { 17 | minifyEnabled false 18 | proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' 19 | } 20 | } 21 | 22 | } 23 | 24 | repositories { 25 | flatDir { 26 | // 将一个目录设置为仓库 27 | dir('libs') 28 | } 29 | } 30 | 31 | /** 32 | * implementation 是通过 configurations 进行配置 33 | * 34 | * 我们可以通过这里注册自己的类型 35 | */ 36 | configurations { 37 | 38 | // 注册了,可以下面使用 39 | zincPower { 40 | } 41 | 42 | } 43 | 44 | /** 45 | * implementation 编译打包 46 | * 47 | * runtimeOnly 知道包进apk 48 | * 49 | * compileOnly 50 | * 51 | * https://developer.android.com/studio/build/dependencies 52 | */ 53 | dependencies { 54 | /** 55 | * 通过 {@link DependencyHandler} add 进行添加 56 | */ 57 | 58 | // 这个会让 放在 libs 下的jar包导入 59 | implementation fileTree(dir: 'libs', include: ['*.jar']) 60 | // implementation files("xx.jar") 61 | 62 | // implementation project(":lib") 63 | 64 | implementation 'androidx.appcompat:appcompat:1.0.2' 65 | testImplementation 'junit:junit:4.12' 66 | androidTestImplementation 'androidx.test:runner:1.1.1' 67 | androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1' 68 | 69 | zincPower "androidx.constraintlayout:constraintlayout:1.1.3" 70 | 71 | // ./gradlew app:dependencies 查看依赖 看"implementation"项 72 | // 本地仓库 73 | // /Users/zinc/Library/Android/sdk/extras/android/m2repository/com 74 | 75 | // 几种写法 76 | // 1、 77 | implementation 'androidx.constraintlayout:constraintlayout:1.1.0' 78 | // 2、 79 | implementation group: 'androidx.constraintlayout', name: 'constraintlayout', version: '1.1.1' 80 | // 3、 1.0.+ 会使用 最新的1.0.x的版本 81 | implementation group: 'androidx.constraintlayout', name: 'constraintlayout', version: '1.0.+' 82 | // 4、最新版本 83 | implementation group: 'androidx.constraintlayout', name: 'constraintlayout', version: 'last.integration' 84 | 85 | implementation 'com.facebook.fresco:fresco:2.0.0' 86 | 87 | // 导入aar 88 | implementation name: 'constraintlayout', ext: 'aar' 89 | 90 | } 91 | -------------------------------------------------------------------------------- /app/zinc_lintOptions.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.application' 2 | 3 | android { 4 | compileSdkVersion 28 5 | buildToolsVersion "29.0.1" 6 | defaultConfig { 7 | applicationId "com.zinc.gradlestudy" 8 | minSdkVersion 19 9 | targetSdkVersion 28 10 | versionCode 1 11 | versionName "1.0" 12 | testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" 13 | } 14 | 15 | buildTypes { 16 | release { 17 | minifyEnabled false 18 | proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' 19 | } 20 | } 21 | 22 | // 帮助发现并纠正代码结构质量 23 | // 使用 lintDebug 运行 24 | lintOptions { 25 | 26 | // 发现错误,停止构建 27 | abortOnError true 28 | 29 | // 设置类型的提示级别 30 | // 可用id 可用 "lint --list" 查找 31 | // error('UnusedResources') 32 | // ignore('UnusedResources') 33 | 34 | // 是否输出全路径 35 | // absolutePaths true 36 | 37 | // 设置只检查的。 38 | // 可用id 可用 "lint --list" 查找 39 | // check 'UnusedResources' 40 | 41 | // 是否检查所有警告 42 | // checkAllWarnings false 43 | 44 | // 在 release 版本是否检查 fatal 的类型 45 | // checkReleaseBuilds true 46 | 47 | // 关闭或开启某个id 48 | // 可用id 可用 "lint --list" 查找 49 | // disable 'UnusedResources' 50 | // enable '' 51 | 52 | // Returns whether lint should include explanations for issue errors. (Note that HTML and XML reports intentionally do this unconditionally, ignoring this setting.) 53 | // html 和 xml 的报告会忽略这个 54 | // explainIssues true 55 | 56 | // lint 配置 57 | lintConfig file('lint/rule_lint.xml') 58 | 59 | // html 的输出路径 60 | // htmlOutput file('report/zincHtmlReport.html') 61 | 62 | // 是否需要html报告 63 | // htmlReport true 64 | 65 | // 是否忽略警告,只检查error 66 | // ignoreWarnings true 67 | 68 | // 是否错误时,需要包含行数 69 | // noLines false 70 | 71 | // 是否关闭一些输出信息 72 | // quiet true 73 | 74 | // 没办法直接操作,由error()...方法操作 75 | // severityOverrides 76 | 77 | // 是否输出全部信息 78 | // showAll true 79 | 80 | // 输出 81 | // textOutput file('report/zincTextReport.txt') 82 | // textReport true 83 | 84 | // 是否将警告作为错误输出 85 | // warningsAsErrors true 86 | 87 | // xmlOutput file('report/zincXmlReport.xml') 88 | // xmlReport true 89 | } 90 | 91 | } 92 | 93 | dependencies { 94 | implementation fileTree(dir: 'libs', include: ['*.jar']) 95 | implementation 'androidx.appcompat:appcompat:1.0.2' 96 | implementation 'androidx.constraintlayout:constraintlayout:1.1.3' 97 | testImplementation 'junit:junit:4.12' 98 | androidTestImplementation 'androidx.test:runner:1.1.1' 99 | androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1' 100 | } 101 | -------------------------------------------------------------------------------- /app/zinc_sigingConfigs.gradle: -------------------------------------------------------------------------------- 1 | // abc.gradle 会被映射为 project 2 | 3 | // 传递了一个 map集合 4 | apply plugin: 'com.android.application' 5 | 6 | android { 7 | // 编译源代码时,使用的sdk版本 使用/Users/zinc/Library/Android/sdk/platforms/android-28/android.jar 8 | // 作为classPath 进行编译 9 | compileSdkVersion 28 10 | // 这里会找到 /Users/zinc/Library/Android/sdk/build-tools/29.0.1 里的工具进行编译, 11 | // eg: aapt、aidl 12 | buildToolsVersion "29.0.1" 13 | 14 | defaultConfig { 15 | minSdkVersion 19 16 | targetSdkVersion 28 17 | versionCode 1000 18 | versionName "1.0" 19 | 20 | testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" 21 | 22 | } 23 | 24 | signingConfigs { 25 | mySign { 26 | storeFile file('../key/gradleStudy.jks') 27 | storePassword 'gradleStudy' 28 | storeType 'jks' 29 | keyAlias 'gradleStudy' 30 | keyPassword '123456' 31 | v1SigningEnabled false 32 | v2SigningEnabled true 33 | } 34 | } 35 | 36 | buildTypes { 37 | release { 38 | signingConfig signingConfigs.mySign 39 | minifyEnabled false 40 | proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' 41 | 42 | println "zinc $signingConfigs.mySign" 43 | } 44 | } 45 | 46 | } 47 | 48 | dependencies { 49 | implementation fileTree(dir: 'libs', include: ['*.jar']) 50 | implementation 'androidx.appcompat:appcompat:1.0.2' 51 | implementation 'androidx.constraintlayout:constraintlayout:1.1.3' 52 | testImplementation 'junit:junit:4.12' 53 | androidTestImplementation 'androidx.test:runner:1.1.1' 54 | androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1' 55 | 56 | androidTestImplementation 'com.android.support:support-annotations:28.0.0' 57 | androidTestImplementation 'com.android.support.test:runner:1.0.2' 58 | 59 | implementation project(":lib:library") 60 | implementation project(":zinclibrary") 61 | implementation project(":matchingalibrary") 62 | } 63 | -------------------------------------------------------------------------------- /app/zinc_sourceSets.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.application' 2 | 3 | android { 4 | compileSdkVersion 28 5 | buildToolsVersion "29.0.1" 6 | defaultConfig { 7 | applicationId "com.zinc.gradlestudy" 8 | minSdkVersion 19 9 | targetSdkVersion 28 10 | versionCode 1 11 | versionName "1.0" 12 | testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" 13 | } 14 | 15 | buildTypes { 16 | release { 17 | minifyEnabled false 18 | proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' 19 | } 20 | } 21 | 22 | // 资源合并优先级: 23 | // Variant(helloDebug) > buildType(Debug) > flavor(hello) > (main > aapt -S) > dependencies 24 | 25 | sourceSets { 26 | main { 27 | 28 | // 定义多个资源目录,如果资源间有重复,则会报错 29 | // res.srcDirs 'src/main/res', 'src/main/zinc-res' 30 | 31 | // The Android AIDL source directory for this source set. 32 | // aidl.srcDirs 'src/main/aidl', 'src/main/zincAidl' 33 | 34 | // assets.srcDirs 'src/main/assets', 'src/main/zincAssets' 35 | 36 | java { 37 | srcDirs = [ 38 | 'src/main/java', 39 | 'src/main/patternFilterableDemo/exclude' 40 | ] 41 | 42 | // excludes = ['zincStudy/*.java'] 43 | 44 | // 以属性的方式设置,会覆盖之前设置的值 45 | // includes = ["com/zinc/gradlestudy/MainActivity.java"] 46 | // 以方法的形式,则不会覆盖,而是追加 47 | // include(['src/main/patternFilterableDemo/**/ZincTest.java']) 48 | 49 | // 是只读属性 50 | // sourceFiles = [fileTree(dir: 'mine', include: ['**/*.java'])] 51 | 52 | // exclude { 53 | // FileTreeElement elem -> 54 | // println "====$elem" 55 | // println "Searching for files, found: " + elem.relativePath 56 | // !(elem.isDirectory() || elem.name.equals('zinc.java')) 57 | // } 58 | } 59 | 60 | // The Android JNI source directory for this source set. 61 | // jni.srcDir '' 62 | 63 | // The Android JNI libs directory for this source set. 64 | // jniLibs.srcDir() 65 | 66 | // The Android Manifest file for this source set. 67 | // manifest.srcFile 'src/main/ZincManifest.xml' 68 | 69 | // The Android RenderScript source directory for this source set. 70 | // renderscript.srcDir '' 71 | 72 | // The Android Resources directory for this source set. 73 | // res.srcDir '' 74 | 75 | // The Java resources which are to be copied into the javaResources output directory. 76 | // resources.srcDir '' 77 | 78 | } 79 | 80 | // // hello 风味会叠加在 main 上面,而不是替换 81 | // hello { 82 | //// java.srcDir 'src/main/helloJava' 83 | // } 84 | 85 | zinc { 86 | // https://developer.android.google.cn/studio/build/gradle-tips 87 | 88 | // If all the files for a source set are located under a single root 89 | // directory, you can specify that directory using the setRoot property. 90 | // When gathering sources for the source set, Gradle looks only in locations 91 | // relative to the root directory you specify. For example, after applying 92 | // the configuration below for the androidTest source set, Gradle looks for 93 | // Java sources only in the src/tests/java/ directory. 94 | // 这段话的意思是 95 | // 如果我们的代码都在同一个目录下,可以用setRoot进行设置, 96 | // 设置了 setRoot 之后,gradle的编译只会在同级目录下找资源, 97 | // 例如:只会在 src/zincPower/java 找java代码 98 | // 会忽略 java.srcDirs 设置的路径 99 | setRoot 'src/zincPower' 100 | 101 | // 这个会忽略 102 | java.srcDirs 'zzz' 103 | } 104 | 105 | // debug.setRoot('build-types/zinc') 106 | 107 | // java { 108 | // srcDirs = [ 109 | // 'java' 110 | // ] 111 | // } 112 | 113 | // } 114 | 115 | // zinc{ 116 | // setRoot('app/src/build-types/zincApk') 117 | // manifest.srcFile 'AndroidManifest.xml' 118 | // 119 | // println "rootDir: $rootDir" 120 | //// println "root: $root" 121 | // println "rootPorject: $rootProject" 122 | // } 123 | 124 | // main.java.getIncludes().each { println "Added include: $it" } 125 | // main.java.getExcludes().each { println "Added exclude: $it" } 126 | // main.java.sourceFiles.each { println "File in source set: " + it } 127 | 128 | main.assets.getIncludes().each { println "Added include: $it" } 129 | main.assets.getExcludes().each { println "Added exclude: $it" } 130 | main.assets.sourceFiles.each { println "File in source set: " + it } 131 | } 132 | 133 | 134 | flavorDimensions('product') 135 | productFlavors { 136 | // hello { 137 | // dimension 'product' 138 | // } 139 | zinc { 140 | dimension 'product' 141 | } 142 | } 143 | 144 | } 145 | 146 | dependencies { 147 | implementation fileTree(dir: 'libs', include: ['*.jar']) 148 | implementation 'androidx.appcompat:appcompat:1.0.2' 149 | implementation 'androidx.constraintlayout:constraintlayout:1.1.3' 150 | testImplementation 'junit:junit:4.12' 151 | androidTestImplementation 'androidx.test:runner:1.1.1' 152 | androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1' 153 | } 154 | -------------------------------------------------------------------------------- /app/zinc_splits.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.application' 2 | 3 | android { 4 | compileSdkVersion 28 5 | buildToolsVersion "29.0.1" 6 | defaultConfig { 7 | applicationId "com.zinc.gradlestudy" 8 | minSdkVersion 19 9 | targetSdkVersion 28 10 | versionCode 1 11 | versionName "1.0" 12 | testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" 13 | } 14 | 15 | buildTypes { 16 | release { 17 | minifyEnabled false 18 | proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' 19 | } 20 | } 21 | 22 | splits { 23 | 24 | // language { 25 | // enable = true 26 | // include "es-rMX", "zh", "en" 27 | // } 28 | 29 | // abi { 30 | // // 是否开启 31 | // enable true 32 | // 33 | // // 排除不必要的架构 34 | //// exclude 'x86','arm64-v8a' 35 | // 36 | // // 重置包含的目录,因为已经是包含全部 37 | //// reset() 38 | // // 设置包含,调用前需要先用 reset 将默认清除 39 | //// include 'armeabi-v7a', 'x86' 40 | // 41 | // // 是否打出包含全部的apk 42 | // universalApk true 43 | // } 44 | 45 | // 分辨率 46 | density { 47 | // 开启 48 | enable true 49 | 50 | // 排除分辨率 51 | // exclude 'hdpi', 'ldpi', 'mdpi', 'xhdpi' 52 | 53 | // 重置默认分辨率列表 54 | // reset() 55 | 56 | // 包含分辨率 57 | // include 'hdpi', 'xxhdpi' 58 | 59 | // https://developer.android.com/guide/topics/manifest/compatible-screens-element 60 | // 会在 manifest 中添加 61 | compatibleScreens 'small', 'normal', 'large', 'xlarge' 62 | } 63 | } 64 | 65 | } 66 | 67 | dependencies { 68 | implementation fileTree(dir: 'libs', include: ['*.jar']) 69 | implementation 'androidx.appcompat:appcompat:1.0.2' 70 | implementation 'androidx.constraintlayout:constraintlayout:1.1.3' 71 | testImplementation 'junit:junit:4.12' 72 | androidTestImplementation 'androidx.test:runner:1.1.1' 73 | androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1' 74 | } 75 | -------------------------------------------------------------------------------- /app/zinc_testOptions.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.application' 2 | 3 | android { 4 | compileSdkVersion 28 5 | buildToolsVersion "29.0.1" 6 | defaultConfig { 7 | applicationId "com.zinc.gradlestudy" 8 | minSdkVersion 19 9 | targetSdkVersion 28 10 | versionCode 1 11 | versionName "1.0" 12 | testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" 13 | } 14 | 15 | buildTypes { 16 | release { 17 | minifyEnabled false 18 | proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' 19 | } 20 | } 21 | 22 | // ./gradlew testDebugUnitTest 23 | testOptions { 24 | // 关闭动画 25 | animationsDisabled false 26 | 27 | unitTests.all { 28 | // https://docs.gradle.org/current/javadoc/org/gradle/api/tasks/testing/Test.html 29 | systemProperty 'zinc', 'xpy' 30 | 31 | // 输出,在控制面板才能看到 32 | testLogging.showStandardStreams = true 33 | 34 | exclude 'com/zinc/gradlestudy/JTest.class' 35 | } 36 | 37 | } 38 | 39 | } 40 | 41 | dependencies { 42 | implementation fileTree(dir: 'libs', include: ['*.jar']) 43 | implementation 'androidx.appcompat:appcompat:1.0.2' 44 | implementation 'androidx.constraintlayout:constraintlayout:1.1.3' 45 | testImplementation 'junit:junit:4.12' 46 | androidTestImplementation 'androidx.test:runner:1.1.1' 47 | androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1' 48 | } 49 | -------------------------------------------------------------------------------- /app/zinc_value.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.application' 2 | 3 | android { 4 | compileSdkVersion 28 5 | buildToolsVersion "29.0.1" 6 | defaultConfig { 7 | applicationId "com.zinc.gradlestudy" 8 | minSdkVersion 19 9 | targetSdkVersion 28 10 | versionCode 1 11 | versionName "1.0" 12 | testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" 13 | } 14 | 15 | buildTypes { 16 | release { 17 | minifyEnabled false 18 | proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' 19 | } 20 | } 21 | 22 | } 23 | 24 | dependencies { 25 | implementation fileTree(dir: 'libs', include: ['*.jar']) 26 | 27 | implementation 'androidx.constraintlayout:constraintlayout:1.1.0' 28 | implementation 'androidx.appcompat:appcompat:1.0.2' 29 | testImplementation 'junit:junit:4.12' 30 | androidTestImplementation 'androidx.test:runner:1.1.1' 31 | androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1' 32 | 33 | } 34 | 35 | // 任何对象都有一个 ext 的属性 36 | //ext.subGradle = "zincSubGradle" 37 | // 38 | //def zinc = "zincPower" 39 | // 40 | //task show { 41 | // ext.showExt = "zincShowExt" 42 | // 43 | // println zinc 44 | // println "$ext $ext.showExt" 45 | // println "$project.ext $project.ext.subGradle" 46 | // println "$rootProject.ext $rootProject.ext.topGradle" 47 | // println "$PropertyZinalue" 48 | //} 49 | 50 | task A { 51 | doLast { 52 | println "A" 53 | } 54 | } 55 | 56 | task B { 57 | doLast { 58 | println "B" 59 | } 60 | } 61 | 62 | // C任务依赖于 A,B, 运行" ./gradlew app:C" 则会运行A和B, 63 | // 但A和B的顺序没有规定,如果需要确定则要编写A 和 B的顺序 64 | // [A,B] 和 [B,A] 的运行结果不会决定顺序 65 | task C(dependsOn: [A, B]) { 66 | doLast { 67 | println "C" 68 | } 69 | } 70 | 71 | // 确定 A 和 B 的顺序 72 | //A.dependsOn B 73 | 74 | // A 必须跑在 B 之后 75 | //A.mustRunAfter B 76 | 77 | // 并行情况下,B可能在A之前也可之后 78 | //A.shouldRunAfter B 79 | 80 | task D { 81 | doLast { 82 | println "D" 83 | } 84 | } 85 | 86 | // 在运行完A之后运行,可以用来执行一些资源的释放 87 | A.finalizedBy D 88 | // B 依赖于 A, A的终结任务D会在 A和B 运行间运行 89 | B.dependsOn A 90 | 91 | class ZincTask extends DefaultTask { 92 | 93 | // Input 和 OutputFile 如果都没有改,则会使用原来的,如果有改,则重新生成 94 | // @Input 95 | // // Optional 可选 96 | // @Optional 97 | // String filePath; 98 | // 99 | // @OutputFile 100 | // File file; 101 | 102 | 103 | ZincTask() { 104 | group 'zincGroup' 105 | description 'zinc的集合组' 106 | 107 | outputs.upToDateWhen { 108 | 109 | // 返回true,则开启增量,返回false,关闭 110 | false 111 | 112 | } 113 | } 114 | 115 | @TaskAction 116 | void run() { 117 | println "zincTask" 118 | 119 | println inputs.files.first() 120 | 121 | println inputs.files.singleFile 122 | } 123 | 124 | } 125 | 126 | // https://docs.gradle.org/current/dsl/index.html 127 | 128 | // 创建任务的方法 129 | // 1、 130 | //tasks.create("zincTask", ZincTask) 131 | // 2、 132 | task zinc(type: ZincTask) { 133 | // filePath = "path/to/zincTask" 134 | // file = file("zinc.txt") 135 | inputs.file file("zinc") 136 | } 137 | 138 | //task zzip(type: Zip){ 139 | // 140 | // // 压缩包的名称 141 | // archiveName 'zin.zip' 142 | // // 生成的目标 143 | // destinationDir file("${buildDir}/zip") 144 | // // 打包文件 145 | // from "zinc" 146 | // 147 | //} 148 | 149 | afterEvaluate { 150 | task zipp(type: Zip){ 151 | archiveName "zi.zip" 152 | destinationDir file("${buildDir}/zip") 153 | from tasks.getByName("packageDebug").outputs.files 154 | } 155 | } 156 | 157 | // 1、分析构建脚本 生成settings与project类 158 | // 2、进行初始化配置 159 | // 3、执行任务 160 | 161 | // 对gradle构建生命周期 hook 162 | 163 | // 在分析完成gradle 之后执行 164 | afterEvaluate { 165 | 166 | } 167 | 168 | // 对于引入了android插件的工程无效 169 | beforeEvaluate { 170 | 171 | } 172 | 173 | // 这里的和上面两个一样 174 | //gradle.addProjectEvaluationListener(new ProjectEvaluationListener() { 175 | // @Override 176 | // void beforeEvaluate(Project project) { 177 | // 178 | // } 179 | // 180 | // @Override 181 | // void afterEvaluate(Project project, ProjectState state) { 182 | // 183 | // } 184 | //}) 185 | 186 | //gradle.addListener(new BuildListener(){ 187 | // 188 | // @Override 189 | // void buildStarted(Gradle gradle) { 190 | // 191 | // } 192 | // 193 | // @Override 194 | // void settingsEvaluated(Settings settings) { 195 | // 196 | // } 197 | // 198 | // @Override 199 | // void projectsLoaded(Gradle gradle) { 200 | // 201 | // } 202 | // 203 | // @Override 204 | // void projectsEvaluated(Gradle gradle) { 205 | // 206 | // } 207 | // 208 | // @Override 209 | // void buildFinished(BuildResult result) { 210 | // 211 | // } 212 | //}) 213 | 214 | // 可以看到任务图 gradle 215 | gradle.addListener(new TaskExecutionGraphListener(){ 216 | 217 | @Override 218 | void graphPopulated(TaskExecutionGraph graph) { 219 | println graph.allTasks 220 | } 221 | 222 | }) -------------------------------------------------------------------------------- /build.gradle: -------------------------------------------------------------------------------- 1 | // Top-level build file where you can add configuration options common to all sub-projects/modules. 2 | 3 | buildscript { 4 | repositories { 5 | google() 6 | jcenter() 7 | 8 | } 9 | dependencies { 10 | classpath 'com.android.tools.build:gradle:3.5.3' 11 | 12 | // NOTE: Do not place your application dependencies here; they belong 13 | // in the individual module build.gradle files 14 | } 15 | } 16 | 17 | allprojects { 18 | repositories { 19 | google() 20 | jcenter() 21 | 22 | } 23 | } 24 | 25 | // clean 任务是 delete 的增强 26 | task clean(type: Delete) { 27 | // 删除 主项目下 的Build 28 | delete rootProject.buildDir 29 | } 30 | 31 | ext { 32 | topGradle = "zincTopGradle" 33 | } -------------------------------------------------------------------------------- /gradle.properties: -------------------------------------------------------------------------------- 1 | # Project-wide Gradle settings. 2 | # IDE (e.g. Android Studio) users: 3 | # Gradle settings configured through the IDE *will override* 4 | # any settings specified in this file. 5 | # For more details on how to configure your build environment visit 6 | # http://www.gradle.org/docs/current/userguide/build_environment.html 7 | # Specifies the JVM arguments used for the daemon process. 8 | # The setting is particularly useful for tweaking memory settings. 9 | org.gradle.jvmargs=-Xmx1536m 10 | # When configured, Gradle will run in incubating parallel mode. 11 | # This option should only be used with decoupled projects. More details, visit 12 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects 13 | # org.gradle.parallel=true 14 | # AndroidX package structure to make it clearer which packages are bundled with the 15 | # Android operating system, and which are packaged with your app's APK 16 | # https://developer.android.com/topic/libraries/support-library/androidx-rn 17 | android.useAndroidX=true 18 | # Automatically convert third-party libraries to use AndroidX 19 | android.enableJetifier=true 20 | 21 | PropertyZinalue = "zincPropertyValue" 22 | 23 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zincPower/GradleStudy/d8da754d8c5d378d05c5b32684b6f2e09a154884/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Tue Sep 03 22:44:30 CST 2019 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.3-all.zip 7 | -------------------------------------------------------------------------------- /gradlew: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | ############################################################################## 4 | ## 5 | ## Gradle start up script for UN*X 6 | ## 7 | ############################################################################## 8 | 9 | # Attempt to set APP_HOME 10 | # Resolve links: $0 may be a link 11 | PRG="$0" 12 | # Need this for relative symlinks. 13 | while [ -h "$PRG" ] ; do 14 | ls=`ls -ld "$PRG"` 15 | link=`expr "$ls" : '.*-> \(.*\)$'` 16 | if expr "$link" : '/.*' > /dev/null; then 17 | PRG="$link" 18 | else 19 | PRG=`dirname "$PRG"`"/$link" 20 | fi 21 | done 22 | SAVED="`pwd`" 23 | cd "`dirname \"$PRG\"`/" >/dev/null 24 | APP_HOME="`pwd -P`" 25 | cd "$SAVED" >/dev/null 26 | 27 | APP_NAME="Gradle" 28 | APP_BASE_NAME=`basename "$0"` 29 | 30 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 31 | DEFAULT_JVM_OPTS="" 32 | 33 | # Use the maximum available, or set MAX_FD != -1 to use that value. 34 | MAX_FD="maximum" 35 | 36 | warn () { 37 | echo "$*" 38 | } 39 | 40 | die () { 41 | echo 42 | echo "$*" 43 | echo 44 | exit 1 45 | } 46 | 47 | # OS specific support (must be 'true' or 'false'). 48 | cygwin=false 49 | msys=false 50 | darwin=false 51 | nonstop=false 52 | case "`uname`" in 53 | CYGWIN* ) 54 | cygwin=true 55 | ;; 56 | Darwin* ) 57 | darwin=true 58 | ;; 59 | MINGW* ) 60 | msys=true 61 | ;; 62 | NONSTOP* ) 63 | nonstop=true 64 | ;; 65 | esac 66 | 67 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar 68 | 69 | # Determine the Java command to use to start the JVM. 70 | if [ -n "$JAVA_HOME" ] ; then 71 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 72 | # IBM's JDK on AIX uses strange locations for the executables 73 | JAVACMD="$JAVA_HOME/jre/sh/java" 74 | else 75 | JAVACMD="$JAVA_HOME/bin/java" 76 | fi 77 | if [ ! -x "$JAVACMD" ] ; then 78 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME 79 | 80 | Please set the JAVA_HOME variable in your environment to match the 81 | location of your Java installation." 82 | fi 83 | else 84 | JAVACMD="java" 85 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 86 | 87 | Please set the JAVA_HOME variable in your environment to match the 88 | location of your Java installation." 89 | fi 90 | 91 | # Increase the maximum file descriptors if we can. 92 | if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then 93 | MAX_FD_LIMIT=`ulimit -H -n` 94 | if [ $? -eq 0 ] ; then 95 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then 96 | MAX_FD="$MAX_FD_LIMIT" 97 | fi 98 | ulimit -n $MAX_FD 99 | if [ $? -ne 0 ] ; then 100 | warn "Could not set maximum file descriptor limit: $MAX_FD" 101 | fi 102 | else 103 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" 104 | fi 105 | fi 106 | 107 | # For Darwin, add options to specify how the application appears in the dock 108 | if $darwin; then 109 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" 110 | fi 111 | 112 | # For Cygwin, switch paths to Windows format before running java 113 | if $cygwin ; then 114 | APP_HOME=`cygpath --path --mixed "$APP_HOME"` 115 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` 116 | JAVACMD=`cygpath --unix "$JAVACMD"` 117 | 118 | # We build the pattern for arguments to be converted via cygpath 119 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` 120 | SEP="" 121 | for dir in $ROOTDIRSRAW ; do 122 | ROOTDIRS="$ROOTDIRS$SEP$dir" 123 | SEP="|" 124 | done 125 | OURCYGPATTERN="(^($ROOTDIRS))" 126 | # Add a user-defined pattern to the cygpath arguments 127 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then 128 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" 129 | fi 130 | # Now convert the arguments - kludge to limit ourselves to /bin/sh 131 | i=0 132 | for arg in "$@" ; do 133 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` 134 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option 135 | 136 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition 137 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` 138 | else 139 | eval `echo args$i`="\"$arg\"" 140 | fi 141 | i=$((i+1)) 142 | done 143 | case $i in 144 | (0) set -- ;; 145 | (1) set -- "$args0" ;; 146 | (2) set -- "$args0" "$args1" ;; 147 | (3) set -- "$args0" "$args1" "$args2" ;; 148 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;; 149 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; 150 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; 151 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; 152 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; 153 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; 154 | esac 155 | fi 156 | 157 | # Escape application args 158 | save () { 159 | for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done 160 | echo " " 161 | } 162 | APP_ARGS=$(save "$@") 163 | 164 | # Collect all arguments for the java command, following the shell quoting and substitution rules 165 | eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" 166 | 167 | # by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong 168 | if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then 169 | cd "$(dirname "$0")" 170 | fi 171 | 172 | exec "$JAVACMD" "$@" 173 | -------------------------------------------------------------------------------- /gradlew.bat: -------------------------------------------------------------------------------- 1 | @if "%DEBUG%" == "" @echo off 2 | @rem ########################################################################## 3 | @rem 4 | @rem Gradle startup script for Windows 5 | @rem 6 | @rem ########################################################################## 7 | 8 | @rem Set local scope for the variables with windows NT shell 9 | if "%OS%"=="Windows_NT" setlocal 10 | 11 | set DIRNAME=%~dp0 12 | if "%DIRNAME%" == "" set DIRNAME=. 13 | set APP_BASE_NAME=%~n0 14 | set APP_HOME=%DIRNAME% 15 | 16 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 17 | set DEFAULT_JVM_OPTS= 18 | 19 | @rem Find java.exe 20 | if defined JAVA_HOME goto findJavaFromJavaHome 21 | 22 | set JAVA_EXE=java.exe 23 | %JAVA_EXE% -version >NUL 2>&1 24 | if "%ERRORLEVEL%" == "0" goto init 25 | 26 | echo. 27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 28 | echo. 29 | echo Please set the JAVA_HOME variable in your environment to match the 30 | echo location of your Java installation. 31 | 32 | goto fail 33 | 34 | :findJavaFromJavaHome 35 | set JAVA_HOME=%JAVA_HOME:"=% 36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 37 | 38 | if exist "%JAVA_EXE%" goto init 39 | 40 | echo. 41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 42 | echo. 43 | echo Please set the JAVA_HOME variable in your environment to match the 44 | echo location of your Java installation. 45 | 46 | goto fail 47 | 48 | :init 49 | @rem Get command-line arguments, handling Windows variants 50 | 51 | if not "%OS%" == "Windows_NT" goto win9xME_args 52 | 53 | :win9xME_args 54 | @rem Slurp the command line arguments. 55 | set CMD_LINE_ARGS= 56 | set _SKIP=2 57 | 58 | :win9xME_args_slurp 59 | if "x%~1" == "x" goto execute 60 | 61 | set CMD_LINE_ARGS=%* 62 | 63 | :execute 64 | @rem Setup the command line 65 | 66 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 67 | 68 | @rem Execute Gradle 69 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% 70 | 71 | :end 72 | @rem End local scope for the variables with windows NT shell 73 | if "%ERRORLEVEL%"=="0" goto mainEnd 74 | 75 | :fail 76 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 77 | rem the _cmd.exe /c_ return code! 78 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 79 | exit /b 1 80 | 81 | :mainEnd 82 | if "%OS%"=="Windows_NT" endlocal 83 | 84 | :omega 85 | -------------------------------------------------------------------------------- /img/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zincPower/GradleStudy/d8da754d8c5d378d05c5b32684b6f2e09a154884/img/logo.png -------------------------------------------------------------------------------- /img/zincPay.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zincPower/GradleStudy/d8da754d8c5d378d05c5b32684b6f2e09a154884/img/zincPay.jpg -------------------------------------------------------------------------------- /img/公众号.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zincPower/GradleStudy/d8da754d8c5d378d05c5b32684b6f2e09a154884/img/公众号.png -------------------------------------------------------------------------------- /key/gradleStudy.jks: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zincPower/GradleStudy/d8da754d8c5d378d05c5b32684b6f2e09a154884/key/gradleStudy.jks -------------------------------------------------------------------------------- /lib/library/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /lib/library/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.library' 2 | 3 | android { 4 | compileSdkVersion 28 5 | buildToolsVersion "29.0.1" 6 | 7 | 8 | defaultConfig { 9 | minSdkVersion 19 10 | targetSdkVersion 28 11 | versionCode 1000 12 | versionName "1.0" 13 | 14 | testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" 15 | // consumerProguardFiles 'consumer-rules.pro' 16 | 17 | // consumerProguardFile('consumer-rules.pro') 18 | 19 | } 20 | 21 | buildTypes { 22 | release { 23 | minifyEnabled false 24 | 25 | proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' 26 | } 27 | // debug { 28 | // minifyEnabled true 29 | // 30 | //// consumerProguardFile('consumer-rules.pro') 31 | // proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' 32 | // } 33 | 34 | } 35 | 36 | } 37 | 38 | dependencies { 39 | implementation fileTree(dir: 'libs', include: ['*.jar']) 40 | 41 | implementation 'androidx.appcompat:appcompat:1.0.2' 42 | testImplementation 'junit:junit:4.12' 43 | androidTestImplementation 'androidx.test:runner:1.1.1' 44 | androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1' 45 | } 46 | -------------------------------------------------------------------------------- /lib/library/consumer-rules.pro: -------------------------------------------------------------------------------- 1 | -keep class com.zinc.library.Test { *; } -------------------------------------------------------------------------------- /lib/library/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 22 | 23 | -keep class com.zinc.library.Test { *; } -------------------------------------------------------------------------------- /lib/library/src/androidTest/java/com/zinc/library/ExampleInstrumentedTest.java: -------------------------------------------------------------------------------- 1 | package com.zinc.library; 2 | 3 | import android.content.Context; 4 | 5 | import androidx.test.platform.app.InstrumentationRegistry; 6 | import androidx.test.ext.junit.runners.AndroidJUnit4; 7 | 8 | import org.junit.Test; 9 | import org.junit.runner.RunWith; 10 | 11 | import static org.junit.Assert.*; 12 | 13 | /** 14 | * Instrumented test, which will execute on an Android device. 15 | * 16 | * @see Testing documentation 17 | */ 18 | @RunWith(AndroidJUnit4.class) 19 | public class ExampleInstrumentedTest { 20 | @Test 21 | public void useAppContext() { 22 | // Context of the app under test. 23 | Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext(); 24 | 25 | assertEquals("com.zinc.library.test", appContext.getPackageName()); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /lib/library/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | -------------------------------------------------------------------------------- /lib/library/src/main/java/com/zinc/library/Test.java: -------------------------------------------------------------------------------- 1 | package com.zinc.library; 2 | 3 | import android.content.Context; 4 | import android.widget.Toast; 5 | 6 | /** 7 | * author : zinc 8 | * time : 2019-09-11 23:20 9 | * desc : 10 | * version : 11 | */ 12 | public class Test { 13 | 14 | public void show(Context context) { 15 | int hi = hi(1, 2); 16 | Toast.makeText(context, "zinc" + hi, Toast.LENGTH_SHORT).show(); 17 | } 18 | 19 | public int hi(int i, int j) { 20 | return i + j; 21 | } 22 | 23 | } 24 | -------------------------------------------------------------------------------- /lib/library/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | library 3 | 4 | -------------------------------------------------------------------------------- /lib/library/src/test/java/com/zinc/library/ExampleUnitTest.java: -------------------------------------------------------------------------------- 1 | package com.zinc.library; 2 | 3 | import org.junit.Test; 4 | 5 | import static org.junit.Assert.*; 6 | 7 | /** 8 | * Example local unit test, which will execute on the development machine (host). 9 | * 10 | * @see Testing documentation 11 | */ 12 | public class ExampleUnitTest { 13 | @Test 14 | public void addition_isCorrect() { 15 | assertEquals(4, 2 + 2); 16 | } 17 | } -------------------------------------------------------------------------------- /matchingalibrary/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /matchingalibrary/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.library' 2 | 3 | android { 4 | compileSdkVersion 28 5 | buildToolsVersion "29.0.1" 6 | 7 | 8 | defaultConfig { 9 | minSdkVersion 19 10 | targetSdkVersion 28 11 | versionCode 1 12 | versionName "1.0" 13 | 14 | testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" 15 | consumerProguardFiles 'consumer-rules.pro' 16 | } 17 | 18 | buildTypes { 19 | release { 20 | minifyEnabled false 21 | proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' 22 | } 23 | // debug { 24 | // 25 | // } 26 | 27 | } 28 | 29 | // flavorDimensions 'zinc1' 30 | // productFlavors{ 31 | // flavor1{ 32 | // dimension 'zinc1' 33 | // } 34 | // flavor2{ 35 | // dimension 'zinc1' 36 | // } 37 | // } 38 | 39 | } 40 | 41 | dependencies { 42 | implementation fileTree(dir: 'libs', include: ['*.jar']) 43 | 44 | implementation 'androidx.appcompat:appcompat:1.1.0' 45 | testImplementation 'junit:junit:4.12' 46 | androidTestImplementation 'androidx.test:runner:1.2.0' 47 | androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0' 48 | } 49 | -------------------------------------------------------------------------------- /matchingalibrary/consumer-rules.pro: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zincPower/GradleStudy/d8da754d8c5d378d05c5b32684b6f2e09a154884/matchingalibrary/consumer-rules.pro -------------------------------------------------------------------------------- /matchingalibrary/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 22 | -------------------------------------------------------------------------------- /matchingalibrary/src/androidTest/java/com/zinc/matchingalibrary/ExampleInstrumentedTest.java: -------------------------------------------------------------------------------- 1 | package com.zinc.matchingalibrary; 2 | 3 | import android.content.Context; 4 | 5 | import androidx.test.platform.app.InstrumentationRegistry; 6 | import androidx.test.ext.junit.runners.AndroidJUnit4; 7 | 8 | import org.junit.Test; 9 | import org.junit.runner.RunWith; 10 | 11 | import static org.junit.Assert.*; 12 | 13 | /** 14 | * Instrumented test, which will execute on an Android device. 15 | * 16 | * @see Testing documentation 17 | */ 18 | @RunWith(AndroidJUnit4.class) 19 | public class ExampleInstrumentedTest { 20 | @Test 21 | public void useAppContext() { 22 | // Context of the app under test. 23 | Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext(); 24 | 25 | assertEquals("com.zinc.matchingalibrary.test", appContext.getPackageName()); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /matchingalibrary/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | -------------------------------------------------------------------------------- /matchingalibrary/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | matchingALibrary 3 | 4 | -------------------------------------------------------------------------------- /matchingalibrary/src/test/java/com/zinc/matchingalibrary/ExampleUnitTest.java: -------------------------------------------------------------------------------- 1 | package com.zinc.matchingalibrary; 2 | 3 | import org.junit.Test; 4 | 5 | import static org.junit.Assert.*; 6 | 7 | /** 8 | * Example local unit test, which will execute on the development machine (host). 9 | * 10 | * @see Testing documentation 11 | */ 12 | public class ExampleUnitTest { 13 | @Test 14 | public void addition_isCorrect() { 15 | assertEquals(4, 2 + 2); 16 | } 17 | } -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 1 | //setting.gradle 会被映射为 setting类 2 | 3 | // 路径用 ":" 隔开 4 | include ':app', ':lib:library', ':zinclibrary', ':matchingalibrary' 5 | 6 | rootProject.name = 'GradleStudy' 7 | 8 | // 修改 :app 项目下的 gradle 配置文件名称 9 | //project(':app').buildFileName = 'zinc_databinding.gradle' 10 | //project(':app').buildFileName = 'zinc_flavor.gradle' 11 | //project(':app').buildFileName = 'zinc_sourceSets.gradle' 12 | //project(':app').buildFileName = 'zinc_sigingConfigs.gradle' 13 | //project(':app').buildFileName = 'zinc_dexOptions.gradle' 14 | //project(':app').buildFileName = 'zinc_lintOptions.gradle' 15 | //project(':app').buildFileName = 'zinc_splits.gradle' 16 | //project(':app').buildFileName = 'zinc_testOptions.gradle' 17 | //project(':app').buildFileName = 'zinc_dexOptions.gradle' 18 | //project(':app').buildFileName = 'zinc_value.gradle' 19 | //project(':app').buildFileName = 'zinc_aaptOptions.gradle' 20 | 21 | // ADB 配置 22 | project(':app').buildFileName = 'zinc_adbOptions.gradle' 23 | 24 | //project(':app').buildFileName = 'zinc_LibraryExtension.gradle' 25 | //project(':app').buildFileName = 'zinc_AppExtension.gradle' -------------------------------------------------------------------------------- /zinclibrary/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /zinclibrary/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.library' 2 | 3 | android { 4 | compileSdkVersion 28 5 | buildToolsVersion "29.0.1" 6 | 7 | 8 | defaultConfig { 9 | minSdkVersion 19 10 | targetSdkVersion 28 11 | versionCode 1 12 | versionName "1.0" 13 | 14 | testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" 15 | consumerProguardFiles 'consumer-rules.pro' 16 | } 17 | 18 | buildTypes { 19 | release { 20 | minifyEnabled false 21 | proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' 22 | } 23 | 24 | } 25 | 26 | // // 创建 风味 纬度 27 | // flavorDimensions('zinc', 'handsome') 28 | // // 创建产品风味 29 | // productFlavors { 30 | // minApi13{ 31 | // dimension 'zinc' 32 | // } 33 | // minApi23{ 34 | // dimension 'zinc' 35 | // } 36 | // x86{ 37 | // dimension 'handsome' 38 | // } 39 | // arm64{ 40 | // dimension 'handsome' 41 | // } 42 | // } 43 | 44 | } 45 | 46 | dependencies { 47 | implementation fileTree(dir: 'libs', include: ['*.jar']) 48 | 49 | implementation 'androidx.appcompat:appcompat:1.1.0' 50 | testImplementation 'junit:junit:4.12' 51 | androidTestImplementation 'androidx.test:runner:1.2.0' 52 | androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0' 53 | } 54 | -------------------------------------------------------------------------------- /zinclibrary/consumer-rules.pro: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zincPower/GradleStudy/d8da754d8c5d378d05c5b32684b6f2e09a154884/zinclibrary/consumer-rules.pro -------------------------------------------------------------------------------- /zinclibrary/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 22 | -------------------------------------------------------------------------------- /zinclibrary/src/androidTest/java/com/zinc/zinclibrary/ExampleInstrumentedTest.java: -------------------------------------------------------------------------------- 1 | package com.zinc.zinclibrary; 2 | 3 | import android.content.Context; 4 | 5 | import androidx.test.platform.app.InstrumentationRegistry; 6 | import androidx.test.ext.junit.runners.AndroidJUnit4; 7 | 8 | import org.junit.Test; 9 | import org.junit.runner.RunWith; 10 | 11 | import static org.junit.Assert.*; 12 | 13 | /** 14 | * Instrumented test, which will execute on an Android device. 15 | * 16 | * @see Testing documentation 17 | */ 18 | @RunWith(AndroidJUnit4.class) 19 | public class ExampleInstrumentedTest { 20 | @Test 21 | public void useAppContext() { 22 | // Context of the app under test. 23 | Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext(); 24 | 25 | assertEquals("com.zinc.zinclibrary.test", appContext.getPackageName()); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /zinclibrary/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | -------------------------------------------------------------------------------- /zinclibrary/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | zincLibrary 3 | zinc Power test Content 4 | 5 | -------------------------------------------------------------------------------- /zinclibrary/src/test/java/com/zinc/zinclibrary/ExampleUnitTest.java: -------------------------------------------------------------------------------- 1 | package com.zinc.zinclibrary; 2 | 3 | import org.junit.Test; 4 | 5 | import static org.junit.Assert.*; 6 | 7 | /** 8 | * Example local unit test, which will execute on the development machine (host). 9 | * 10 | * @see Testing documentation 11 | */ 12 | public class ExampleUnitTest { 13 | @Test 14 | public void addition_isCorrect() { 15 | assertEquals(4, 2 + 2); 16 | } 17 | } --------------------------------------------------------------------------------