最外层的build.gradle
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
maven { url'http://maven.aliyun.com/nexus/content/groups/public/' }
maven { url'http://maven.aliyun.com/nexus/content/repositories/jcenter'}
maven { url 'https://dl.google.com/dl/android/maven2/' }
}
dependencies {
classpath 'com.android.tools.build:gradle:3.2.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
maven{ url'http://maven.aliyun.com/nexus/content/groups/public/' }
maven{ url'http://maven.aliyun.com/nexus/content/repositories/jcenter'}
maven { url 'https://dl.google.com/dl/android/maven2/' }
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
app项目下的build.gradle
apply plugin: 'com.android.application'
apply plugin: 'com.android.application'
android {
compileSdkVersion 27
buildToolsVersion "28.0.3"
defaultConfig {
applicationId "com.sun.detecter"
minSdkVersion 15
targetSdkVersion 27
versionCode 1
versionName "1.0"
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
// jackOptions {
// enabled true
// }
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
api fileTree(dir: 'libs', include: ['*.jar'])
testImplementation 'junit:junit:4.12'
// https://mvnrepository.com/artifact/com.android.support/appcompat-v7
api group: 'com.android.support', name: 'appcompat-v7', version: '27.1.1'
// https://mvnrepository.com/artifact/com.squareup.okhttp3/okhttp
api group: 'com.squareup.okhttp3', name: 'okhttp', version: '3.10.0'
// https://mvnrepository.com/artifact/com.android.support/design
api group: 'com.android.support', name: 'design', version: '27.1.1'
}
在D:\MyCode\MyFirstGraduationPro\practice6\gradle\wrapper这个目录下:gradle-wrapper.properties文件中
#Mon Dec 28 10:00:20 PST 2015
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.6-all.zip
用的gradle-4.6,但是tool用的是2.3.0