shikher.mishra
shikher.mishra

Reputation: 155

configuration issue of Firebase with Android Project

I have created an Android Project in which I have to use a database to store information. I have to create tables in it so that the clients use the application with the fresh data which is there in the Firebase.I have created an account in Firebase and wrote all the things which needed to be there in gradle file.

Build.gradel file(Project file)

    // 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:1.5.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()
    }
}

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

Build.gradle(module:app)

    apply plugin: 'com.android.application'

        android {
            compileSdkVersion 23
            buildToolsVersion "24.0.2"

     packagingOptions{
            exclude 'META-INF/LICENSE'
            exclude 'META-INF/LICENSE-FIREBASE.txt'
            exclude 'META-INF/NOTICE'

        }

            defaultConfig {
                applicationId "com.example.hsports.bandpop"
                minSdkVersion 14
                targetSdkVersion 23
                versionCode 1
                versionName "1.0"
            }
            buildTypes {
                release {
                    minifyEnabled false
                    proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
                }
            }
        }

        dependencies {
            compile fileTree(dir: 'libs', include: ['*.jar'])
            testCompile 'junit:junit:4.12'
            compile 'com.android.support:appcompat-v7:23.4.0'
            compile 'com.android.support:design:23.4.0'
            compile 'com.google.firebase:firebase-storage:9.6.1'
compile 'com.google.firebase:firebase-core:9.6.1'

        }

        apply plugin: 'com.google.gms.google-services'

When I am clicking on the sync button to sync then it's giving me this error.

Error:Failed to resolve: com.google.firebase:firebase-core:9.6.1
<a href="openFile:C:/Users/I324671/AndroidStudioProjects/BandPop/app/build.gradle">Open File</a><br><a href="open.dependency.in.project.structure">Show in Project Structure dialog</a>

Error:(26, 13) Failed to resolve: com.google.firebase:firebase-storage:9.6.1
<a href="openFile:C:/Users/I324671/AndroidStudioProjects/BandPop/app/build.gradle">Show in File</a><br><a href="open.dependency.in.project.structure">Show in Project Structure dialog</a>

Upvotes: 0

Views: 107

Answers (2)

pal gajjar
pal gajjar

Reputation: 531

I think you are missing packagingOptions{ exclude 'META-INF/LICENSE' exclude 'META-INF/LICENSE-FIREBASE.txt' exclude 'META-INF/NOTICE' } in Build.gradle(module:app) file above buildTypes{}tag

Upvotes: 1

breakline
breakline

Reputation: 6073

You need to add the mentioned missing dependency too:

compile 'com.google.firebase:firebase-storage:9.6.1'
compile 'com.google.firebase:firebase-core:9.6.1'

Upvotes: 0

Related Questions