android上的firebase设置 [英] firebase setup on android

查看:29
本文介绍了android上的firebase设置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我无法在 android studio 上设置更新版本的 firebase.我已经在站点 firebase 上创建了项目的 json 文件,并将其复制到项目中,并在 gradle 中处理了行之后:

I can't setup the updated version of firebase on android studio. I've created json file of the project on the site firebase and copied it into the project and after coping lines in gradle:

buildscript {
    // ...
    dependencies {
        // ...
        classpath 'com.google.gms:google-services:3.0.0'
    }
}
apply plugin: 'com.android.application'
android {
  // ...
}
dependencies {
  compile 'com.google.firebase:firebase-core:9.0.1'
}
// ADD THIS AT THE BOTTOM
apply plugin: 'com.google.gms.google-services'

我收到以下错误:

无法解析:编译 'com.google.firebase:firebase-core:9.0.0'

我该如何解决?

推荐答案

我遇到了同样的问题.如果您使用的是 Android Studio,则应在 SDK 管理器中更新 google 存储库.

I had the same problem. If you are using Android studio, you should then update google repository in SDK Manager.

以下是我的build.grade(app)

apply plugin: 'com.android.application'
android {
    compileSdkVersion 23
    buildToolsVersion "23.0.3"
    useLibrary 'org.apache.http.legacy'
    defaultConfig {
        applicationId "package name"
        minSdkVersion 15
        targetSdkVersion 23
        versionCode 1
        versionName "1.0"
        vectorDrawables.useSupportLibrary = true
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }

}

dependencies {
    compile 'com.google.firebase:firebase-core:9.0.0'
}
apply plugin: 'com.google.gms.google-services'

这是我的build.grade(project)

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:2.1.0'
        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()
    }
}

这篇关于android上的firebase设置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆