无法解析getGeofencingClient

时间:2018-04-04 15:40:12

标签: android location-services

我正在尝试创建LocationServices的对象,并且我已经在类似的应用上导入了com.google.android.gms.location.GeofencingClient .. LocationServices类看起来与我的类不同。以下课程是我的:

package com.google.android.gms.location;

import android.content.Context;
import android.os.Looper;
import com.google.android.gms.common.api.Api;
import com.google.android.gms.common.api.GoogleApiClient;
import com.google.android.gms.common.api.Result;
import com.google.android.gms.common.api.Scope;
import com.google.android.gms.common.api.Api.b;
import com.google.android.gms.common.api.Api.c;
import com.google.android.gms.common.api.Api.ApiOptions.NoOptions;
import com.google.android.gms.common.api.GoogleApiClient.ConnectionCallbacks;
import com.google.android.gms.common.api.GoogleApiClient.OnConnectionFailedListener;
import com.google.android.gms.internal.jg;
import com.google.android.gms.internal.jx;
import com.google.android.gms.internal.nf;
import com.google.android.gms.internal.ng;
import com.google.android.gms.internal.nk;

public class LocationServices {
    private static final c<nk> DQ = new c();
    private static final b<nk, NoOptions> DR = new b<nk, NoOptions>() {
        public nk e(Context var1, Looper var2, jg var3, NoOptions var4, ConnectionCallbacks var5, OnConnectionFailedListener var6) {
            return new nk(var1, var2, var1.getPackageName(), var5, var6, "locationServices", var3.getAccountName());
        }

        public int getPriority() {
            return 2147483647;
        }
    };
    public static final Api<NoOptions> API;
    public static FusedLocationProviderApi FusedLocationApi;
    public static GeofencingApi GeofencingApi;

    private LocationServices() {
    }

    public static nk f(GoogleApiClient var0) {
        jx.b(var0 != null, "GoogleApiClient parameter is required.");
        nk var1 = (nk)var0.a(DQ);
        jx.a(var1 != null, "GoogleApiClient is not configured to use the LocationServices.API Api. Pass thisinto GoogleApiClient.Builder#addApi() to use this feature.");
        return var1;
    }

    static {
        API = new Api(DR, DQ, new Scope[0]);
        FusedLocationApi = new nf();
        GeofencingApi = new ng();
    }

    public abstract static class a<R extends Result> extends com.google.android.gms.common.api.BaseImplementation.a<R, nk> {
        public a(GoogleApiClient var1) {
            super(LocationServices.DQ, var1);
        }
    }
}

但另一个应用:

package com.google.android.gms.location;

import android.app.Activity;
import android.content.Context;
import android.support.annotation.NonNull;
import com.google.android.gms.common.api.Api;
import com.google.android.gms.common.api.GoogleApiClient;
import com.google.android.gms.common.api.Result;
import com.google.android.gms.common.api.Api.zzf;
import com.google.android.gms.common.api.Api.ApiOptions.NoOptions;
import com.google.android.gms.common.internal.zzbr;
import com.google.android.gms.internal.zzbck;
import com.google.android.gms.internal.zzcdn;
import com.google.android.gms.internal.zzcec;
import com.google.android.gms.internal.zzcev;
import com.google.android.gms.internal.zzcfg;

public class LocationServices {
    private static final zzf<zzcev> zzajT = new zzf();
    private static final com.google.android.gms.common.api.Api.zza<zzcev, NoOptions> zzajU = new zzs();
    public static final Api<NoOptions> API;
    public static final FusedLocationProviderApi FusedLocationApi;
    public static final GeofencingApi GeofencingApi;
    public static final SettingsApi SettingsApi;

    private LocationServices() {
    }

    public static zzcev zzg(GoogleApiClient var0) {
        zzbr.zzb(var0 != null, "GoogleApiClient parameter is required.");
        zzcev var1;
        zzbr.zza((var1 = (zzcev)var0.zza(zzajT)) != null, "GoogleApiClient is not configured to use the LocationServices.API Api. Pass thisinto GoogleApiClient.Builder#addApi() to use this feature.");
        return var1;
    }

    public static GeofencingClient getGeofencingClient(@NonNull Activity var0) {
        return new GeofencingClient(var0);
    }

    public static GeofencingClient getGeofencingClient(@NonNull Context var0) {
        return new GeofencingClient(var0);
    }

    public static SettingsClient getSettingsClient(@NonNull Activity var0) {
        return new SettingsClient(var0);
    }

    public static SettingsClient getSettingsClient(@NonNull Context var0) {
        return new SettingsClient(var0);
    }

    public static FusedLocationProviderClient getFusedLocationProviderClient(@NonNull Activity var0) {
        return new FusedLocationProviderClient(var0);
    }

    public static FusedLocationProviderClient getFusedLocationProviderClient(@NonNull Context var0) {
        return new FusedLocationProviderClient(var0);
    }

    static {
        API = new Api("LocationServices.API", zzajU, zzajT);
        FusedLocationApi = new zzcdn();
        GeofencingApi = new zzcec();
        SettingsApi = new zzcfg();
    }

    public abstract static class zza<R extends Result> extends zzbck<R, zzcev> {
        public zza(GoogleApiClient var1) {
            super(LocationServices.API, var1);
        }
    }
}

更新

这是我的gradle.build

apply plugin: 'com.android.application'

android {
    compileSdkVersion 26
    defaultConfig {
        applicationId "com.hwc.gl.gl"
        minSdkVersion 21
        targetSdkVersion 26
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    useLibrary 'org.apache.http.legacy'
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'com.android.support:appcompat-v7:26.1.0'
    implementation 'com.android.support.constraint:constraint-layout:1.0.2'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test:runner:0.5'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:2.2.2'

    compile 'com.android.support:support-v4:26.1.0'
    compile 'com.android.support:appcompat-v7:26.1.0'
    //noinspection GradleCompatible
    compile 'com.google.android.gms:play-services:6.5.87'

    compile 'com.android.support:design:26.1.0'
    compile 'com.google.android.gms:play-services-location:11.0.0'
    compile 'com.google.android.gms:play-services-maps:11.0.0'
}

我不知道我做错了什么?!!

0 个答案:

没有答案