错误:无法访问zzbgl

P. *_*era 4 android firebase firebase-analytics

我正在开发应用程序,但出现以下错误:

error: cannot access zzbgl
class file for com.google.android.gms.internal.zzbgl not found
Run Code Online (Sandbox Code Playgroud)

我知道StackOverflow中有一个问题,与我四天前发布的错误相同,但是答案对我的情况没有帮助。(我正在谈论这个

在我的项目中设置Firebase Analytics之后,错误立即出现。

我的build.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'

android {
    compileSdkVersion 26
    buildToolsVersion '27.0.3'
    useLibrary 'org.apache.http.legacy'
    defaultConfig {
        applicationId 'com.geoactio.montferri'
        minSdkVersion 14
        targetSdkVersion 26
        multiDexEnabled true
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
        }
    }
    dependencies {
         implementation 'com.android.support:multidex:1.0.3'
         implementation 'com.android.support:appcompat-v7:26.1.0'
//        compile 'com.google.code.ksoap2-android:ksoap2-android:3.6.0'
        implementation 'com.google.android.gms:play-services:12.0.1'
        //implementation 'com.google.android.gms:play-services-maps:15.0.1'
        //implementation 'com.google.android.gms:play-services-location:15.0.1'
        implementation "com.google.android.gms:play-services-base:15.0.1"
        implementation 'com.navercorp.pulltorefresh:library:3.2.3@aar'

    }
    productFlavors {
    }
    lintOptions {
        disable 'MissingTranslation'
    }

    dexOptions {
        javaMaxHeapSize "4g"
        preDexLibraries = false
    }
}
repositories {
    maven { url 'https://oss.sonatype.org/content/repositories/ksoap2-android-releases' }
    maven { url 'https://maven.fabric.io/public' }
}

dependencies {
    implementation 'com.google.firebase:firebase-core:16.0.1'
    implementation 'com.google.firebase:firebase-messaging:17.1.0'

    implementation('com.crashlytics.sdk.android:crashlytics:2.9.4@aar') {
    transitive = true;
    }
}

apply plugin: 'com.google.gms.google-services'
Run Code Online (Sandbox Code Playgroud)

我的build.gradle(项目:myPorojectName)文件是这样的:

buildscript {
    repositories {
        jcenter()
        maven {
            url 'https://maven.google.com/'
            name 'Google'
        }
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.1.4'
        classpath 'com.google.gms:google-services:4.1.0'
    }
}

allprojects {
    repositories {
        jcenter()
        maven {
            url 'https://maven.google.com/'
            name 'Google'
        }
    }
}
Run Code Online (Sandbox Code Playgroud)

并点击错误导致我在这里,刚过新的MarkerOptions()

mapView.addMarker(new MarkerOptions().position(new LatLng(puntomarker.getLatitud(), puntomarker.getLongitud()))
                    .zIndex(0.5f)
                    .anchor(0.5f, 0.5f)
                    .title(puntomarker.getId() + "")
                    .snippet(puntomarker.getNombre())
                    .icon(BitmapDescriptorFactory.fromBitmap(((BitmapDrawable) marker).getBitmap())));
Run Code Online (Sandbox Code Playgroud)

(正在mapView一个GoogleMap实例)。

我希望有人能看到错误并解决此问题,在此先非常感谢您。如果您需要更多信息来解决此问题,请告诉我。

Ale*_*amo 8

谷歌API发行说明指示的联合的支持play-services在2018年4月结束的库:

从15.0.0版本开始,将不再有一个播放服务别名目标来引入所有Google Play服务组件。建议将其反对一段时间。

您再也不能像这样对合并的Google Play服务目标指定单一依赖项:

implementation 'com.google.android.gms:play-services:12.0.1'.
Run Code Online (Sandbox Code Playgroud)

如果以前的版本支持此功能,则它将以更多的方式引入所有 Google Play库。请参阅《设置指南》表1中的API列表,并仅包括您的应用使用的特定API 。

Google Maven存储库的检查确认版本12.0.1是合并的播放服务目标的最新版本。

因此,请删除上述实现并仅使用:

implementation "com.google.android.gms:play-services-base:15.0.1"
Run Code Online (Sandbox Code Playgroud)

如果您还使用其他播放服务,请将它们添加为单独的依赖项。