Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android resource linking failed error: style attribute 'attr/textColorError (aka com.app.kite:attr/textColorError)' not found

I tried to use the following library (version 2.0.1) in my project but as soon as I tried to add it to my gradle file and build the project I started getting this error.

Android resource linking failed
Output:  C:\Users\me\androidProject\kite\build\intermediates\incremental\mergeDebugResources\merged.dir\values\values.xml:8642: error: style attribute 'attr/textColorError (aka com.app.kite:attr/textColorError)' not found.
error: failed linking references.

Command: C:\Users\me\.gradle\caches\transforms-1\files-1.1\aapt2-3.2.1-4818971-windows.jar\355577d385562aabb3c69eea7f88a383\aapt2-3.2.1-4818971-windows\aapt2.exe link -I\
        C:\Users\me\AppData\Local\Android\Sdk\platforms\android-28\android.jar\
        --manifest\
        C:\Users\me\androidProject\kite\build\intermediates\merged_manifests\debug\processDebugManifest\merged\AndroidManifest.xml\
        -o\
        C:\Users\me\androidProject\kite\build\intermediates\processed_res\debug\processDebugResources\out\resources-debug.ap_\
        -R\
        @C:\Users\me\androidProject\kite\build\intermediates\incremental\processDebugResources\resources-list-for-resources-debug.ap_.txt\
        --auto-add-overlay\
        --java\
        C:\Users\me\androidProject\kite\build\generated\not_namespaced_r_class_sources\debug\processDebugResources\r\
        --proguard-main-dex\
        C:\Users\me\androidProject\kite\build\intermediates\legacy_multidex_aapt_derived_proguard_rules\debug\processDebugResources\manifest_keep.txt\
        --custom-package\
        com.app.kite\
        -0\
        apk\
        --output-text-symbols\
        C:\Users\me\androidProject\kite\build\intermediates\symbols\debug\R.txt\
        --no-version-vectors
Daemon:  AAPT2 aapt2-3.2.1-4818971-windows Daemon #0

I updated my support lib to 28.0.0 but that doesn't work. My compile and target sdk versions are 28 and buildToolsVersion is 28.0.3. This is the library dependency as in my gradle file.

implementation 'com.github.mukeshsolanki:android-otpview-pinview:2.0.1'

Can someone help. Thanks!!

like image 563
varunkr Avatar asked Jan 16 '19 06:01

varunkr


2 Answers

Step 1: create a file under values folder named attr.xml if not already exits and add the following lines:

<?xml version="1.0" encoding="utf-8"?>
<resources>
<declare-styleable name="foo">
<attr name="textColorError" format="color" />
</declare-styleable>
</resources>

Step 2: Add the following lines in styles.xml

 <style name="foo">
    <item name="textColorError">@color/colorPrimary</item>
</style>

Step 3: Clean the project and rebuild.

like image 44
Jayakumar Avatar answered Nov 15 '22 07:11

Jayakumar


Use colorError instead of textColorError.

If the usages of textColorError are inside that library and you can't change it, you won't be able to update to 28.0.0 until that is fixed.

like image 92
Mateus Gondim Avatar answered Nov 15 '22 06:11

Mateus Gondim