59

Android Studio を 3.0 にアップデートした後、No static method getFont()エラーが発生しました。私が取り組んでいるプロジェクトは、https://github.com/ik024/GithubBrowserの github にあります。

// Top-level build file where you can add configuration options common 
to all sub-projects/modules.

buildscript {
repositories {
    jcenter()
    maven { url "https://oss.sonatype.org/content/repositories/snapshots" }
}
dependencies {
    classpath 'com.android.tools.build:gradle:3.0.0'
    classpath 'com.jakewharton:butterknife-gradle-plugin:9.0.0-SNAPSHOT'
}
}

allprojects {
repositories {
    jcenter()
    maven { url 'https://maven.google.com' }
    maven { url "https://oss.sonatype.org/content/repositories/snapshots" }
}

ext{
    arch_version = "1.0.0-alpha9"
    support_version = "26.0.2"
    dagger_version = "2.11"
    junit_version = "4.12"
    espresso_version = "2.2.2"
    retrofit_version = "2.3.0"
    mockwebserver_version = "3.8.0"
    apache_commons_version = "2.5"
    mockito_version = "1.10.19"
    constraint_layout_version = "1.0.2"
    timber_version = "4.5.1"
    butterknife_version = "9.0.0-SNAPSHOT"
    rxbinding_version = "2.0.0"
    retrofit_version = "2.3.0"
    okhttp_version = "3.6.0"
    rxjava2_adapter_version = "1.0.0"
}
}

task clean(type: Delete) {
delete rootProject.buildDir
}

アプリグラドル

apply plugin: 'com.android.application'
apply plugin: 'com.jakewharton.butterknife'

android {
compileSdkVersion 26
buildToolsVersion '26.0.2'
defaultConfig {
    applicationId "com.ik.githubbrowser"
    minSdkVersion 17
    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'
    }
}
packagingOptions {
    exclude 'META-INF/rxjava.properties'
}

testOptions {
    unitTests.returnDefaultValues = true
}

compileOptions {
    sourceCompatibility JavaVersion.VERSION_1_8
    targetCompatibility JavaVersion.VERSION_1_8
}

}

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])

compile "com.android.support.constraint:constraint-layout:$constraint_layout_version"

compile "com.android.support:appcompat-v7:$support_version"
compile "com.android.support:recyclerview-v7:$support_version"
compile "com.android.support:cardview-v7:$support_version"
compile "com.android.support:design:$support_version"
compile "com.android.support:support-v4:$support_version"

compile "android.arch.persistence.room:runtime:$arch_version"
compile "android.arch.lifecycle:runtime:$arch_version"
compile "android.arch.lifecycle:extensions:$arch_version"
compile "android.arch.persistence.room:rxjava2:$arch_version"

compile "com.squareup.retrofit2:retrofit:$retrofit_version"
compile "com.squareup.retrofit2:converter-gson:$retrofit_version"
compile "com.squareup.retrofit2:adapter-rxjava:$retrofit_version"
compile "com.jakewharton.retrofit:retrofit2-rxjava2-adapter:$rxjava2_adapter_version"

compile "com.squareup.okhttp3:okhttp:$okhttp_version"
compile "com.squareup.okhttp3:logging-interceptor:$okhttp_version"


compile "com.jakewharton.timber:timber:$timber_version"
compile "com.jakewharton:butterknife:$butterknife_version"
compile "com.jakewharton.rxbinding2:rxbinding:$rxbinding_version"

compile "com.google.dagger:dagger:$dagger_version"
compile "com.google.dagger:dagger-android:$dagger_version"
compile "com.google.dagger:dagger-android-support:$dagger_version"

testCompile "junit:junit:$junit_version"
testCompile "com.squareup.okhttp3:mockwebserver:$mockwebserver_version"
testCompile("android.arch.core:core-testing:$arch_version", {
    exclude group: 'com.android.support', module: 'support-compat'
    exclude group: 'com.android.support', module: 'support-annotations'
    exclude group: 'com.android.support', module: 'support-core-utils'
})

androidTestCompile "com.android.support:appcompat-v7:$support_version", {
    exclude group: 'com.android.support', module: 'support-annotations'
    exclude group: 'com.android.support', module: 'support-fragment'
    exclude group: 'com.android.support', module: 'support-core-ui'
}

androidTestCompile "com.android.support:recyclerview-v7:$support_version", {
    exclude group: 'com.android.support', module: 'support-annotations'
    exclude group: 'com.android.support', module: 'support-fragment'
    exclude group: 'com.android.support', module: 'support-core-ui'
}

androidTestCompile "com.android.support:support-v4:$support_version", {
    exclude group: 'com.android.support', module: 'support-annotations'
    exclude group: 'com.android.support', module: 'support-fragment'
    exclude group: 'com.android.support', module: 'support-core-ui'
}

androidTestCompile "com.android.support:design:$support_version", {
    exclude group: 'com.android.support', module: 'support-annotations'
    exclude group: 'com.android.support', module: 'support-fragment'
    exclude group: 'com.android.support', module: 'support-core-ui'
}

androidTestCompile("com.android.support.test.espresso:espresso-core:$espresso_version", {
    exclude group: 'com.android.support', module: 'support-annotations'
    exclude group: 'com.google.code.findbugs', module: 'jsr305'
})

androidTestCompile("com.android.support.test.espresso:espresso-contrib:$espresso_version", {
    exclude group: 'com.android.support', module: 'support-annotations'
    exclude group: 'com.google.code.findbugs', module: 'jsr305'
    exclude group: 'com.android.support', module: 'support-fragment'
    exclude group: 'com.android.support', module: 'support-core-ui'
})

androidTestCompile("android.arch.core:core-testing:$arch_version", {
    exclude group: 'com.android.support', module: 'support-annotations'
})

androidTestCompile 'org.mockito:mockito-android:2.7.15', {
    exclude group: 'com.android.support', module: 'support-annotations'
}

annotationProcessor "com.google.dagger:dagger-android-processor:$dagger_version"
annotationProcessor "com.google.dagger:dagger-compiler:$dagger_version"
annotationProcessor "android.arch.persistence.room:compiler:$arch_version"
annotationProcessor "android.arch.lifecycle:compiler:$arch_version"
annotationProcessor "com.jakewharton:butterknife-compiler:$butterknife_version"


compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.jakewharton.picasso:picasso2-okhttp3-downloader:1.0.2'

}

エラー:

致命的な例外: メイン プロセス: com.ik.githubbrowser、PID: 4248 java.lang.NoSuchMethodError: 静的メソッドがありません getFont(Landroid/content/Context;ILandroid/util/TypedValue;ILandroid/widget/TextView;)Landroid/graphics/Typeface ; クラス Landroid/support/v4/content/res/ResourcesCompat 内。またはそのスーパー クラス (「android.support.v4.content.res.ResourcesCompat」の宣言は、/data/app/com.ik.githubbrowser-YvwoGrxR8QaUEZ3IEqFVLQ==/split_lib_dependencies_apk.apk に表示されます) android.support.v7.widget にあります。 TintTypedArray.getFont(TintTypedArray.java:119) で android.support.v7.widget.AppCompatTextHelper.updateTypefaceAndStyle(AppCompatTextHelper.java:208) で android.support.v7.widget.AppCompatTextHelper.loadFromAttributes(AppCompatTextHelper.java:110) で android .support.v7.widget.AppCompatTextHelperV17.

4

16 に答える 16

4

appcompat と design と recyclerview をこれらの値に変更するだけで修正された同じ問題がありました。

implementation 'com.android.support:appcompat-v7:27.0.2'
implementation 'com.android.support:design:27.0.2'
implementation 'com.android.support:recyclerview-v7:27.0.2'

gradleを再度同期します

于 2018-02-27T07:12:12.097 に答える