加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 编程开发 > Java > 正文

java – “无法解析:com.google.firebase:firebase-core:9.0.

发布时间:2020-12-15 02:17:13 所属栏目:Java 来源:网络整理
导读:我想在我的 Android应用程序中使用fire base来进行身份验证 我创建了应用程序,然后下载了JSON文件并将其粘贴到app文件夹中 我将此添加到我的build.gradle项目 // Top-level build file where you can add configuration options common to all sub-projects/
我想在我的 Android应用程序中使用fire base来进行身份验证

>我创建了应用程序,然后下载了JSON文件并将其粘贴到app文件夹中
>我将此添加到我的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
}

>将此适用添加到我的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'

但是出现了这个错误

>这个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);
        }
    }

解决方法

将此行com.google.firebase:firebase-auth:9.6.1’添加到您的build.gradle依赖项,例如: https://firebase.google.com/docs/android/setup,而不是核心使用auth.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读