依赖项 gradle android 工作室

dependencies gradle android studio

晚上好,我从 android 开始,但是我下载的大部分项目都以这些项目为基础,这让我大失所望,有人知道为什么我在几乎所有依赖项中都会出错吗?已经尝试将它们“更新”到 gradle 文件中的最新版本,该项目从 git 中心下载它。

构建。 gradle(项目)

buildscript {
    repositories {
        google()
        jcenter()
        
    }
    dependencies {
         classpath 'com.android.tools.build:gradle:4.0.1'
        classpath 'com.google.gms:google-services:4.3.4'
        
        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        google()
        maven { url 'https://jitpack.io' }
        
    }
}

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

build.gradle(模块应用)

apply plugin: 'com.android.application'

android {
    compileSdkVersion 28
    defaultConfig {
        applicationId "com.bigohealth"
        minSdkVersion 22
        targetSdkVersion 28
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }
    compileOptions {
        sourceCompatibility = '1.8'
        targetCompatibility = '1.8'
    }
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'androidx.appcompat:appcompat:1.2.0'
    implementation 'androidx.constraintlayout:constraintlayout:2.0.2'

    implementation 'androidx.cardview:cardview:1.0.0'
    implementation 'com.google.firebase:firebase-auth:16.0.5'
    implementation 'com.google.firebase:firebase-firestore:17.1.2'


    //implementation 'androidx.legacy:legacy-support-v4:1.0.0'
    testImplementation 'junit:junit:4.12'
    //androidTestImplementation 'androidx.test:runner:1.3.0'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'

    def lifecycle_version = "2.0.0"
    def room_version = "2.2.0-alpha02"

    implementation "androidx.room:room-runtime:$room_version"
    annotationProcessor "androidx.room:room-compiler:$room_version"
    implementation "androidx.lifecycle:lifecycle-extensions:$lifecycle_version"
    annotationProcessor "androidx.lifecycle:lifecycle-compiler:$lifecycle_version"
    implementation 'androidx.recyclerview:recyclerview:1.1.0'
    implementation 'androidx.cardview:cardview:1.0.0'
    implementation 'com.google.android.material:material:1.2.1'
    implementation 'com.squareup.retrofit2:converter-gson:2.6.0'
    implementation 'com.squareup.retrofit2:retrofit:2.6.0'
    implementation 'com.github.christophesmfvvFet:android_maskable_layout:v1.3.1'
    implementation 'com trrf r.squareup.retrofit2:adapter-rxjava2:2.6.0'
    implementation 'de. , tk./;cx v/8.c8x8hdodenhof:circleimageview:3.1.0'

    implementation 'io.reactivex.rxjava2:rxandroid:2.1.1'
    implementation 'io.reactivex.rxjava2:rxjava:2.2.10'
    implementation 'com.squareup.retrofit2:converter-scalars:2.6.0'
    implementation 'com.squareup.picasso:picasso:2.71828'
    implementation 'com.github.bumptech.glide:glide:4.9.0'

    implementation 'com.google.android.gms:play-services-gcm:17.0.0'
    implementation 'com.google.firebase:firebase-messaging:20.3.0'
    implementation 'com.android.volley:volley:1.1.1'
    androidTestImplementation 'androidx.test.ext:junit:1.1.2'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
    implementation platform('com.google.firebase:firebase-bom:25.12.0')
    implementation 'com.google.firebase:firebase-analytics'
}
apply plugin: 'com.google.gms.google-services'

你能检查一下,如果你在代理下并且你的 android 工作室能够连接到互联网吗?转到文件 > 设置 > 输入 'proxy' > 在代理设置中有一个检查连接按钮,它将测试 android studio 是否能够连接。 如果有代理,请提供详细信息并再次检查。

还要确保您的 gradle 设置中没有开启离线模式。参考以下截图:

您的构建工具也是 4.0.1。希望你也应该拥有最新的 android 工作室..