android - android studio 3.2.1 中 compileSDK 版本 28 的 gradle 依赖项应该是什么

标签 android android-studio gradle

Here is the gradle code. It is unable to sync everytime. I'm really stuck here. Please help me. Thank you in advance. The error is Failed to resolve: and then all the lines between the dependencies { }


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'

}

最佳答案

顶级构建文件:

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'
}

关于android - android studio 3.2.1 中 compileSDK 版本 28 的 gradle 依赖项应该是什么,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53806842/

相关文章:

android - 当我从列表中选择一个项目时回来

android - 这个语音识别错误在我的 flutter 应用程序中意味着什么?

android - 我如何决定在 .gitignore 中添加 .idea/jarRepositories.xml

java - Android Jack : Lambda coming from jar file need their interfaces on the classpath to be compiled, 未知接口(interface)是 java.util.function.Consumer

java - 如何在Android Studio上修复Gradle错误

android - 你如何在android studio中关闭版本控制?

android - 我可以在 Unity Android Free 中使用 Google Play 游戏服务 - 实时多人游戏吗?

android-studio - Android Studio构建错误不会消失

groovy - 许可证-gradle-plugin

java - 如何配置 Gradle 以绕过 SSL 证书验证?