apply plugin: 'com.android.application' apply plugin: 'com.getkeepsafe.dexcount' //定义时间 def releaseTime() { // return new Date().format("yyyyMMdd.HHmm.ss") return new Date().format("yyyyMMdd") } //设置发布的显示的版本号 def getVersionName() { return rootProject.ext.android.versionName } //读取版本号 def getVersionCode() { def versionFile = file('version.properties') if (versionFile.canRead()) { Properties versionProps = new Properties() versionProps.load(new FileInputStream(versionFile)) def versionName = versionProps['versionName'].toInteger() def versionCode = versionProps['versionCode'].toInteger() def debugName = versionProps['debugName'].toInteger() def debugCode = versionProps['debugCode'].toInteger() def versionArray = new Integer[4] def runTasks = gradle.startParameter.taskNames //仅在assembleRelease任务是增加版本号 println 'runTasks:' + runTasks if (':WeiChat:assembleBaiduDebug' in runTasks) { println 'runTasks:' + 'debug模式打包apk' versionProps['debugCode'] = (++debugCode).toString() versionProps['debugName'] = (++debugName).toString() versionProps.store(versionFile.newWriter(), null) } if (':WeiChat:assembleBaiduRelease' in runTasks) { println 'runTasks:' + '发布模式打包apk' versionProps['versionCode'] = (++versionCode).toString() versionProps['versionName'] = (++versionName).toString() versionProps.store(versionFile.newWriter(), null) } versionArray[0] = versionName versionArray[1] = versionCode versionArray[2] = debugName versionArray[3] = debugCode println versionArray[0].toString() return versionArray } else { throw new GradleException("Could not find version.properties!") } } android { def versionArray = getVersionCode() dexOptions { javaMaxHeapSize "4g" //specify the heap size for the dex process preDexLibraries = false //delete the already predexed libraries //是否支持大工程模式 jumboMode = true } compileOptions { sourceCompatibility JavaVersion.VERSION_1_8 targetCompatibility JavaVersion.VERSION_1_8 } signingConfigs { config { storeFile file('C:/sigin/applicationsignname[20150409]') storePassword '13237658359' keyAlias 'jie-20150409' keyPassword '13237658359' } } compileSdkVersion rootProject.ext.android.compileSdkVersion buildToolsVersion rootProject.ext.android.buildToolsVersion defaultConfig { def versionNames = "v" + versionArray[0].toString().substring(0, 1) + "." + versionArray[0].toString().substring(1, 2) + "." + versionArray[0].toString().substring(2, 3) applicationId project.applicationId minSdkVersion rootProject.ext.android.minSdkVersion targetSdkVersion rootProject.ext.android.targetSdkVersion versionCode versionArray[1] versionName versionNames multiDexEnabled true manifestPlaceholders = [UMENG_CHANNEL_VALUE: "umeng"] ndk { abiFilters "armeabi", "armeabi-v7a", "x86", "mips", "x86_64", "mips64" } renderscriptTargetApi rootProject.ext.android.compileSdkVersion renderscriptSupportModeEnabled true } useLibrary 'org.apache.http.legacy' lintOptions { checkReleaseBuilds false abortOnError false } sourceSets { main { jniLibs.srcDirs = ['src/main/jniLibs'] } } packagingOptions { exclude 'META-INF/LICENSE.txt' exclude 'META-INF/NOTICE.txt' } buildTypes { release { minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' signingConfig signingConfigs.config lintOptions { checkReleaseBuilds false abortOnError false } } debug { } } flavorDimensions "usoft" productFlavors.all { flavor -> flavor.manifestPlaceholders = [UMENG_CHANNEL_VALUE: name] } configurations { all*.exclude group: 'com.android.volley' } } repositories { flatDir { dirs 'libs' } } dependencies { api fileTree(include: ['*.jar'], dir: 'libs') implementation project(path: ':facesdk') testImplementation deps.junit implementation deps.appcompatV7 implementation deps.supportV4 implementation deps.design implementation(deps.stetho) { force = true } implementation deps.jodatime implementation deps.systembartint implementation deps.photoView implementation deps.tagGroup // implementation deps.analytics implementation deps.activityOnCrash implementation deps.stickyListHeaders implementation deps.stickyGridHeaders implementation deps.materialDialogs implementation deps.okhttp api project(':common') api project(':appmessages') api project(':network') api project(':imageload') api project(':applogin') api project(':apptasks') api project(':appcontact') api project(':appme') api project(':appworks') api project(':appbooking') api project(':appmusic') api project(':apputils') implementation 'com.android.support.constraint:constraint-layout:1.0.2' // implementation 'com.android.support:support-v4:28.0.0' implementation(name: 'autoupdatesdk-release', ext: 'aar') } buildscript { repositories { mavenCentral() } dependencies { classpath 'com.getkeepsafe.dexcount:dexcount-gradle-plugin:0.6.4' } } dexcount { format = "json" includeClasses = false includeFieldCount = true includeTotalMethodCount = false orderByMethodCount = false verbose = false maxTreeDepth = Integer.MAX_VALUE teamCityIntegration = false enableForInstantRun = false }