首页 > 解决方案 > 找不到 com.google.android.gms.internal.zzbfm 无法访问 zzbfm 类文件

问题描述

我正在将我的 Android 应用程序项目GCMFCM. 为此,我在 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'

标签: androidgoogle-mapsfirebaseandroid-gradle-pluginfirebase-cloud-messaging

解决方案


为了解决您的问题,首先我会要求您始终使用指定和更新的版本。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'

这将解决您的问题。


推荐阅读