shizhen
shizhen

Reputation: 12583

com.android.builder.internal.aapt.v2.Aapt2Exception: Android resource linking failed: error: failed linking references

I am running into below error from aapt2:

My enviroment is as below:

android {
    compileSdkVersion 28
    buildToolsVersion '28.0.3'

    defaultConfig {
        applicationId "com.arophix.example"
        minSdkVersion 19
        targetSdkVersion 28

        versionCode 0
        versionName "1.0"
    }

    buildTypes {
        debug {
            minifyEnabled true
            proguardFiles getDefaultProguardFile('proguard-android.txt')
        }
        release {
            minifyEnabled true
            proguardFiles getDefaultProguardFile('proguard-android.txt')
        }
    }

    ...
}

dependencies {
    implementation 'com.android.support:appcompat-v7:28.0.0'
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    ...
}

Error is as below:

> 1 exception was raised by workers:
  com.android.builder.internal.aapt.v2.Aapt2Exception: Android resource linking failed
  error: resource style/Theme.AppCompat.Light (aka com.arophix.example:style/Theme.AppCompat.Light) not found.
  error: resource style/Theme.AppCompat.Light.NoActionBar (aka com.arophix.example:style/Theme.AppCompat.Light.NoActionBar) not found.
  ~/example/example/app/build/intermediates/res/merged/release/values/values.xml:95: error: resource style/Theme.AppCompat.Light.Dialog.Alert (aka com.arophix.example:style/Theme.AppCompat.Light.Dialog.Alert) not found.
  error: resource style/Widget.AppCompat.Button.Colored (aka com.arophix.example:style/Widget.AppCompat.Button.Colored) not found.
  error: resource style/Widget.AppCompat.Button.Colored (aka com.arophix.example/Widget.AppCompat.Button.Colored) not found.
  error: failed linking references.

Any ideas about how to solve this issue?

Upvotes: 0

Views: 4582

Answers (2)

Enes Arikan
Enes Arikan

Reputation: 21

Removing the buildToolsVersion did not work for me but updating my SDK tool helped me to solve the problem. First, update Android Update Build tools then change buildToolVersion to the latest one... Hope this fixes your problem.

Upvotes: 2

Lakhwinder Singh
Lakhwinder Singh

Reputation: 7219

Remove the buildToolsVersion and try

Upvotes: 3

Related Questions