即使在 build.gradle 文件中添加了 Android Studio 3.0 也无法导入 Google Play 服务

标签 android google-maps google-play-services android-studio-3.0

我正在尝试获取设备当前位置,但是当我尝试导入定位服务时。但它显示无法解析符号 LocationService

import com.google.android.gms.location.LocationListener;
import com.google.android.gms.location.LocationRequest;
import com.google.android.gms.location.LocationServices;

importing location service

Build.gradle文件

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'com.android.support:appcompat-v7:26.0.0-beta1'
    implementation 'com.android.support:design:26.0.0-beta1'
    implementation 'com.google.android.gms:play-services-maps:11.6.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:3.0.1'
}

我也尝试过使用 google play services 以前的版本 (11.4.2)

最佳答案

编译播放服务位置。

dependencies {
    compile 'com.google.android.gms:play-services-location:11.+'
}

关于即使在 build.gradle 文件中添加了 Android Studio 3.0 也无法导入 Google Play 服务,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47618436/

相关文章:

android - 如何在 Android 旁边安装 Linux?

javascript - 将事件监听器添加到React Native ART组件

javascript - 谷歌地图边界不工作

javascript - 如何在 "Marker1"、 "Marker2"等循环中创建 Google map 标记

google-maps - Google maps api v3 显示静态图像而不是交互式 map

android - 程序类型已经存在 : com. google.android.gms.common.util.VisibleForTesting -':app:transformDexArchiveWithExternalLibsDexMergerForDebug'

Android:通话期间网络速度慢

android - 在android中使用按钮加载动画

android - GoogleApiClient 连接失败,状态码为 SIGN_IN_REQUIRED

android - 如何在 Google Play 应用中推广应用