10

I am trying to create circular-shaped buttons for my first android app.

For that, I added the library as compile 'com.cuboid:cuboidcirclebutton:1.0.5' in circlebutton/app/build.gradle

As I sync, I get errors. below is the log

Information:Gradle tasks [clean, :app:assembleDebug]
C:\Users\Amninder\.gradle\caches\transforms-1\files-1.1\appcompat-v7-26.1.0.aar\2d55d8c33dae479e599960c08d012b17\res\values\values.xml
Error:(246, 5) error: duplicate value for resource 'attr/font' with config ''.
Error:(246, 5) error: resource previously defined here.

C:\Users\Amninder\AndroidStudioProjects\circlebutton\app\build\intermediates\incremental\mergeDebugResources\merged.dir\values\values.xml
Error:(254) duplicate value for resource 'attr/font' with config ''.

Error:(240) resource previously defined here.

Error:java.util.concurrent.ExecutionException: com.android.tools.aapt2.Aapt2Exception: AAPT2 error: check logs for details
Error:Execution failed for task ':app:mergeDebugResources'.

 Error: java.util.concurrent.ExecutionException: com.android.tools.aapt2.Aapt2Exception: AAPT2 error: check logs for details
Information:BUILD FAILED in 19s
Information:6 errors
Information:0 warnings
Information:See complete output in console`

Below is a list of things I tried and failed.

1.removing attr/font on line 254 > doing save all > clean project > rebuild project.

  1. I was inspired by this youtube video - https://www.youtube.com/watch?v=dF0m_PG111g so checked in its comments section. First, the comment was the same error. So, check this guy's blog. So I got to know the error was because of adding the library only. So I searched on google for - how to add a custom library in android referred to this. opened it and there was no info. regarding the error, I am facing.

  2. Saw another link on the video, from StackOverflow this time.here is the link. He says "After renaming the library attribute to something else (text font), all went good again." I also tried renaming the attr/font to attr/1txtfont but changes were not reflected at all.

Can anyone here please help me out on this?

Rahul
  • 3,293
  • 2
  • 31
  • 43
Amninder Singh
  • 321
  • 1
  • 2
  • 20

2 Answers2

6

You're using support library version 26 which defines attribute attr/font and the library defines the same attribute, this is what causes the error.

So you either use support library version < 26, for example: com.android.support:appcompat-v7:25.3.1. Or the library owner rename the attribute

y.allam
  • 1,446
  • 13
  • 24
3

Thank you so much for your valuable insight y.allam. For any person who faces such an error. Below are the elaborated changes.

In your file build.gradle, change compileSdkVersion to 25 , targetSdkVersion to 25

solution part 1 .

Now in the same file, as sorted out by y.allam, change the SDK version to com.android.support:appcompat-v7:25.3.1.

[solution part 22

Rahul
  • 3,293
  • 2
  • 31
  • 43
Amninder Singh
  • 321
  • 1
  • 2
  • 20