android studio 3.2.1中compileSDK versio 28的gradle依赖关系应该是什么

时间:2018-12-16 22:00:34

标签: android android-studio gradle

  

这是gradle代码。它无法每次都同步。我真的被困在这里。请帮我。先感谢您。   错误无法解决:然后依赖项之间的所有行{}

apply plugin: 'com.android.application'

android {
    compileSdkVersion 28
    buildToolsVersion "28.0.3"
    defaultConfig {
        applicationId "global.alyssum.charcha"
        minSdkVersion 21
        targetSdkVersion 28
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'androidx.appcompat:appcompat:1.0.0-alpha1'
    compile 'androidx.constraintlayout:constraintlayout:1.1.2'
    compile 'com.google.android.material:material:1.0.0-alpha1'
    testCompile 'junit:junit:4.12'
    androidTestCompile 'androidx.test:runner:1.1.0-alpha3'
    androidTestCompile 'androidx.test.espresso:espresso-core:3.1.0-alpha3'

}

1 个答案:

答案 0 :(得分:0)

顶级构建文件:

buildscript {
    repositories {
        google()
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.2.1'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        google()
        jcenter()
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

模块级构建文件:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 28
    defaultConfig {
        applicationId "global.alyssum.charcha"
        minSdkVersion 21
        targetSdkVersion 28
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
        staging {
            signingConfig signingConfigs.debug
        }
    }

}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'androidx.appcompat:appcompat:1.0.2'
    implementation 'com.android.support.constraint:constraint-layout:1.1.3'
    implementation 'com.google.android.material:material:1.0.0'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'androidx.test:runner:1.1.1'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1'
}