简体   繁体   中英

use of libraries in android studio

com.google.firebase:firebase-core:11.2.2
com.google.firebase:firebase-database:11.2.2
com.google.firebase:firebase-storage:11.2.2

these libraries cannot seem to work,and i can't use providers such as google,Facebook,twitter to login in my android project. I've tried to updated the android studio and now i'm using android studio 2.3.3 and i'm using:

    app:




compileSdkVersion 26
    buildToolsVersion "26.0.1"

 minSdkVersion 16
        targetSdkVersion 26
        versionCode 1




 project:

    buildscript {
        repositories {
            jcenter()
        }
        dependencies {
            classpath 'com.android.tools.build:gradle:2.3.3'

            // NOTE: Do not place your application dependencies here; they belong
            // in the individual module build.gradle files
            classpath 'com.google.gms:google-services:3.1.0'
        }
    }

    allprojects {
        repositories {
            jcenter()
        }
    }

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

As per the official Firebase Documentation you need to add Google's Maven repository to your project-level build.gradle:

buildscript {
    // ...
    dependencies {
        // ...
        classpath 'com.google.gms:google-services:3.1.0' // google-services plugin
    }
}

allprojects {
    // ...
    repositories {
        jcenter()
        maven {
            url "https://maven.google.com" // Google's Maven repository
        }
    }
}

Then, in your module Gradle file (usually the app/build.gradle), add the apply plugin line at the bottom of the file to enable the Gradle plugin:

apply plugin: 'com.android.application'

android {
  // ...
}

dependencies {
  // ...
  compile 'com.google.firebase:firebase-core:11.2.2'
  compile 'com.google.firebase:firebase-messaging:11.2.2'
  // Getting a "Could not find" error? Make sure you have
  // the latest Google Repository in the Android SDK manager
}

// ADD THIS AT THE BOTTOM
apply plugin: 'com.google.gms.google-services'

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM