【问题标题】:Cannot access zzbfm class file for com.google.android.gms.internal.zzbfm not found找不到 com.google.android.gms.internal.zzbfm 无法访问 zzbfm 类文件
【发布时间】:2019-02-14 12:24:28
【问题描述】:

我正在将我的 Android 应用项目从 GCM 迁移到 FCM。为此,我在 Android Studio 中使用 Firebase 助手工具,并按照 Google 开发人员指南中的说明进行操作。一切顺利,并根据助手工具更改了FCM 的应用程序代码。现在,是时候运行和测试应用程序了。我得到了以下奇怪的错误:

无法访问未找到 com.google.android.gms.internal.zzbfm 的 zzbfm 类文件

我在使用谷歌地图并尝试设置标记位置时遇到此错误。 这是我的应用级别 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'

【问题讨论】:

  • 你的问题解决了吗?
  • 您可以尝试使IDE缓存无效并重新启动。菜单在文件下。万一某些东西没有正确更新并且旧的东西被缓存了

标签: android google-maps firebase android-gradle-plugin firebase-cloud-messaging


【解决方案1】:

为了解决您的问题,首先我会要求您始终使用指定和更新的版本。 1. 在此处将 + 替换为特定版本:classpath 'io.fabric.tools:gradle:1.25.4' 2. 现在尝试使用相同版本来运行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。使用更新版本的 google play 服务

 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'

这将解决您的问题。

【讨论】:

    【解决方案2】:

    请将您的 Firebase 和 Google 库更改为相同的版本。 对于这样的示例

          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】:

      在大多数情况下需要升级 play-services 和 firebase 版本依赖项,如果您使用 androidx 可能是最后一个可用的,但如果不是:

      尝试查看maven_repository 并选择一些可以帮助您修复它的版本。例如:

      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'
      

      由于 v17.0.0 需要 androidx(在 play-service 中),因此选择的版本是 17 版之前的最后一个版本

      别忘了在你的 build.gradle(project) 中更新你的 google-service

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

      【讨论】:

        【解决方案4】:

        我在迁移 AndroidX 后遇到了同样的问题,并且 通过更改地图和位置gms库版本解决,如下

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

        【讨论】:

          【解决方案5】:

          根据Latest SDK versions的官方文档,请更改以下代码行:

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

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

          根据set up Google Play Services的官方文档,请更改以下代码行:

          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.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
          

          还请务必:

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

          在您的顶级build.gradle 文件中。

          【讨论】:

            【解决方案6】:

            只需将库“......gms:play-services.....”的版本更新到最新版本 要查看最新版本,请参阅link

            【讨论】:

              猜你喜欢
              • 1970-01-01
              • 1970-01-01
              • 1970-01-01
              • 1970-01-01
              • 2018-02-04
              • 2019-09-17
              • 2018-07-20
              • 1970-01-01
              • 2018-10-08
              相关资源
              最近更新 更多