0

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?

5
  • Hi there, It means that the Theme you have used that is not found. resource linking failed means resource linking is not properly done. Just change the theme that is mention in the error. Read the error properly and solve this easily. This is not a complicated error. Try once you will be succeeded. If get any problem let me know. Commented Jul 4, 2019 at 6:37
  • the problem is when i run ./gradlew assembleDebug it has no such error, but ./gradlew assembleRelease will bring up this error. Commented Jul 4, 2019 at 6:42
  • Remove the buildToolsVersion and try adding compileOptions { sourceCompatibility JavaVersion.VERSION_1_8 targetCompatibility JavaVersion.VERSION_1_8 } before defaultConfig section Commented Jul 4, 2019 at 6:45
  • Your error shows that it didn't get those 5 themes that are mention in the error log. Have you tried it by terminal gradle build if not then please try once again. Commented Jul 4, 2019 at 6:46
  • @LakhwinderSingh, Thanks! "Remove the buildToolsVersion" works. Please make it as an answer so that I can accept it. Commented Jul 4, 2019 at 7:59

2 Answers 2

3

Remove the buildToolsVersion and try

Sign up to request clarification or add additional context in comments.

Comments

2

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.

1 Comment

This does not really answer the question. If you have a different question, you can ask it by clicking Ask Question. To get notified when this question gets new answers, you can follow this question. Once you have enough reputation, you can also add a bounty to draw more attention to this question. - From Review

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.