Android Studio 3.0无法导入google play服务,即使它已添加到build.gradle文件中
我正在尝试获取设备当前位置,但当我尝试导入位置服务时,它将被删除。但它不能解析符号定位服务Android Studio 3.0无法导入google play服务,即使它已添加到build.gradle文件中,android,google-maps,google-play-services,android-studio-3.0,Android,Google Maps,Google Play Services,Android Studio 3.0,我正在尝试获取设备当前位置,但当我尝试导入位置服务时,它将被删除。但它不能解析符号定位服务 import com.google.android.gms.location.LocationListener; import com.google.android.gms.location.LocationRequest; import com.google.android.gms.location.LocationServices; Build.gradle文件 dependencies {
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)以及编译play services位置
dependencies {
compile 'com.google.android.gms:play-services-location:11.+'
}
导入以下依赖项可能会对您有所帮助
compile 'com.google.android.gms:play-services-maps:10.0.1'
compile 'com.google.android.gms:play-services-location:10.0.1'
compile 'com.google.android.gms:play-services-places:10.0.1'
请检查一下。(确保使用最新的依赖项)。
下面的链接可能会帮助你做同样的事情。
我还必须添加播放位置服务依赖项
implementation 'com.google.android.gms:play-services-maps:11.+'
compile 'com.google.android.gms:play-services-location:11.+'