当前位置: 首页 > 知识库问答 >
问题:

我在更新最新的Firebase时遇到了这个错误(java.lang.NoSuchMethodError:No static method getFont

叶德运
2023-03-14
buildscript {

    repositories {
        apply plugin: 'announce'
        google()
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.0.1'
        classpath 'com.google.gms:google-services:3.1.1'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories
    {
        google()
        jcenter()
        maven{ url "https://jitpack.io"}
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}
apply plugin: 'com.android.application'

android {
    compileSdkVersion 26
    defaultConfig {
        applicationId "chocolahat.softeng.sweetbitescafe"
        minSdkVersion 21
        targetSdkVersion 26
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'com.android.support:appcompat-v7:26.+'
    implementation 'com.android.support.constraint:constraint-layout:1.0.2'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test:runner:1.0.1'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'

    // My Library
    implementation 'com.google.firebase:firebase-core:11.6.2'

    implementation 'com.google.firebase:firebase-database:11.6.2'

    implementation 'com.android.support:cardview-v7:26.+'

    implementation 'com.android.support:recyclerview-v7:26.+'

    implementation 'com.squareup.picasso:picasso:2.5.2'

    implementation 'com.firebaseui:firebase-ui-database:3.1.2'

    implementation 'com.cepheuen.elegant-number-button:lib:1.0.2'

    implementation 'com.android.support:design:26.+'

    implementation 'com.amulyakhare:com.amulyakhare.textdrawable:1.0.1'

    implementation 'com.readystatesoftware.sqliteasset:sqliteassethelper:+'

    implementation 'com.google.android.gms:play-services-location:11.6.2'

    implementation 'com.github.mancj:MaterialSearchBar:0.7.1'

    implementation 'com.github.d-max:spots-dialog:0.7@aar'

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

mainactivity.java:18行代码是setContentView(r.layout.activity_main);

我该怎么解决这个?

共有1个答案

梁华皓
2023-03-14

API level 26提供了默认的font属性。而相同的字体属性可能已在代码中定义为自定义字体属性的一部分。

解决方法:更改您的自定义字体属性名称。

font改为custom_font并在XML文件中作为custom_font:使用

 类似资料: