milosmns / actual-number-picker

Android: A horizontal number picker
GNU General Public License v3.0
222 stars 36 forks source link

duplicate values in values.xml #17

Closed rickAllDev closed 6 years ago

rickAllDev commented 7 years ago

Had a couple of duplicate definitions when I tried to include your numberpicker library (min_value, max_value and bar_color). Haven't messed around with libraries much. Can you give me some idea on how what I could modify to solve the problem?

milosmns commented 7 years ago

So if you have 'duplicate definitions', you either included the library twice somehow; or you might have the source included in your project and also declared a gradle dependency, which could create a problem. Other than that, each View has it's own namespace, and its attribute names shouldn't collide with other attribute names.

Did you check out the demo app? https://github.com/milosmns/actual-number-picker/tree/master/demo You can compare yours with that one and see what's different.

rickAllDev commented 7 years ago

thanks for getting back so quick. don't have it included twice, all I have done is added compile 'me.angrybyte.picker:picker:1.3.1' to module gradle. I am playing around with another library (CrystalRangeSeekbar). These variables are also used there which is causing the conflict.

I don't have any experience with libraries. I assumed there was some mechanism to keep variables localized but no clue on what to look at

milosmns commented 7 years ago

That's weird. I think they are mapped to a particular view, so you won't get a conflict. I haven't experienced that error before... can you try them out separately and see what's happening? Make sure you include them in your module's build.gradle, not the root build.gradle. I'm traveling so I might be slow to respond.

On Thu, Aug 31, 2017 at 2:37 PM rweller59 notifications@github.com wrote:

thanks for getting back so quick. don't have it included twice, all I have done is added compile 'me.angrybyte.picker:picker:1.3.1' to module gradle. I am playing around with another library (CrystalRangeSeekbar). These variables are also used there which is causing the conflict.

I don't have any experience with libraries. I assumed there was some mechanism to keep variables localized but no clue on what to look at

— You are receiving this because you commented.

Reply to this email directly, view it on GitHub https://github.com/milosmns/actual-number-picker/issues/17#issuecomment-326282295, or mute the thread https://github.com/notifications/unsubscribe-auth/ABsJirhjS8LIgLBpFqidjcZPPdRAoynpks5sdqjvgaJpZM4PH8HX .

milosmns commented 6 years ago

Attributes from my lib are prefixed with the View's name, following up with an underscore, so ActualNumberPicker_attribute so that can't collide with anything. Pls check your XML/Java to see if you have another spot in the code that might be causing the issue, or just start a new project and add things one by one until it breaks :)

milosmns commented 6 years ago

Btw, the range bar you're using is definitely causing the issue,

<attr name="min_value" format="float" />
<attr name="max_value" format="float" />

So it's probably best if you ask them to remove those unbound attributes altogether. I can't see a use case for unbound attributes such as these.