【发布时间】:2017-12-01 07:50:38
【问题描述】:
我们已经在 API 级别 14 上创建了一个 Android 应用程序。现在我们决定为我们的应用程序实现推送通知。由于不再支持 GCM,我们除了使用 FCM 之外别无选择。根据 android 文档 Min SDK for FCM 是 14,这就是我们拥有的。但是我们不知道什么是正确的类路径并为 FCM 编译依赖项。目前我们使用以下:
**App Level Gradle**
apply plugin: 'com.android.application'
android {
compileSdkVersion 14
buildToolsVersion "27.0.1"
defaultConfig {
applicationId "com.infotropy.fcm"
minSdkVersion 14
targetSdkVersion 26
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'
})
testCompile 'junit:junit:4.12'
compile 'com.google.android.gms:play-services:9.2.1'
compile 'com.google.firebase:firebase-messaging:9.2.1'
}
apply plugin: 'com.google.gms.google-services'
**Project Level Gradle**
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.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
}
在构建时,我们收到以下构建错误:
Error:Gradle: Execution failed for task ':app:processDebugResources'.
> com.android.ide.common.process.ProcessException: Failed to execute aapt
E:\Projects\Android\Fcm\app\build\intermediates\res\merged\debug\values-v21\values-v21.xml
Error:(12, -1) Gradle: Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Inverse'.
Error:(14, -1) Gradle: Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Large.Inverse'.
还有更多这样的错误......
我们能否通过更改依赖项来解决这些问题,如果可以,请提及正确的依赖项。
请注意,我们的首选是我们不想更改项目的 SDK 版本,因为它是一个非常大的项目,更改 SDK 版本会导致大量代码更改和麻烦。
【问题讨论】:
标签: android firebase gradle android-gradle-plugin firebase-cloud-messaging