java.lang.NoSuchMethodError: No static method getFont(Landroid/content/Context;ILandroid/util/Typed

Android studio 更新到3.0以上,老是闪退,不能正常运行,报    java.lang.NoSuchMethodError: No static method getFont(Landroid/content/Context;ILandroid/util/TypedValue;ILandroid/widget/TextView;)Landroid/graphics/Typeface; in class Landroid/support/v4/content/res/ResourcesCompat; or its super classes (declaration of 'android.support.v4.content.res.ResourcesCompat' appears in /data/app/com.dafeng.dafengmall-1/base.apk),

java.lang.NoSuchMethodError: No static method getFont(Landroid/content/Context;ILandroid/util/Typed_第1张图片


找了好久,不知道哪里问题,最后在网上看到别人说是版本问题,将

compileSdkVersion 26
buildToolsVersion '27.0.3'(自己的最新版)

我的是

compileSdkVersion 26
buildToolsVersion "27.0.3"

com.android.support:appcompat-v7:(自己更新到的最新版)我的是

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'com.android.support:appcompat-v7:27.0.2'
    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'
   
}
问题就解决了


你可能感兴趣的:(Android开发经验)