这是我的gradle.app
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion "25.0.0"
packagingOptions {
exclude 'META-INF/LICENSE'
exclude 'META-INF/NOTICE'
exclude 'META-INF/NOTICE.txt'
}
defaultConfig {
applicationId "com.example.joshpc.bluetoothattendee"
minSdkVersion 19
targetSdkVersion 25
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:25.0.0'
compile 'com.google.android.gms:play-services-gcm:9.8.0'
compile 'com.google.gms:google-services:3.0.0'
compile 'com.google.firebase:firebase-auth:9.8.0'
compile 'com.google.firebase:firebase-core:9.8.0'
compile 'com.firebase:firebase-client-android:2.5.2'
testCompile 'junit:junit:4.12'
}
apply plugin: 'com.google.gms.google-services'
当我尝试运行我的Android模拟器时,它正在给我这个读出来:
W/GooglePlayServicesUtil: Google Play services out of date. Requires 9877000 but found 9875480
我已经尝试将firebase和google play服务恢复到9.6.0,这不起作用,因为firebase需要9.8.0
我已经在独立的SDK管理器中更新了我的API 25 android系统映像。
我的Google Play存储库是最新的。
如果我改变我的gradle来调用播放服务9.8.7它会给我错误:
如果我将GPS降级到9.6.0,我明白了:
W/DynamiteModule: Local module descriptor class for com.google.firebase.auth not found.
所以我不太确定如何解决此问题或更新播放服务时SDK说它是最新的,我无法恢复所需的版本。 请注意,“安装存储库和同步”无法点击/不链接到任何内容。我检查了存储库版本及其最新版本
我在我的模拟器中检查了版本,它运行的是9.8.75
答案 0 :(得分:0)
如果您想在已配置了包含Google API 9875480版的系统映像的模拟器上运行,您唯一的选择是降级Google Play服务和Firebase API的版本:
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:25.0.0'
compile 'com.google.android.gms:play-services-gcm:9.6.1'
//compile 'com.google.gms:google-services:3.0.0'
compile 'com.google.firebase:firebase-auth:9.6.1'
compile 'com.google.firebase:firebase-core:9.6.1'
//compile 'com.firebase:firebase-client-android:2.5.2'
testCompile 'junit:junit:4.12'
}
虽然你说你这样做但仍然得到同样的警告,但我对此表示怀疑。我可以使用这些依赖项进行构建,并使用版本9875480的Google API在模拟器上运行。
如果您想使用9.8.0版本构建,我认为您需要在真实设备上运行。我不认为任何支持9.8.0的模拟器图像,至少不支持API 25。
答案 1 :(得分:-1)
只需更改此行:compile 'com.google.android.gms:play-services-gcm:9.8.0'
到:
compile 'com.google.android.gms:play-services-gcm:9.6.0'
并且每件事都应该运作良好
并为firebase尝试:
compile 'com.google.firebase:firebase-auth:9.6.1'
compile 'com.google.firebase:firebase-core:9.6.1'