LocationClient无法解析android studio中的符号?

时间:2015-12-03 10:32:55

标签: android

下面是我的build.gradle文件

apply plugin: 'com.android.application'

android {
    compileSdkVersion 23
    buildToolsVersion "23.0.2"

    defaultConfig {
        applicationId "com.domore.googlelocationdemo"
        minSdkVersion 14
        targetSdkVersion 23
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    testCompile 'junit:junit:4.12'
    compile 'com.android.support:appcompat-v7:23.1.1'
    //compile 'com.google.android.gms:play-services:8.3.0'
    compile 'com.google.android.gms:play-services:6.5.87'
}

这是我的MainActivity.java

package com.domore.googlelocationdemo;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;

import com.google.android.gms.common.ConnectionResult;
import com.google.android.gms.common.GooglePlayServicesClient;


public class MainActivity extends AppCompatActivity implements GooglePlayServicesClient.ConnectionCallbacks,
GooglePlayServicesClient.OnConnectionFailedListener{

    LocationClien
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
    }

    @Override
    public void onConnected(Bundle bundle) {

    }

    @Override
    public void onDisconnected() {

    }

    @Override
    public void onConnectionFailed(ConnectionResult connectionResult) {

    }
}

我需要做什么? 请任何人帮我解决这个错误?

我使用了一个LocationRequest类但是我需要设置哪个参数来设置LocationRequeset类的构造函数?

1 个答案:

答案 0 :(得分:1)

由于编译的sdk版本因为LocationClient在API23中已弃用,因此您可以使用新库

com.google.android.gms.common.api.GoogleApiClient and 
com.google.android.gms.location.LocationRequest.