簡體   English   中英

錯誤:無法訪問 zzbgl。 找不到 com.google.android.gms.internal.zzbgl 的類文件

[英]error: cannot access zzbgl. class file for com.google.android.gms.internal.zzbgl not found

我想在我的應用中顯示地點的位置。

我收到無法訪問 zzbgl 的編譯錯誤

這是我的 gradle 文件:

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    //noinspection GradleCompatible
    implementation 'com.android.support:appcompat-v7:26.1.0'
    implementation 'com.android.support:support-v4:26.1.0'
    implementation 'com.android.support:design:26.1.0'
    implementation 'com.android.support.constraint:constraint-layout:1.1.3'
    implementation 'com.android.support:cardview-v7:26.1.0'
    implementation 'com.android.support:recyclerview-v7:26.1.0'
    implementation 'com.google.firebase:firebase-core:16.0.9'
    implementation 'com.google.firebase:firebase-messaging:18.0.0'
    implementation 'com.google.firebase:firebase-auth:17.0.0'
    implementation 'com.google.code.gson:gson:2.8.1'
    //noinspection UseOfBundledGooglePlayServices
    implementation 'com.google.android.gms:play-services:12.0.1'
    implementation 'com.google.android.gms:play-services-location:16.0.0'
    implementation 'com.android.volley:volley:1.1.0'
    implementation 'com.squareup.picasso:picasso:2.5.2'
    implementation 'de.hdodenhof:circleimageview:1.3.0'
    implementation 'com.google.maps.android:android-maps-utils:0.5'
    implementation 'com.whiteelephant:monthandyearpicker:1.3.0'
    implementation 'com.daimajia.slider:library:1.1.5@aar'
    implementation 'com.nineoldandroids:library:2.4.0'
    implementation 'com.tarun0.zxing-standalone:zxing-standalone:1.0.0'
    implementation 'com.edwardvanraak:MaterialBarcodeScanner:0.0.6-ALPHA'
    implementation "ru.tinkoff.scrollingpagerindicator:scrollingpagerindicator:1.0.6"
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test:runner:1.0.2'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
    implementation('com.crashlytics.sdk.android:crashlytics:2.10.1@aar') {
        transitive = true;
    }
}
apply plugin: 'com.google.gms.google-services' 

它顯示編譯錯誤

錯誤:無法訪問 zzbgl

找不到 com.google.android.gms.internal.zzbgl 的類文件

在我的活動中

@Override
    public void onLocationChanged(Location location) {

        this.location = location;

        this.googleMap.animateCamera( CameraUpdateFactory.newLatLngZoom( new LatLng( location.getLatitude(), location.getLongitude() ), 18 ) );

        this.googleMap.addMarker( new MarkerOptions().position( new LatLng( location.getLatitude(), location.getLongitude() ) ).title( "You are Hear" ) );

        Marker myMarker = googleMap.addMarker( new MarkerOptions().position( new LatLng( 0.0, 0.0 ) ) );
        myMarker.remove();

        latitude = location.getLatitude();
        longitude = location.getLongitude();

        Log.d( "latitude", String.valueOf( latitude ) );
        Log.d( "longitude", String.valueOf( longitude ) );
    }   

它在這一行顯示錯誤:

    this.googleMap.addMarker( new MarkerOptions().position( new LatLng( location.getLatitude(), location.getLongitude() ) ).title( "You are Hear" ) );

請幫我。

如何解決這個錯誤。

文檔

注意:請勿使用合並的播放服務目標。 它帶來了數十個庫,使您的應用程序膨脹。 而是僅指定您的應用使用的特定Google Play服務API。

因此,刪除以下依賴項:

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

並添加以下內容:

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

升級到以下為我修復了它: implementation 'com.google.android.gms:play-services-location:18.0.0'

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM