无法解决:Android Studio 3.0.1中的com.google.firebase:firebase-firestore:11.0.4

时间:2019-01-01 13:16:29

标签: firebase android-studio google-cloud-firestore

我正在使用Android Studio版本(3.0.1),并且安装了Google Play服务和Google存储库

我尝试使用

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

在项目gradle中

这是我的项目爷爷:

buildscript {

    repositories {
        jcenter()
        google()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.0.1'
        classpath 'com.google.gms:google-services:3.1.0'
    }
}

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



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

这是我的应用程序构建文件:

apply plugin: 'com.android.application'
android {
    compileSdkVersion 26
    defaultConfig {
        applicationId "com.congdong85.hn.hoangnguyen.doanungdungcast"
        minSdkVersion 16
        targetSdkVersion 26
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'com.android.support:appcompat-v7:26.1.0'
    implementation 'com.android.support.constraint:constraint-layout:1.1.3'
    implementation 'com.google.firebase:firebase-database:11.0.4'
    implementation 'com.google.firebase:firebase-core:11.0.4'
    implementation 'com.google.firebase:firebase-auth:11.0.4'
    implementation 'com.google.firebase:firebase-storage:11.0.4'
    implementation 'com.google.firebase:firebase-firestore:11.0.4'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test:runner:1.0.2'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
    implementation 'com.android.support:design:26.1.0'
    implementation 'com.intuit.sdp:sdp-android:1.0.6'
    implementation 'com.intuit.ssp:ssp-android:1.0.6'
    implementation 'com.android.support:cardview-v7:26.1.0'

}
apply plugin: 'com.google.gms.google-services'

并且同步时我仍然收到消息

  

错误:(27,20)无法解决:   com.google.firebase:firebase-firestore:11.0.4

我无法同步com.google.firebase:firebase-firestore:11.0.4请帮助我。

1 个答案:

答案 0 :(得分:0)

更改此内容:

buildscript {

repositories {
    jcenter()
    google()
}
dependencies {
    classpath 'com.android.tools.build:gradle:3.0.1'
    classpath 'com.google.gms:google-services:3.1.0'
  }
}

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



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

对此:

buildscript {

repositories {
      google()
      jcenter()
}
dependencies {
    classpath 'com.android.tools.build:gradle:3.0.1'
    classpath 'com.google.gms:google-services:3.1.0'
  }
}

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



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

您需要按照Firebase文档中的指定,在顶级gradle文件中添加google()回购,并且它也应该在jcenter()之前