0

I add ViewPagerIndicator library using this question.

And I get "Attribute "radius" has already been defined" error

I have not idea about what to do for fix this error, I searched in internet but I cant get the answer. Here is my gradle:

dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    compile 'com.android.support:appcompat-v7:22.0.0'
    compile 'com.android.support:support-v4:22.0.0'
    compile project(':vksdk_library')
    compile 'de.hdodenhof:circleimageview:1.2.1'
    compile 'com.android.support:recyclerview-v7:21.0.+'


    compile 'com.viewpagerindicator:library:2.4.1@aar'
}

How can I fix it?

Community
  • 1
  • 1
Zhambul
  • 942
  • 9
  • 23

2 Answers2

3

check this

"I've added two libraries into my project. The two projects have declared attribute called "radius", when I run the project I got the following error."

Error:Attribute "radius" has already been defined

The issue is that there is a single namespace for all resource names and both libraries are colliding. This is clearly not great at all, I understand your frustrations, but until the platform implements the ability to have different resource pools inside an app there's little the tools can do.

Nezam
  • 4,122
  • 3
  • 32
  • 49
Jorgesys
  • 124,308
  • 23
  • 334
  • 268
0

I also had this error. I use ViewPageIndicator like this:

 <com.viewpagerindicator.CirclePageIndicator
        xmlns:app="http://schemas.android.com/apk/res-auto"
                    android:id="@+id/page_indicator"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_gravity="bottom|center_horizontal"
                    android:layout_marginBottom="16dp"
                    android:padding="8dp"
                    app:centered="true"
                    app:fillColor="@color/white"
                    app:radius="4dp"
                    app:snap="false"
                    />

Here is my solution, I change xmlns:app to xmlns:vpi ,and all app namespace in this CirclePageIndicator element to vpi, the problem solved. Below is the code after changed:

<com.viewpagerindicator.CirclePageIndicator
     xmlns:vpi="http://schemas.android.com/apk/res-auto"
                android:id="@+id/page_indicator"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_gravity="bottom|center_horizontal"
                android:layout_marginBottom="16dp"
                android:padding="8dp"
                vpi:centered="true"
                vpi:fillColor="@color/white"
                vpi:radius="4dp"
                vpi:snap="false"
                />
HanlyJiang
  • 16
  • 2