Java 无法解析方法mGoogleApiClient

Java 无法解析方法mGoogleApiClient,java,android,Java,Android,为什么是错误mGoogleApiClient? 这是我的毕业典礼: compile 'com.android.support:appcompat-v7:26.+' compile 'com.google.android.gms:play-services-maps:11.0.4' compile 'com.google.android.gms:play-services-location:11.0.4' testCompile 'junit:junit:4.12' 这是我的源代码: @Over

为什么是错误mGoogleApiClient? 这是我的毕业典礼:

compile 'com.android.support:appcompat-v7:26.+'
compile 'com.google.android.gms:play-services-maps:11.0.4'
compile 'com.google.android.gms:play-services-location:11.0.4'
testCompile 'junit:junit:4.12'
这是我的源代码:

@Override
public void onConnected(@Nullable Bundle bundle) {
    LocationRequest mLocationRequest = new LocationRequest();
    mLocationRequest.setInterval(1000);
    mLocationRequest.setFastestInterval(1000);
    mLocationRequest.setPriority(LocationRequest.PRIORITY_BALANCED_POWER_ACCURACY);
    if (ContextCompat.checkSelfPermission(this,
            android.Manifest.permission.ACCESS_FINE_LOCATION)
            == PackageManager.PERMISSION_GRANTED) {
        LocationServices.FusedLocationApi.requestLocationUpdates(mGoogleApiClient, mLocationRequest, this);
    }
}

因为您还没有创建对象 mgoogleapclient正确检查文档并在使用之前创建文档

GoogleApiClient mGoogleApiClient = new GoogleApiClient.Builder(this)
         .addApi(LocationServices.API)
         .addConnectionCallbacks(this)
         .addOnConnectionFailedListener(this)
         .build()

文档:

显示您的整个gradle应用程序文件