依赖于Google Play Services 11.0.0的应用程序未在Android Studio模拟器上运行
我使用Android上的play服务请求定期用户位置。为此,我在我的依赖于Google Play Services 11.0.0的应用程序未在Android Studio模拟器上运行,android,android-studio,android-emulator,google-play-services,Android,Android Studio,Android Emulator,Google Play Services,我使用Android上的play服务请求定期用户位置。为此,我在我的app/build.gradle compile "com.google.android.gms:play-services-location:11.0.0" 在物理设备中,它工作得相当好。但是,在模拟器上,它不起作用,并提示更新播放服务 根据以下问题,我尝试了不同的解决方案 (它被标记为脱离主题,但这里描述了相同的问题) 我尝试用Google API创建一个带有x86_64映像的新模拟器,但这并不能解决问题 我还检查
app/build.gradle
compile "com.google.android.gms:play-services-location:11.0.0"
在物理设备中,它工作得相当好。但是,在模拟器上,它不起作用,并提示更新播放服务
根据以下问题,我尝试了不同的解决方案
(它被标记为脱离主题,但这里描述了相同的问题)
我尝试用Google API创建一个带有x86_64映像的新模拟器,但这并不能解决问题
我还检查了Android Studio的更新(我有2.3.3版),但它说IDE是最新的
如何在模拟器上运行Google Play Services V11.0.0及以上版本?对此问题的任何帮助都将不胜感激
编辑:
这是我的app/build.gradle
文件
buildscript {
repositories {
jcenter()
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.3'
// These docs use an open ended version so that our plugin
// can be updated quickly in response to Android tooling updates
// We recommend changing it to the latest version from our changelog:
// https://docs.fabric.io/android/changelog.html#fabric-gradle-plugin
classpath 'io.fabric.tools:gradle:1.22.0'
classpath 'me.tatarka:gradle-retrolambda:3.6.1'
}
}
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
apply plugin: 'me.tatarka.retrolambda'
repositories {
mavenCentral()
maven { url 'https://maven.fabric.io/public' }
}
android {
compileSdkVersion 25
buildToolsVersion "25.0.2"
defaultConfig {
applicationId "xxxxxxxxxxxxxxxx"
minSdkVersion 19
targetSdkVersion 25
versionCode 1
versionName "1.0.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
multiDexEnabled true
manifestPlaceholders = [fabric_io_id: "$System.env.FABRIC_KEY"]
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
dataBinding {
enabled = true
}
signingConfigs {
release {
try {
storeFile new File(STORE_FILE)
storePassword STORE_PASSWORD
keyAlias KEY_ALIAS
keyPassword KEY_PASSWORD
} catch (ex) {
throw new InvalidUserDataException("Signing configuration not found")
}
}
}
buildTypes {
release {
shrinkResources true
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
signingConfig signingConfigs.release
}
}
productFlavors {
development {
versionNameSuffix "-dev"
manifestPlaceholders = [
appName: "xxxx"
]
}
production {
manifestPlaceholders = [
appName: "xxxxxxxxxxxxx"
]
}
}
variantFilter { variant ->
def names = variant.flavors*.name
if ((names.contains("alpha") || names.contains("qatesting") || names.contains("sandbox") || names.contains("production"))
&& variant.buildType.name == "debug") {
variant.ignore = true
}
if (names.contains("development") && variant.buildType.name == "release") {
variant.ignore = true
}
}
applicationVariants.all { variant ->
variant.outputs.each { output ->
output.outputFile = new File(
output.outputFile.parent,
output.outputFile.name.replace(".apk", "-${variant.versionName}.apk"))
}
}
packagingOptions {
exclude 'META-INF/LICENSE'
exclude 'META-INF/LICENSE-FIREBASE.txt'
exclude 'META-INF/NOTICE'
exclude 'META-INF/rxjava.properties'
}
}
ext {
supportLibraryVersion = '25.3.1'
butterKnifeVersion = '8.5.1'
leakCanaryVersion = '1.5.1'
daggerVersion = '2.10'
rxAndroidVersion = '2.0.1'
rxJavaVersion = '2.1.0'
timberVersion = '4.5.1'
jUnitVersion = '4.12'
mockitoVersion = '1.10.19'
testRunnerVersion = '0.5'
powerMockVersion = '1.6.2'
crashlyticsVersion = '2.6.8'
guavaVersion = '19.0'
googlePlayServicesVersion = '11.0.1'
contraintLayoutVersion = '1.0.2'
awsCognitoVersion = '2.4.3'
espressoVersion = '2.2.2'
retrofitVersion = '2.3.0'
jacksonConverterVersion = '2.1.0'
okHttpLoggingInterceptorVersion = '3.2.0'
firebaseJobDispatcherVersion = '0.6.0'
apacheCommonsVersion = '3.6'
multiDexVersion = '1.0.1'
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile "com.android.support:appcompat-v7:$supportLibraryVersion"
compile "com.android.support:design:$supportLibraryVersion"
compile "com.android.support:support-v4:$supportLibraryVersion"
/* Multidex */
compile "com.android.support:multidex:$multiDexVersion"
/* Views injection - Butterknife */
compile "com.jakewharton:butterknife:$butterKnifeVersion"
annotationProcessor "com.jakewharton:butterknife-compiler:$butterKnifeVersion"
/* Memory leaks detection - LeakCanary */
debugCompile "com.squareup.leakcanary:leakcanary-android:$leakCanaryVersion"
releaseCompile "com.squareup.leakcanary:leakcanary-android-no-op:$leakCanaryVersion"
testCompile "com.squareup.leakcanary:leakcanary-android-no-op:$leakCanaryVersion"
/* Dependency Injection - Dagger*/
compile "com.google.dagger:dagger:$daggerVersion"
annotationProcessor "com.google.dagger:dagger-compiler:$daggerVersion"
/* Rx Android - Rx Java */
compile "io.reactivex.rxjava2:rxandroid:$rxAndroidVersion"
compile "io.reactivex.rxjava2:rxjava:$rxJavaVersion"
/* Application Logger - Timber*/
compile "com.jakewharton.timber:timber:$timberVersion"
/* Crashlytics - crash reporting */
compile("com.crashlytics.sdk.android:crashlytics:$crashlyticsVersion@aar") {
transitive = true;
}
/* Google analytics */
compile "com.android.support.constraint:constraint-layout:$contraintLayoutVersion"
compile "com.google.android.gms:play-services-analytics:$googlePlayServicesVersion"
compile "com.google.guava:guava:$guavaVersion"
compile "com.android.support:support-v4:$supportLibraryVersion"
/* Google play location services */
compile "com.google.android.gms:play-services-location:$googlePlayServicesVersion"
/* Amazon cognito */
compile "com.amazonaws:aws-android-sdk-cognitoidentityprovider:$awsCognitoVersion"
/* Retrofit - API rest access*/
compile "com.squareup.retrofit2:retrofit:$retrofitVersion"
/* Retrofit JSON converter with Jackson */
compile "com.squareup.retrofit2:converter-jackson:$jacksonConverterVersion"
/* Firebase job dispatcher */
compile "com.firebase:firebase-jobdispatcher:$firebaseJobDispatcherVersion"
/* Mapbox */
compile('com.mapbox.mapboxsdk:mapbox-android-sdk:5.0.2@aar') {
transitive = true
}
compile "com.google.android.gms:play-services-places:$googlePlayServicesVersion"
/* Apache commons */
compile "org.apache.commons:commons-lang3:$apacheCommonsVersion"
/* Android testing */
testCompile "junit:junit:$jUnitVersion"
testCompile "org.mockito:mockito-core:$mockitoVersion"
androidTestCompile("com.android.support.test.espresso:espresso-core:$espressoVersion", {
exclude group: 'com.android.support', module: 'support-annotations'
})
androidTestCompile "com.android.support.test:runner:$testRunnerVersion"
androidTestCompile "com.android.support:support-annotations:$supportLibraryVersion"
testCompile "org.powermock:powermock-api-mockito:$powerMockVersion"
testCompile "org.powermock:powermock-module-junit4-rule-agent:$powerMockVersion"
testCompile "org.powermock:powermock-module-junit4-rule:$powerMockVersion"
testCompile "org.powermock:powermock-module-junit4:$powerMockVersion"
compile 'com.jakewharton.retrofit:retrofit2-rxjava2-adapter:1.0.0'
compile 'com.fasterxml.jackson.core:jackson-core:2.8.8'
compile 'com.fasterxml.jackson.core:jackson-annotations:2.8.8'
compile 'com.fasterxml.jackson.core:jackson-databind:2.8.8'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.android.support:support-v4:25.3.1'
}
谷歌发布了以整个谷歌游戏商店为特色的仿真图像。他们应该能够通过Play Store获得最新版本的PlayServices
编辑:我该怎么做?当我单击“更新”时,什么都没有发生,我可以在日志中看到没有处理请求的意图。到底是什么失败了?是否可以安装并运行已启用Play Store的映像?游戏商店在营业吗?你能从Play Store加载任何应用程序吗?我正在使用照片中显示的Nexus 5和Nexus 5X,但这不起作用。我刚刚意识到有支持Play Store的模拟器映像,但只支持Android N和O。我创建了两个带有N映像的虚拟设备,但在运行应用程序时,设备会无限期地离线,最后不会运行。使用不同映像创建的模拟器上没有安装Play Store。无论如何,我想在4.4版开始的设备上测试我的应用程序。你可以试试Genymotion。您是否尝试过实际更新google play服务?请显示您的完整等级。@Vlad我不知道如何在Android Studio 2.3.3中做到这一点。在以前的版本中,我从SDK管理器更新了模拟器映像,但现在此选项不可用。@Ibrahim我更新了答案