Firebase云消息传递gradle设置

问题描述 投票:0回答:2

我正在尝试在我的应用程序中添加firebase云消息,但问题恰好出现在我的gradle依赖项中

这就是我在依赖项中添加的内容:

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

但它不起作用最终显示错误。

我的项目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
}

我的应用程序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'

错误Logcat

logcat任何解决方案?我也尝试将所有依赖项更新到他们的新版本,但它也没有用。

android firebase android-gradle firebase-cloud-messaging
2个回答
0
投票

尝试改变之前使用过的gradle版本,几天前我也面临同样的问题

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

1
投票

请查看Firebase Android Release Notes,了解适用于Firebase功能的不同核心的最新版本。

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

尝试将其更新为最新版本。

© www.soinside.com 2019 - 2024. All rights reserved.