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

我只是一个虾纸丫 提交于 2019-12-23 12:14:03

问题


I am migrating my Android app project from GCM to FCM. For this I use Firebase assistant tool in Android Studio and followed instructions from Google developer guide. Everything went fine and changed my app code for FCM according to Assistant tool. Now, its time to run and test app. And I got following strange error :

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

I am getting this error where I am using google maps and trying to set marker position. Here's my app level gradle :

buildscript {
    repositories {
        maven { url 'https://maven.fabric.io/public' }
    }

    dependencies {
        classpath 'io.fabric.tools:gradle:1.+'
    }
}
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'

repositories {
    maven { url 'https://maven.fabric.io/public' }
    mavenCentral()
    maven { url 'https://dl.bintray.com/kennyc1012/maven' }
}


android {
    signingConfigs {
        msapp {
        }
    }

    compileSdkVersion 26
    buildToolsVersion '27.0.3'
    defaultConfig {
        applicationId "com.package"
        minSdkVersion 16
        targetSdkVersion 28
        multiDexEnabled true
        useLibrary 'org.apache.http.legacy'
        compileOptions {
            sourceCompatibility JavaVersion.VERSION_1_7
            targetCompatibility JavaVersion.VERSION_1_7
        }
        renderscriptTargetApi 18
        renderscriptSupportModeEnabled true
    }
    dexOptions {
        javaMaxHeapSize "4g"
    }
    buildTypes {

        release {
            lintOptions {
                checkReleaseBuilds false
                abortOnError false
            }
            minifyEnabled false
            shrinkResources false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    //Default
    implementation fileTree(include: ['*.jar'], dir: 'libs')
    implementation 'com.google.firebase:firebase-messaging:11.8.0'
    testImplementation 'junit:junit:4.12'

    //modules
    implementation 'com.facebook.android:facebook-android-sdk:4.+'
    //jar files
    implementation files('libs/classes.jar')
    implementation files('libs/YouTubeAndroidPlayerApi.jar')

    //google repos
    implementation 'com.android.support:appcompat-v7:26.0.0'
    implementation 'com.android.support:support-v4:26.0.0'
    implementation 'com.android.support:recyclerview-v7:26.0.0'
    implementation 'com.google.android.gms:play-services:11.8.0'
    implementation 'com.google.android.gms:play-services-analytics:11.8.0'
    implementation 'com.google.android.gms:play-services-maps:11.8.0'
    implementation 'com.android.support:design:26.0.0'


    //square lib
    implementation 'com.squareup.retrofit2:converter-gson:2.0.0'
    //compile 'com.squareup.leakcanary:leakcanary-android:1.5'

    //text manupulation
    implementation 'commons-lang:commons-lang:2.6'

    //permission library.
    implementation 'com.karumi:dexter:5.0.0'

    implementation 'com.google.firebase:firebase-core:16.0.3'
}

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

回答1:


To resolve your problem, first i will ask you to always use specified and updated version. 1. Replace + with specific version here : classpath 'io.fabric.tools:gradle:1.25.4' 2. Try to use same version for now to run the apk,

  compileSdkVersion 27
  buildToolsVersion '27.0.3'

  targetSdkVersion 27
  implementation 'com.android.support:appcompat-v7:27.1.1'
  implementation 'com.android.support:support-v4:27.1.1'
  implementation 'com.android.support:recyclerview-v7:27.1.1'

3. Use an updated version of google play service

 implementation 'com.google.android.gms:play-services:16.0.3'
 implementation 'com.google.android.gms:play-services-analytics:16.0.3'
 implementation 'com.google.android.gms:play-services-maps:15.0.1'

This will fix your problem.




回答2:


Please Change your Firebase and Google Library to same version . For an Example like this

      implementation 'com.google.android.gms:play-services:12.0.1'
      implementation 'com.google.android.gms:play-services-analytics:12.0.1'
      implementation 'com.google.android.gms:play-services-maps:12.0.1'
        //your firebase lib version to the same version 
      implementation 'com.google.firebase:firebase-core:12.0.1'



回答3:


In most cases is required to upgrade play-services and firebase version dependencies, maybe the last one available if you are using androidx but if not:

Try to check it out the maven_repository and choose some version that helps you fix it. For example:

implementation 'com.google.android.gms:play-services-analytics:16.0.8'
implementation 'com.google.android.gms:play-services-maps:16.1.0'
implementation 'com.google.firebase:firebase-messaging:15.0.2'

the chosen version is the last one before version 17 due to the v17.0.0 require androidx (in play-service)

Don't forget to update your google-service in your build.gradle(project)

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



回答4:


According to the official documentation regarding Latest SDK versions, please change the following line of code:

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

to

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

And according to official documentation regarding on to set up Google Play Services, please change the follwing lines of code:

implementation 'com.google.android.gms:play-services:11.8.0'
implementation 'com.google.android.gms:play-services-analytics:11.8.0'
implementation 'com.google.android.gms:play-services-maps:11.8.0'

to

//implementation 'com.google.android.gms:play-services:11.8.0' //Commented line
implementation 'com.google.android.gms:play-services-analytics:16.0.3'
implementation 'com.google.android.gms:play-services-maps:15.0.1

Please also be sure to have:

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

In your top level build.gradle file.




回答5:


I encountered same issue after migrating AndroidX and Solved by changing version of gms library for maps and location as below

implementation 'com.google.android.gms:play-services-maps:15.0.1'
implementation 'com.google.android.gms:play-services-location:15.0.1'


来源:https://stackoverflow.com/questions/52251502/cannot-access-zzbfm-class-file-for-com-google-android-gms-internal-zzbfm-not-fou

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!