【问题标题】:"Failed to resolve: com.google.firebase:firebase-core:9.0.0"“无法解决:com.google.firebase:firebase-core:9.0.0”
【发布时间】:2017-03-04 23:01:00
【问题描述】:

我想在我的 android 应用程序中使用 fire base 进行身份验证

  1. 我创建了应用程序,然后下载了 JSON 文件并将其粘贴到应用程序文件夹中
  2. 我将此添加到我的 build.gradle > 项目中

     // Top-level build file where you can add configuration options common to all sub-projects/modules.
    
    buildscript {
        repositories {
            jcenter()
        }
        dependencies {
            classpath 'com.android.tools.build:gradle:2.2.1'
            classpath 'com.google.gms:google-services:3.0.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
    }
    
  3. 将此应用添加到我的 build.gradle > 应用程序

    apply plugin: 'com.android.application'
    android {
        compileSdkVersion 24
        buildToolsVersion "23.0.1"
        defaultConfig {
            applicationId "com.example.mahmoud.loginwithfirebase"
            minSdkVersion 15
            targetSdkVersion 24
            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'])
        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:24.2.1'
        testCompile 'junit:junit:4.12'
    }
    apply plugin: 'com.google.gms.google-services'
    

    但是出现了这个错误

  1. 这个 MainActivity.java

    package com.example.mahmoud.loginwithfirebase;
    
    import android.support.v7.app.AppCompatActivity;
    import android.os.Bundle;
    
        public class MainActivity extends AppCompatActivity {
    
            @Override
            protected void onCreate(Bundle savedInstanceState) {
                super.onCreate(savedInstanceState);
                setContentView(R.layout.activity_main);
            }
        }
    

【问题讨论】:

  • “这个错误在我看来”不是一个非常具体的标题。将来您可能需要考虑让您的标题更具体地解决您的问题。

标签: java android firebase firebase-authentication


【解决方案1】:

将此行 com.google.firebase:firebase-auth:9.6.1' 添加到您的 build.gradle 依赖项中,如下所示:https://firebase.google.com/docs/android/setup 但不是核心使用身份验证。

【讨论】:

  • 错误:(25, 13) 无法解决:com.google.firebase:firebase-auth:9.6.1 在文件中显示
    在项目结构对话框中显示
  • 转到 Android SDK Manager 并安装两个库的最新版本:Google Play Services 和 Google Repository。如果它不起作用,请尝试使用 firebase-auth:9.6.0 而不是 9.6.1 。
猜你喜欢
  • 2016-09-15
  • 2016-09-19
  • 2016-09-15
  • 2022-01-10
  • 2017-11-15
  • 2021-04-20
  • 2018-11-08
  • 2018-01-23
  • 2019-03-25
相关资源
最近更新 更多