0

This is my project's gradle files, I'm trying to get it to sync. I have included error logs, and code . Below you will find the files in order.

I got most of my code from the firebase docs, and still keep getting a fail, when I try syncing my project

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'
Vadim Kotov
  • 8,084
  • 8
  • 48
  • 62

2 Answers2

0

I think that you have to add the libraries of Firebase to your project, fo example if you need to use the storage you need to add the:

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

in your gradle dependencies, but before of that you need to registrer your project in the Firebase page, get your key and downlowad the

google-services.json

for your project. Check the tutorials in their page.

https://firebase.google.com/docs/android/setup?hl=es-419

  • I have added those service into my project , thanks for the tip bro. Can I get a up vote? I need this question answered to continue learning –  Sep 05 '17 at 02:18
0

In your application build.grade, try removing:

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'

and replacing them with this dependency:

compile 'com.google.android.gms:play-services-gcm:8.4.0'
Casey Murray
  • 1,582
  • 17
  • 21
  • This compiles however are you sure this will work for my project and give me the same libraries? Sorry I am a noob, I appreciate your reply –  Sep 05 '17 at 04:34