Butterknife: resource android:attr/fontVariationSettings and error: resource android:attr/ttcIndex not found

Created on 24 Sep 2018  路  3Comments  路  Source: JakeWharton/butterknife

ButterKnife 9.0.0-SNAPSHOT caused the below failures (happens only beginning this week)

2018-09-24T04:42:32Z] FAILURE: Build failed with an exception.
[2018-09-24T04:42:32Z]
[2018-09-24T04:42:32Z] * What went wrong:
[2018-09-24T04:42:32Z] Execution failed for task ':base-feature:processProductionReleaseFeatureResources'.
[2018-09-24T04:42:32Z] > Android resource linking failed
[2018-09-24T04:42:32Z]   Output:  /project/base-feature/build/intermediates/incremental/mergeProductionReleaseFeatureResources/merged.dir/values/values.xml:630: error: resource android:attr/fontVariationSettings not found.
[2018-09-24T04:42:32Z]   /project/base-feature/build/intermediates/incremental/mergeProductionReleaseFeatureResources/merged.dir/values/values.xml:631: error: resource android:attr/ttcIndex not found.
[2018-09-24T04:42:32Z]   error: failed linking references.

Most helpful comment

You have to compile against API 28.

All 3 comments

You have to compile against API 28.

Use the following dependencies if you want to stick to API 27 -

implementation 'com.jakewharton:butterknife:9.0.0-20180911.194822-66'
implementation 'com.jakewharton:butterknife-annotations:9.0.0-20180911.194826-66'
implementation 'com.jakewharton:butterknife-runtime:9.0.0-20180911.194841-24'
annotationProcessor 'com.jakewharton:butterknife-compiler:9.0.0-20180911.194829-66'

agamb 's answer is not working at my end. 馃槥
I tried a couple of options and API version and library combinations but not work, appear different error.
(I will create another issues for these test result.)


Only way I do is downgrade butterknife. (If you don't want AndroidX and just use support library.)
Downgrade butterknife to 8.8.1 and use kotlin-kapt plugin is work on my end.

There is a working sample:

build.gradle in app module
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-kapt'

android {
    compileSdkVersion 28
    defaultConfig {
        applicationId "com.example.helloworld"
        minSdkVersion 15
        targetSdkVersion 28
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

buildscript {
    ext.supportLibraryVersion = '28.0.0'
    ext.butterknifeVersion = '8.8.1'
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation"org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
    implementation "com.android.support:appcompat-v7:$supportLibraryVersion"
    implementation "com.android.support:recyclerview-v7:$supportLibraryVersion"
    implementation 'com.android.support.constraint:constraint-layout:1.1.3'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test:runner:1.0.2'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'

    implementation "com.jakewharton:butterknife:$butterknifeVersion"
    implementation "com.jakewharton:butterknife-annotations:$butterknifeVersion"
    kapt "com.jakewharton:butterknife-compiler:$butterknifeVersion"
}
build.gradle for project
// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    ext.kotlin_version = '1.3.21'
    repositories {
        google()
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.3.1'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
    }
}

allprojects {
    repositories {
        google()
        jcenter()
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}
Was this page helpful?
0 / 5 - 0 ratings