gpt4 book ai didi

android - API级别14的Firebase云依赖关系

转载 作者:行者123 更新时间:2023-12-03 05:51:20 24 4
gpt4 key购买 nike

我们已经在API级别14上创建了一个Android应用程序。现在,我们决定为我们的应用程序实现推送通知。由于不再支持GCM,因此除了使用FCM之外,我们别无选择。根据Android文档,适用于FCM的Min SDK为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版本会导致很多代码更改和麻烦。

最佳答案

由于您正在使用:

compile 'com.google.android.gms:play-services:9.2.1'
compile 'com.google.firebase:firebase-messaging:9.2.1'

无法使用 compileSdkVersion 14,而您必须使用 compileSdkVersion 23
但是,您应该使用:
compileSdkVersion 27

和最新的稳定版本:
compile 'com.google.android.gms:play-services:11.6.2'
compile 'com.google.firebase:firebase-messaging:11.6.2'

最后:
buildscript {
// ...
dependencies {
// ...
classpath 'com.google.gms:google-services:3.1.1' // google-services plugin
}
}

allprojects {
// ...
repositories {
// ...
maven {
url "https://maven.google.com" // Google's Maven repository
}
}
}

关于android - API级别14的Firebase云依赖关系,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47588853/

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