java - 如何解决未解析的依赖关系 ':app@debug/compileClasspath' : Could not resolve com. google.android.gms :play-services-base:[15. 0.0, 16.0.0)

标签 java android gradle dependencies

我有依赖性问题。我不知道我错了什么,因为我已经几周没有打开我的项目了。今天我决定打开它继续我的工作,但在等待它同步时它说我遇到了依赖问题。

ERROR: Unable to resolve dependency for ':app@debug/compileClasspath': Could not resolve com.google.android.gms:play-services-base:[15.0.0, 16.0.0).

ERROR: Unable to resolve dependency for ':app@debug/compileClasspath': Could not resolve com.google.android.gms:play-services-base:[15.0.1,16.0.0).

ERROR: Unable to resolve dependency for ':app@debug/compileClasspath': Could not resolve com.google.android.gms:play-services-basement:[15.0.1,16.0.0).

ERROR: Unable to resolve dependency for ':app@debug/compileClasspath': Could not resolve com.google.android.gms:play-services-tasks:[15.0.1,16.0.0).

ERROR: Unable to resolve dependency for ':app@debugAndroidTest/compileClasspath': Could not resolve com.google.android.gms:play-services-base:[15.0.0, 16.0.0).

ERROR: Unable to resolve dependency for ':app@debugAndroidTest/compileClasspath': Could not resolve com.google.android.gms:play-services-base:[15.0.1,16.0.0).

ERROR: Unable to resolve dependency for ':app@debugAndroidTest/compileClasspath': Could not resolve com.google.android.gms:play-services-basement:[15.0.1,16.0.0).

ERROR: Unable to resolve dependency for ':app@debugAndroidTest/compileClasspath': Could not resolve com.google.android.gms:play-services-tasks:[15.0.1,16.0.0).

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    repositories {
        google()
        jcenter()

    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.5.0'
        classpath 'com.google.gms:google-services:4.2.0'

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

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

    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}
buildscript {
    repositories {
        maven { url 'https://plugins.gradle.org/m2/' }
    }
    dependencies {
        classpath 'gradle.plugin.com.onesignal:onesignal-gradle-plugin:[0.12.4, 0.99.99]'
    }
}
apply plugin: 'com.onesignal.androidsdk.onesignal-gradle-plugin'

repositories {
    maven { url 'https://maven.google.com' }
}

apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'


android {
    compileSdkVersion 29
    buildToolsVersion "29.0.2"
    defaultConfig {
        applicationId "com.example.gerobokgo"
        minSdkVersion 26
        targetSdkVersion 29
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "androidx.Test.runner.AndroidJUnitRunner"
        manifestPlaceholders = [
                onesignal_app_id               : '560003c8-bceb-4896-bf78-435948f4fc6d',
                // Project number pulled from dashboard, local value is ignored.
                onesignal_google_project_number: 'REMOTE'
        ]
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'androidx.appcompat:appcompat:1.1.0'
    implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
    implementation 'com.google.firebase:firebase-auth:16.0.5'
    implementation 'com.google.firebase:firebase-database:16.0.4'
    implementation 'com.google.firebase:firebase-core:16.0.8'
    implementation 'com.firebaseui:firebase-ui-database:4.3.2'
    implementation 'com.google.firebase:firebase-storage:16.0.4'


    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'androidx.test:runner:1.2.0'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
    androidTestImplementation 'androidx.test.ext:junit:1.1.1'

    implementation 'com.squareup.picasso:picasso:2.5.2'
    //Layout
    implementation 'com.google.android.material:material:1.0.0'
    //recylervieer
    implementation 'androidx.recyclerview:recyclerview:1.0.0'

    // image slider
    implementation 'com.github.therealshabi:AutoImageFlipper:v1.4.1'

    //image Cropper
    implementation 'com.theartofdev.edmodo:android-image-cropper:2.1.+'
    implementation 'androidx.work:work-runtime:2.2.0'

    implementation 'com.braintreepayments:card-form:3.1.1'

   //FCM SDK
    implementation 'com.google.firebase:firebase-messaging:17.3.4'

    //onesignal
    implementation 'com.onesignal:OneSignal:[3.11.2, 3.99.99]'
}



最佳答案

解决了! 只需启用连接模式即可。那你就没事了!

关于java - 如何解决未解析的依赖关系 ':app@debug/compileClasspath' : Could not resolve com. google.android.gms :play-services-base:[15. 0.0, 16.0.0),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59723528/

相关文章:

java - 在 Android 中使用 OpenCV 加载图像

android - 我为android设计的底部 ListView 没有完全显示

android - 将Android Studio 3.5升级到3.6.1后编译应用时出错

android - react native : Failed to notify project evaluation listener. > JAVA_LETTER_OR_DIGIT

java - 删除所有行然后重新加载 JTable 中的行会导致 getSelectedRow 返回 -1

Java套接字服务器仅显示连接关闭后收到的消息

android - 当应用程序从最近的应用程序列表中清除时,后台服务在 android nougat 和 oreo 中停止

android - 更改在 ListView Android 中通过长按选择的行的颜色

java - Spring Boot 和 Gradle 多模块项目,未能正确加载依赖项

Java 方法返回无法与另一个 int 进行比较的 int (Android Studio)