Android Studio 3.0 无法导入 google 播放服务,即使它已添加到 build.gradle 文件中
Android Studio 3.0 not able to import google play service even it is added in build.gradle file
我正在尝试获取设备当前位置,但是当我尝试导入定位服务时。但它显示无法解析符号 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 播放服务以前的版本 (11.4.2)
编译播放服务位置。
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'
请检查一次。 (确保您使用最新的依赖项)。
link 以下可能会帮助您做同样的事情。
http://gradleplease.appspot.com/
我还必须添加播放位置服务依赖项。
implementation 'com.google.android.gms:play-services-maps:11.+'
compile 'com.google.android.gms:play-services-location:11.+'
我正在尝试获取设备当前位置,但是当我尝试导入定位服务时。但它显示无法解析符号 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 播放服务以前的版本 (11.4.2)
编译播放服务位置。
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'
请检查一次。 (确保您使用最新的依赖项)。 link 以下可能会帮助您做同样的事情。 http://gradleplease.appspot.com/
我还必须添加播放位置服务依赖项。
implementation 'com.google.android.gms:play-services-maps:11.+'
compile 'com.google.android.gms:play-services-location:11.+'