【问题标题】:Error: cannot access zzbfm class file for com.google.android.gms.internal.zzbfm not found错误:找不到 com.google.android.gms.internal.zzbfm 无法访问 zzbfm 类文件
【发布时间】:2018-07-31 09:40:38
【问题描述】:

我在尝试构建我的应用程序时收到以下错误:

错误:无法访问 zzbfm 找不到 com.google.android.gms.internal.zzbfm 的类文件

这是我的 build.gradle 文件代码:

apply plugin: 'com.android.application'


android {
compileSdkVersion 27
buildToolsVersion '27.0.3'
defaultConfig {

    applicationId "myapplicationid"
    minSdkVersion 21
    targetSdkVersion 27
    multiDexEnabled true
    versionCode 12
    versionName "1.0.1"
    testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    vectorDrawables.useSupportLibrary = true
}
signingConfigs {
    key {
        keyAlias 'anavasis'
        keyPassword 'anavasis'
             storeFile file('jks_file_path')
        storePassword 'anavasis'
    }
}
buildTypes {
    debug {
    }
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
}
sourceSets { main { res.srcDirs = ['src/main/res', 'src/main/res/anim'] } }
allprojects {
    repositories {
        maven { url "https://jitpack.io" }
    }
}
}

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
    exclude group: 'com.android.support', module: 'support-annotations'
})
//compile 'com.google.maps.android:android-maps-utils:0.4+'

compile 'com.android.support:appcompat-v7:27.1.1'
compile 'com.google.android.gms:play-services:11.8.0'
compile 'io.ticofab.androidgpxparser:parser:0.2.0'
compile 'com.google.maps.android:android-maps-utils:0.4.+'
compile 'com.android.support:design:27.1.0'
compile 'com.android.support:support-v4:27.1.0'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.android.support:support-vector-drawable:27.1.1'
compile 'com.android.support:recyclerview-v7:27.1.0'
testCompile 'junit:junit:4.12'
compile 'com.google.code.gson:gson:2.8.0'
compile 'com.github.bumptech.glide:glide:3.6.0'
compile 'com.squareup.picasso:picasso:2.5.2'

compile 'com.android.support:cardview-v7:27.1.0'

compile 'com.google.code.gson:gson:2.4'
compile 'com.mcxiaoke.volley:library:1.0.19'
implementation 'com.android.support:multidex:1.0.3'

compile 'com.android.billingclient:billing:1.0'

compile 'com.google.firebase:firebase-core:16.0.1'
compile 'com.google.firebase:firebase-crash:16.0.1'
compile 'com.google.firebase:firebase-auth:16.0.1'


 }

我已经在 https://stackoverflow.com/a/50732851/1465756 上检查了答案,但我没有多个 firebase 版本。

如果我删除 3 行 compile firebase 应用程序运行没有问题,但我想我应该将它们放在我的 build.gradle 中。

【问题讨论】:

    标签: android firebase android-gradle-plugin android-studio-3.1.3


    【解决方案1】:

    在顶级 gradle 文件中使用以下内容:

    classpath 'com.android.tools.build:gradle:3.1.0'
    classpath 'com.google.gms:google-services:4.0.2'
    

    为了能够使用最新的 firebase 版本,还将 Android Studio 升级到版本 3.1

    如果您不使用 Android Studio 3.1 来开发应用,则需要升级才能在 IDE 中获得正确的版本检查行为。

    https://android-developers.googleblog.com/2018/05/announcing-new-sdk-versioning.html


    同时更新:

    compile 'com.google.android.gms:play-services:11.8.0'
    

    进入这个:

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

    注意:不要使用组合播放服务目标。它引入了数十个库,使您的应用程序膨胀。相反,请仅指定您的应用使用的特定 Google Play 服务 API。

    https://developers.google.com/android/guides/setup

    也检查一下:

    Android | Cannot add all Google libraries for version 15.0.1

    【讨论】:

    • 我有 android studio 3.1.3 并在我的项目 gradle 中添加了你建议的类路径(也尝试了 com.android.tools.build:gradle:3.1.3 作为 android studio 的建议)但是没有任何效果
    • 为什么你使用编译思想而不是实现?
    • 有什么区别?我试图将编译转为实现,但它再次不起作用
    • 我只是想知道,因为它在新的 gradle developer.android.com/studio/build/… 中已被弃用(与 firebase 无关)
    • 检查更新@arniotaki 你还需要更新谷歌服务库,刚刚看到你正在使用它
    猜你喜欢
    • 2019-02-14
    • 2018-07-20
    • 2018-10-08
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2022-12-01
    • 1970-01-01
    相关资源
    最近更新 更多