【发布时间】:2016-10-05 17:45:15
【问题描述】:
我正在设置一个 Android 服务器项目,用于使用 Firebase 网站上的 this documentation 推送通知。起初,我在 Firebase 控制台设置了项目,并添加了 JSON 文件和 Google 服务插件。
但是在添加后同步项目时
compile 'com.google.firebase:firebase-server-sdk:3.0.1',出现错误:
Version: 3.0.1 is lower than the minimum version (9.0.0) required for google-services plugin.
我的应用 build.gradle 是-
apply plugin: 'com.android.application'
android {
compileSdkVersion 24
buildToolsVersion "24.0.2"
defaultConfig {
applicationId "ton.com.serverandroid"
minSdkVersion 15
targetSdkVersion 24
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(dir: 'libs', include: ['*.jar'])
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:24.2.1'
compile 'com.google.firebase:firebase-server-sdk:3.0.1'
testCompile 'junit:junit:4.12'
}
apply plugin: 'com.google.gms.google-services'
我的项目 build.gradle 是
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.0'
classpath 'com.google.gms:google-services:3.0.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
我曾尝试使用 google-services 版本 2.1.0,但它也无法正常工作并出现错误:
Conflict with dependency 'com.google.code.findbugs:jsr305'. Resolved versions for app (1.3.9) and test app (2.0.1) differ.
但在那种情况下我不能走得更远。
【问题讨论】:
-
发送下游消息需要使用应用服务器。您应该不在您的 Android 应用中包含服务器 SDK。见stackoverflow.com/questions/37435750/…
标签: android firebase firebase-cloud-messaging