6

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!!

varunkr
  • 5,364
  • 11
  • 50
  • 99

3 Answers3

12

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.

Mateus Gondim
  • 5,362
  • 6
  • 31
  • 51
6

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.

Jayakumar
  • 303
  • 4
  • 5
-1

Try to,

  1. Clean your project
  2. Invalidate cache and Restart
  3. Delete the .gradle folder in the project and build folder under app/build
Meena Dev
  • 82
  • 1
  • 9