只关注有注释的部分就可以
apply plugin: 'com.android.application' //apply plugin: 'me.tatarka.retrolambda' // 引用简化语法lambda println "username= ${rootProject.ext.username}" def androidId = rootProject.ext.androidId def appId = rootProject.ext.appId def support = rootProject.ext.dependencies def url = rootProject.ext.url android { compileSdkVersion androidId.compileSdkVersion defaultConfig { applicationId appId.app minSdkVersion androidId.minSdkVersion targetSdkVersion androidId.targetSdkVersion versionCode androidId.versionCode versionName androidId.versionName testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" } // 签名配置信息必须在buildTypes之前 signingConfigs { debug { storeFile file('C:/Users/chq/.android/debug.keystore') storePassword "android" keyAlias "androiddebugkey" keyPassword "android" } release { // 签名证书文件 storeFile file('C:/Users/chq/.android/debug.keystore') // 签名证书类型 storeType "netease" // 签名密码 storePassword "android" // 别名 keyAlias "androiddebugkey" // 秘钥的密码 keyPassword "android" // 是否开启V2打包 v2SigningEnabled true } } buildTypes { debug { buildConfigField("String", "debugUrl", "\"${url.debug}\"") signingConfig signingConfigs.debug } release { minifyEnabled false buildConfigField("String", "releaseUrl", "\"${url.release}\"") proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' // signingConfig signingConfigs.release } } adbOptions { //配置操作超时时间,单位毫秒 timeOutInMs = 5*1000 //adb install 命令的选项配置 installOptions '-r', '-s' } // 对dx 操作的配置,接收一个DexOptions类型的闭包,配置由DexOptions 提供 dexOptions { // 配置执行dx 命令是为其分配的最大堆内存 javaMaxHeapSize "4g" // 配置是否预执行 dex libraries 工程,开启后会提高增量构建速度,不过会影响clean构建的速度,默认true preDexLibraries = false // 配置是否开启 jumbo 模式,代码方法是超过65535 需要强制开启才能构建成功 jumboMode true // 配置Gradle 运行dx 命令时使用的线程数量 threadCount 8 // 配置multidex参数 aditionalParameters = [ '--multi-dex', // 多dex分包 '--set-max-idx-number=50000', // 每个包内方法数上限 // '--main-dex-list='+'/multidex-config.txt',//打包到主classes.dex 的文件列表 '--minimal-main-dex' ] } // 执行gradle lint 命令即可运行lint检查,默认生成的报告在outputs/lint-results.html中 lintOptions { // 遇到lint 检查错误会终止构建,一般设置为 false abortOnError false // 将警告当做错误来处理 (老版本:warningAsErros) warningsAsErrors false // 检查新 API check 'NewApi' } compileOptions { sourceCompatibility 1.8 targetCompatibility 1.8 } //省略 configurations.all { resolutionStrategy.force 'com.android.support:support-annotations:26.1.0' } } dependencies { implementation fileTree(dir: 'libs', include: ['*.jar']) // implementation support.appcompat // implementation support.constraint support.each {k,v -> implementation v} implementation 'com.android.support:design:26.1.0' implementation 'com.android.support:recyclerview-v7:26.1.0' implementation 'io.reactivex.rxjava2:rxjava:2.1.9' //必须 implementation 'io.reactivex.rxjava2:rxandroid:2.0.2' //必须 implementation 'com.google.code.gson:gson:2.8.2' implementation 'com.jakewharton:butterknife:8.4.0' implementation 'com.squareup.okhttp3:okhttp:3.10.0' implementation 'com.squareup.okio:okio:1.14.0' testImplementation 'junit:junit:4.12' androidTestImplementation 'com.android.support.test:runner:1.0.2' androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2' }