firebase后端

bqujaahr  于 2021-07-03  发布在  Java
关注(0)|答案(2)|浏览(333)

这个问题在这里已经有答案了

未能解析:com.google。firebase:firebase-core:11.2.0(6个答案)
三年前关门了。
这是我项目的gradle文件,我正在尝试同步它。我已经包括了错误日志和代码。在下面你会发现文件的顺序。
我的大部分代码都是从firebase文档中获得的,但当我尝试同步我的项目时,仍然会失败

Error:(40, 13) Failed to resolve: com.google.firebase:firebase-auth:11.2.0
<a href="openFile:C:/Users/Karanvir/Desktop/chat/Chat/app/build.gradle">Show in File</a><br><a href="open.dependency.in.project.structure">Show in Project Structure dialog</a>

Error:(39, 13) Failed to resolve: com.google.firebase:firebase-storage:11.2.0
<a href="openFile:C:/Users/Karanvir/Desktop/chat/Chat/app/build.gradle">Show in File</a><br><a href="open.dependency.in.project.structure">Show in Project Structure dialog</a>

Error:Failed to resolve: com.google.firebase:firebase-core:11.2.0
<a href="openFile:C:/Users/Karanvir/Desktop/chat/Chat/app/build.gradle">Open File</a><br><a href="open.dependency.in.project.structure">Show in Project Structure dialog</a>

Error:(42, 13) Failed to resolve: com.google.firebase:firebase-database:11.2.0
<a href="openFile:C:/Users/Karanvir/Desktop/chat/Chat/app/build.gradle">Show in File</a><br><a href="open.dependency.in.project.structure">Show in Project Structure dialog</a>

Error:Failed to resolve: annotationProcessor
<a href="openFile:C:/Users/Karanvir/Desktop/chat/Chat/app/build.gradle">Open File</a>
// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    repositories {
        jcenter()
        maven {
            url "https://maven.google.com" // Google's Maven repository
        }
    }
    dependencies {
        classpath 'com.google.gms:google-services:3.1.0'
        classpath 'com.android.tools.build:gradle:2.3.2'
        classpath 'com.jakewharton:butterknife-gradle-plugin:8.8.1'
        classpath 'com.google.gms:google-services:3.1.0'

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

allprojects {
    repositories {
        jcenter()
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}
apply plugin: 'com.android.application'

android {
    compileSdkVersion 25
    buildToolsVersion "25.0.2"
    defaultConfig {
        applicationId "com.karanvir.chat"
        minSdkVersion 16
        targetSdkVersion 25
        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(include: ['*.jar'], dir: 'libs')
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })

    compile 'com.android.support:appcompat-v7:25.3.1'
    compile 'com.android.support.constraint:constraint-layout:1.0.2'
    compile 'com.android.support:design:25.3.1'
    testCompile 'junit:junit:4.12'
    compile('io.socket:socket.io-client:1.0.0') {
        // excluding org.json which is provided by Android
        exclude group: 'org.json', module: 'json'
    }
    compile 'com.squareup.picasso:picasso:2.5.2'
    compile 'com.jakewharton:butterknife:8.8.1'
    annotationProcessor 'com.jakewharton:butterknife-compiler:8.8.1'
    compile 'com.android.support:recyclerview-v7:25.3.1'
    compile 'com.google.firebase:firebase-storage:11.2.0'
    compile 'com.google.firebase:firebase-auth:11.2.0'
    compile 'com.google.firebase:firebase-messaging:11.2.0'
    compile 'com.google.firebase:firebase-database:11.2.0'
}
apply plugin: 'com.google.gms.google-services'
apply plugin: 'com.jakewharton.butterknife'
apply plugin: 'com.google.gms.google-services'
ht4b089n

ht4b089n1#

在应用程序build.grade中,尝试删除:

compile 'com.google.firebase:firebase-storage:11.2.0'
compile 'com.google.firebase:firebase-auth:11.2.0'
compile 'com.google.firebase:firebase-messaging:11.2.0'
compile 'com.google.firebase:firebase-database:11.2.0'

并用此依赖项替换它们:

compile 'com.google.android.gms:play-services-gcm:8.4.0'
vh0rcniy

vh0rcniy2#

我认为您必须将firebase的库添加到您的项目中,例如,如果您需要使用存储来添加:

compile 'com.google.firebase:firebase-storage:10.2.1'

在gradle依赖项中,但在此之前,您需要在firebase页面中注册您的项目,获取您的密钥并下载

google-services.json

为了你的项目。查看他们页面中的教程。
https://firebase.google.com/docs/android/setup?hl=es-419

相关问题