Skip to content

Commit

Permalink
支持Gradle3.2.1,修改gradle配置
Browse files Browse the repository at this point in the history
  • Loading branch information
liuwenzheng committed Oct 18, 2018
1 parent ac35fad commit 2749712
Show file tree
Hide file tree
Showing 5 changed files with 50 additions and 25 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,4 @@ proguard/
.idea
*.iml
*.DS_Store
/*/release/
54 changes: 38 additions & 16 deletions app/build.gradle
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
apply plugin: 'com.android.application'

android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
compileSdkVersion 28
buildToolsVersion "28.0.3"

defaultConfig {
applicationId "com.moko.beacon"
minSdkVersion 18
targetSdkVersion 23
targetSdkVersion 28
versionCode 5
versionName "1.2.2"
}

sourceSets {
lintOptions {
abortOnError false
javaCompileOptions {
annotationProcessorOptions {
includeCompileClasspath = true
}
}
}

Expand All @@ -24,25 +24,47 @@ android {
}
}

signingConfigs {
debug {
v1SigningEnabled true
v2SigningEnabled true
}
release {
v1SigningEnabled true
v2SigningEnabled true
}
}

applicationVariants.all { variant ->
variant.outputs.each { output ->
variant.outputs.all { output ->
def outputFile = output.outputFile
if (outputFile != null && outputFile.name.endsWith('.apk')) {
//这里修改apk文件名
def fileName = "MokoBeacon-${defaultConfig.versionName}.apk"
def formatedDate = new Date().format("yyyyMMddHHmm")
def apkFileName = "MokoBeacon_${defaultConfig.versionName}_${formatedDate}.apk"
if (outputFile.name.contains('debug')) {
fileName = "MokoBeacon-${defaultConfig.versionName}-debug.apk"
apkFileName = "MokoBeacon_${defaultConfig.versionName}_${formatedDate}_debug.apk"
}
output.outputFile = new File(outputFile.parent, fileName)
outputFileName = apkFileName
}
}
}
}

configurations.all {
resolutionStrategy.eachDependency { DependencyResolveDetails details ->
def requested = details.requested
if (requested.group == 'com.android.support') {
if (!requested.name.startsWith("multidex")) {
details.useVersion '28.0.0'
}
}
}
}

dependencies {
compile fileTree(include: '*.jar', dir: 'libs')
compile 'com.jakewharton:butterknife:7.0.0'
compile 'com.android.support:support-v4:23.1.0'
compile project(path: ':mokosupport')
implementation fileTree(include: '*.jar', dir: 'libs')
implementation 'com.jakewharton:butterknife:7.0.0'
implementation 'com.android.support:support-v4:28.0.0'
implementation project(path: ':mokosupport')

}
4 changes: 3 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
buildscript {
repositories {
jcenter()
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.1.3'
classpath 'com.android.tools.build:gradle:3.2.1'
}
}
allprojects {
repositories {
jcenter()
google()
}
}
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-4.6-all.zip
14 changes: 7 additions & 7 deletions mokosupport/build.gradle
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
apply plugin: 'com.android.library'

android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
compileSdkVersion 28
buildToolsVersion '28.0.3'

defaultConfig {
minSdkVersion 18
targetSdkVersion 23
targetSdkVersion 28
versionCode 1
versionName "1.0"
}
Expand All @@ -18,8 +18,8 @@ android {
}

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'no.nordicsemi.android.support.v18:scanner:1.0.0'
compile 'com.elvishew:xlog:1.3.0'
compile 'no.nordicsemi.android:dfu:0.6.2'
implementation fileTree(dir: 'libs', include: ['*.jar'])
api 'no.nordicsemi.android.support.v18:scanner:1.0.0'
implementation 'com.elvishew:xlog:1.3.0'
api 'no.nordicsemi.android:dfu:0.6.2'
}

0 comments on commit 2749712

Please sign in to comment.