【问题标题】:FirebaseUI doesn't find font Attributes for resource filesFirebaseUI 找不到资源文件的字体属性
【发布时间】:2019-01-22 14:56:37
【问题描述】:

我正在使用 FirebaseUI 数据库使用 FirebaseListAdapter 从 ListView(在 ListFragment 上)中的 Firebase 数据库参考中检索对象列表。 我在 build.gradle 中添加了 firebase-ui-database 的依赖项:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 25
    buildToolsVersion '27.0.3'
    defaultConfig {
        applicationId "vkalashnykov.org.busapplication"
        minSdkVersion 16
        targetSdkVersion 25
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
        multiDexEnabled true
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    implementation 'com.android.support:support-v4:25.4.0'
    implementation 'com.android.support:recyclerview-v7:25.4.0'
    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:25.4.0'
    compile 'com.android.support.constraint:constraint-layout:1.0.2'
    compile 'com.android.support:design:25.4.0'
    compile 'com.google.firebase:firebase-auth:11.6.2'
    testCompile 'junit:junit:4.12'
    compile 'com.google.android.gms:play-services-maps:11.6.2'
    compile 'com.google.android.gms:play-services-places:11.6.2'
    compile 'com.google.android.gms:play-services:11.6.2'
    compile 'com.google.android.gms:play-services-location:11.6.2'
    implementation 'com.firebaseui:firebase-ui-database:4.1.0'
}

apply plugin: 'com.google.gms.google-services'

之后,我需要将 minSdkVersion(我使用 15)更改为 16,因为 FirebaseUI 需要它。之后,我在构建 Gradle 时开始收到错误:

../../.gradle/caches/transforms-1/files-1.1/appcompat-v7-25.4.0.aa/3b2c926192deabbc1b0a0696bfdc1100/res/values/values.xml 错误:找不到资源 android:attr/fontStyle。
错误:找不到资源 android:attr/font。
错误:找不到资源 android:attr/fontWeight。

这是怎么回事,我该怎么办? 在此先感谢维克托

【问题讨论】:

    标签: android firebase gradle firebaseui


    【解决方案1】:

    在oreo版本中增加了字体支持,支持库中也可以使用,只需使用大于或等于26版本的支持库即可。还要检查这个答案https://stackoverflow.com/a/45208134/6193843

    【讨论】:

      【解决方案2】:

      要解决这个问题,请更改以下代码行:

      compile 'com.google.firebase:firebase-auth:11.6.2'
      

      到

      implementation 'com.google.firebase:firebase-auth:16.0.3'
      

      并添加以下代码行:

      implementation 'com.google.firebase:firebase-core:16.0.1'
      

      现在是强制性的。来自官方文档:

      您的应用 gradle 文件现在必须明确列出 com.google.firebase:firebase-core 作为 Firebase 服务按预期工作的依赖项。

      关于 Google Play 服务,请更改以下代码行:

      compile 'com.google.android.gms:play-services-maps:11.6.2'
      compile 'com.google.android.gms:play-services-places:11.6.2'
      compile 'com.google.android.gms:play-services-location:11.6.2'
      

      到

      compile 'com.google.android.gms:play-services-maps:15.0.1'
      compile 'com.google.android.gms:play-services-places:15.0.1'
      compile 'com.google.android.gms:play-services-location:15.0.1'
      

      根据this,请删除这行代码:

          compile 'com.google.android.gms:play-services:11.6.2'
      

      不要忘记在您的顶级 build.gradle 文件中添加以下 Google 服务插件:

      classpath 'com.google.gms:google-services:4.0.2'
      

      【讨论】:

      • 你好维克托!你有没有试过我上面的解决方案,它有效吗?
      猜你喜欢
      • 1970-01-01
      • 2018-12-07
      • 1970-01-01
      • 1970-01-01
      • 2014-04-22
      • 2013-11-28
      • 2012-01-12
      • 2021-04-23
      • 2016-05-25
      相关资源
      最近更新 更多