Java LocationListener、LocationRequest、LocationServices在Android Studio中实现Google Maps API查找附近位置时导入无效

Java LocationListener、LocationRequest、LocationServices在Android Studio中实现Google Maps API查找附近位置时导入无效,java,android,google-maps,android-gradle-plugin,Java,Android,Google Maps,Android Gradle Plugin,上述3种进口产品被视为无效。我安装了Google Play服务、Google Support Repository、Google Repository,基本上我需要的所有SDK工具都已安装,但我不明白为什么上面的3个导入会起作用。您需要编译必要的Google Play服务组件和项目的依赖项 确保在应用程序级build.gradle文件中有以下编译语句: import com.google.android.gms.location.LocationListener; import com.goog

上述3种进口产品被视为无效。我安装了Google Play服务、Google Support Repository、Google Repository,基本上我需要的所有SDK工具都已安装,但我不明白为什么上面的3个导入会起作用。

您需要编译必要的Google Play服务组件和项目的依赖项

确保在应用程序级
build.gradle
文件中有以下编译语句:

import com.google.android.gms.location.LocationListener;
import com.google.android.gms.location.LocationRequest;
import com.google.android.gms.location.LocationServices;
dependencies {
    compile 'com.google.android.gms:play-services-maps:11.4.2'
    compile 'com.google.android.gms:play-services-location:11.4.2'
    compile 'com.google.android.gms:play-services-places:11.4.2'
    //.......
}