Search code examples
androidaapt2

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 Studio 3.4.1
  • Gradle plugin: 3.4.1
  • macOS
  • build.gradle 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?


Solution

  • Remove the buildToolsVersion and try