gpt4 book ai didi

android - 依赖于 Google Play Services 11.0.0 的应用未在 Android Studio 模拟器上运行

转载 作者:行者123 更新时间:2023-11-29 02:40:20 35 4
gpt4 key购买 nike

我在 Android 上使用播放服务来请求定期的用户位置。为此,我在 app/build.gradle

上添加了以下依赖项
compile "com.google.android.gms:play-services-location:11.0.0"

在物理设备中它工作得很好。但是,在模拟器上它不起作用,并提示更新播放服务。

enter image description here

我根据以下问题尝试了不同的解决方案

How to update Google Play Services for Android Studio 2.2 emulators?

How to update Google Play Services on the emulator in Android Studio

https://android.stackexchange.com/questions/176578/how-to-use-google-maps-android-api-by-google-play-services-11-on-an-emulator-wit (被标记为题外话,但这里描述的是同样的问题)

我尝试使用带有 Google API 的 x86_64 图像创建一个新的模拟器,但这并没有解决问题。

enter image description here

我还检查了 Android Studio 的更新(我的版本是 2.3.3),但它说 IDE 是最新的。

如何在模拟器上运行 Google Play 服务 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'
}

最佳答案

Google 发布了包含整个 Google Play 商店的模拟器图像。这些应该能够通过 Play 商店获取最新版本的 PlayServices。

编辑:Virtual Device Manager - Screenshot

关于android - 依赖于 Google Play Services 11.0.0 的应用未在 Android Studio 模拟器上运行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44680020/

35 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com