无法访问zzbfm类文件找不到zzbfm,firebase,android? [英] Cannot access zzbfm class file zzbfm not found, firebase, android?

查看:104
本文介绍了无法访问zzbfm类文件找不到zzbfm,firebase,android?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在我的应用程序中集成了播放服务和Firebase. 当我运行应用程序时,出现此错误

I have integrated play services and firebase in my app. When I run the application I get this error

cannot access zzbfm
class file for com.google.android.gms.internal.zzbfm not found

这是我的最高荣誉

buildscript {

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


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

allprojects {
repositories {
    google()
    jcenter()
}
tasks.withType(JavaCompile) { options.deprecation = true }
}

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

这是我的应用程序级别的礼物

This is my app level gradle

apply plugin: 'com.android.application'
android {
compileSdkVersion 27
defaultConfig {
    applicationId "ima.rvtech"
    minSdkVersion 23
    targetSdkVersion 27
    versionCode 1
    versionName "1.0"
    testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
}
}

dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:27.0.2'
implementation 'com.android.support:design:27.0.2'
implementation 'com.android.support.constraint:constraint-layout:1.1.0'
implementation 'com.android.support:support-v4:27.0.2'
implementation 'com.google.android.gms:play-services-location:15.0.1'
implementation 'com.google.firebase:firebase-core:16.0.0'
implementation 'com.google.firebase:firebase-auth:11.6.2'
implementation 'com.google.firebase:firebase-messaging:11.8.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.google.dagger:dagger:2.16'
annotationProcessor 'com.google.dagger:dagger-compiler:2.16'
implementation 'com.jakewharton:butterknife:8.8.1'
annotationProcessor 'com.jakewharton:butterknife-compiler:8.8.1'
implementation 'com.github.bumptech.glide:glide:4.6.1'
annotationProcessor 'com.github.bumptech.glide:compiler:4.6.1'
implementation 'io.reactivex.rxjava2:rxjava:2.1.13'
implementation 'com.squareup.retrofit2:retrofit:2.3.0'
implementation 'com.squareup.retrofit2:converter-gson:2.3.0'
implementation 'com.balsikandar.android:crashreporter:1.0.9'
implementation "android.arch.persistence.room:runtime:1.0.0"
annotationProcessor "android.arch.persistence.room:compiler:1.0.0"
}

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

当我尝试获取远程消息内容时,我在MessageService类中指出了错误

I am getting the error pointed in my MessageService class pointing when I am trying to get remotemessage conntent

public class FCMMessageService extends FirebaseMessagingService {

@Override
public void onMessageReceived(RemoteMessage message) {
    sendMyNotification(message.getNotification().getBody());
}


private void sendMyNotification(String message) {

    //On click of notification it redirect to this Activity
    Intent intent = new Intent(this, ActivityHome.class);
    intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
    PendingIntent pendingIntent = PendingIntent.getActivity(this, 0, intent, PendingIntent.FLAG_ONE_SHOT);

    Uri soundUri = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION);
    NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder(this,"x")
            .setSmallIcon(R.mipmap.ic_launcher)
            .setContentTitle("My Firebase Push notification")
            .setContentText(message)
            .setAutoCancel(true)
            .setSound(soundUri)
            .setContentIntent(pendingIntent);

    NotificationManager notificationManager =
            (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);

    notificationManager.notify(0, notificationBuilder.build());
}
}

已经检查了其他问题上提到的解决方案,但是这些答案都无效.

Have already checked solutions mentioned on other questions, but none of those answers worked.

有解决方案吗?

推荐答案

您不能混合版本<== 12和版本> = 15的Firebase库.

You can't mix versions <= 12 and versions >= 15 of Firebase libraries.

implementation 'com.google.firebase:firebase-core:16.0.0'
implementation 'com.google.firebase:firebase-auth:11.6.2'
implementation 'com.google.firebase:firebase-messaging:11.8.0'

最简单的解决方法是将所有这些升级到版本16或更高版本:

The easiest fix is to upgrade all of these to version 16 or later:

implementation 'com.google.firebase:firebase-core:16.0.0'
implementation 'com.google.firebase:firebase-auth:16.0.1'
implementation 'com.google.firebase:firebase-messaging:17.0.0'

所有这些版本均来自设置Android Firebase 文档,因此请确保在那里检查最新更新.

All of these versions are from the setting up Firebase for Android documentation, so be sure to check there for the latest updates.

背景:在版本12和更低版本中,项目中所有Firebase(和Play服务)库的版本必须完全相同.在以后的版本15中,您可以混合使用版本.但是没有办法在单个项目中混合< = 12和> = 15库.

这篇关于无法访问zzbfm类文件找不到zzbfm,firebase,android?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆