我正在尝试获取设备当前位置,但是当我尝试导入定位服务时。但它显示无法解析符号 LocationService
import com.google.android.gms.location.LocationListener;
import com.google.android.gms.location.LocationRequest;
import com.google.android.gms.location.LocationServices;
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/