WaqasArshad
WaqasArshad

Reputation: 257

Firebase not working?

Creating a Firebase Push Notification application in android studio. i did everything and searched everywhere but i could not get any solution. i am getting this same error again and again. Let me post my Gradle files code. please i desperately need help.

Program type already present: com.google.android.gms.common.AccountPicker

and some times

Program type already present: com.google.android.gms.maps.CameraUpdate

here is my app gradle

apply plugin: 'com.android.application'

android {
    compileSdkVersion rootProject.ext.compileSdkVersion
    buildToolsVersion rootProject.ext.buildToolsVersion
    defaultConfig {
        applicationId "com.Package.Myapp"
        minSdkVersion rootProject.ext.minSdkVersion
        targetSdkVersion rootProject.ext.targetSdkVersion
        versionCode 2
        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:$rootProject.ext.espressoVersion", {
        exclude group: 'com.android.support', module: 'support-annotations'
    })
    compile "com.android.support:appcompat-v7:$rootProject.ext.supportLibraryVersion"
    compile "com.android.support.constraint:constraint-layout:$rootProject.ext.constraintLayoutVersion"
    compile "com.google.firebase:firebase-messaging:$rootProject.ext.gmsVersion"
    compile "com.google.android.gms:play-services-vision:$rootProject.ext.gmsVersion"
    compile "com.google.android.gms:play-services-maps:$rootProject.ext.gmsVersion"
    testCompile "junit:junit:$rootProject.ext.junitVersion"

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

And here is my project gradle

// 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()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.1.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()
        google()
    }
}

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

ext{
    // Sdk and tools
    minSdkVersion = 15
    targetSdkVersion = 26
    compileSdkVersion = 26
    buildToolsVersion = '26.0.2'

    // App dependencies
    gmsVersion = "11.0.0"
    supportLibraryVersion = '27.0.2'
    guavaVersion = '18.0'
    junitVersion = '4.12'
    mockitoVersion = '1.10.19'
    powerMockito = '1.6.2'
    hamcrestVersion = '1.3'
    runnerVersion = '0.5'
    rulesVersion = '0.5'
    espressoVersion = '2.2.2'
    constraintLayoutVersion = "1.0.2"
}

its a simple webview wrapper application. and i am trying to implement Firebase push notification service on it.

Upvotes: 2

Views: 312

Answers (1)

On your project gradle file try replace this line

classpath 'com.google.gms:google-services:3.0.0'

with this:

classpath 'com.google.gms:google-services:3.2.0'

Also you may try to update these versions:

buildToolsVersion = '27.0.3'
supportLibraryVersion = '27.1.1'

Upvotes: 1

Related Questions