user2294087
user2294087

Reputation: 101

Firebase cloud messaging gradle settings

I'm trying to add firebase cloud messaging in my app but the problem happens to be in my gradle dependencies

this is what i'm adding in my dependencies:

implementation 'com.google.firebase:firebase-messaging:17.3.3'

but it doesn't work ends up showing errors.

My Project gradle :

buildscript {

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

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

allprojects {
    repositories {
        google()
        jcenter()
        maven { url "https://jitpack.io" }
    }
}

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

My App gradle :

    apply plugin: 'com.android.application'

android {
    compileSdkVersion 28
    defaultConfig {
        applicationId "com.my.package"
        minSdkVersion 21
        targetSdkVersion 28
        versionCode 12
        versionName "12.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }

    dataBinding {
        enabled = true
    }
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'com.android.support:appcompat-v7:28.0.0'
    implementation 'com.android.support.constraint:constraint-layout:1.1.3'
    implementation 'com.android.support:support-v4:28.0.0'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test:runner:1.0.2'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
    implementation 'com.android.support:design:28.0.0'
    implementation 'com.google.firebase:firebase-auth:16.1.0'
    implementation 'com.google.firebase:firebase-storage:16.0.5'
    implementation 'com.google.firebase:firebase-core:16.0.6'
    implementation 'com.squareup.retrofit2:retrofit:2.4.0'
    implementation 'com.squareup.retrofit2:converter-gson:2.4.0'
    implementation 'com.github.bumptech.glide:glide:4.8.0'
    annotationProcessor 'com.github.bumptech.glide:compiler:4.8.0'
    implementation 'de.hdodenhof:circleimageview:2.0.0'
    implementation 'com.sothree.slidinguppanel:library:3.4.0'
    implementation 'com.cocosw:bottomsheet:1.+@aar'
    implementation 'com.google.code.gson:gson:2.8.2'
    implementation 'com.github.ybq:AndroidSpinKit:v1.0.0'
    implementation 'com.google.android.gms:play-services-ads:17.1.2'
}
apply plugin: 'com.google.gms.google-services'

Error Logcat

logcat Any solution ?? I also tried updating all dependencies to their new version but it also didn't worked.

Upvotes: 2

Views: 2219

Answers (2)

Jaykishan Sewak
Jaykishan Sewak

Reputation: 822

Try by changing gradle version it worked me before, I too faced same issue few days back

classpath 'com.android.tools.build:gradle:3.2.1'

Upvotes: 0

Elio Lako
Elio Lako

Reputation: 1351

Take a look at the Firebase Android Release Notes for the latests versions available for the different cores of Firebase functionalities.

implementation 'com.google.firebase:firebase-messaging:17.4.0' 

Try updating it to the latest version available.

Upvotes: 3

Related Questions