5
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Android KTXで嵌ってた(Android resource linking failed)

Posted at

Google I/Oで発表されたNavigationを触ろうとしてなんだか嵌ってしまったこと。

Android Studio のプロジェクト自動生成で作って、
Android KTXを入れようとしてたんですが、以下のエラーがでて全くビルドできず。。。

Android resource linking failed
Output:  C:\Users\nitak\projects\SampleNavigation\app\build\intermediates\incremental\mergeDebugResources\merged.dir\values\values.xml:355: error: resource android:attr/fontVariationSettings not found.
C:\Users\nitak\projects\SampleNavigation\app\build\intermediates\incremental\mergeDebugResources\merged.dir\values\values.xml:355: error: resource android:attr/ttcIndex not found.
error: failed linking references.

結論

  • SDKバージョンは28にする
  • グループはandroidxを使う
  • まだpreview

調べたこと

Android resource linking failed で検索してもどうも違う情報がヒットする。
3か月前とかの情報だったり。。。

Android KTXのissuesみてたら、以下の内容があったので参考にしてみる。

JakeWharton commented on 19 May
core-ktx 1.0.0-alpha1 depends on core 1.0.0-alpha1 which requires compilation against Android P.

AndroidX installation error

SDKバージョンあげてなかった・・・

しょうもないけど解決しました。

あとはこれ。
Manifest merger failed #576

できたのが以下のbuild.gradle

build.gradle
apply plugin: 'com.android.application'

apply plugin: 'kotlin-android'

apply plugin: 'kotlin-android-extensions'

android {
    compileSdkVersion 28
    buildToolsVersion "27.0.3"
    defaultConfig {
        applicationId "net.nitakan.samplenavigation"
        minSdkVersion 19
        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'
        }
    }
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'androidx.appcompat:appcompat:1.0.0-alpha3'
    implementation 'androidx.constraintlayout:constraintlayout:1.1.2'
    testImplementation 'junit:junit:4.12'
    implementation 'androidx.core:core-ktx:1.0.0-alpha3'

    androidTestImplementation('androidx.test.espresso:espresso-core:3.1.0-alpha3', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
}

5
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
5
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?