astuetz / PagerSlidingTabStrip

An interactive indicator to navigate between the different pages of a ViewPager
139 stars 44 forks source link

Use newer build tools to prevent crash when using in a project with com.android.tools.build:gradle:3.0.0-beta2 #312

Open ChristophKaser opened 6 years ago

ChristophKaser commented 6 years ago

Currently, when this library is used with the newest android gradle plugin (com.android.tools.build:gradle:3.0.0-beta2), the app crashes when the PagerSlidingTabStrip is inflated:

java.lang.UnsupportedOperationException: Can't convert value at index 1 to color: type=0x5 at android.content.res.TypedArray.getColor(TypedArray.java:480) at com.astuetz.PagerSlidingTabStrip.<init>(PagerSlidingTabStrip.java:144) at com.astuetz.PagerSlidingTabStrip.<init>(PagerSlidingTabStrip.java:106)

This is caused by the following bug in the old build tools: https://issuetracker.google.com/issues/64472743

This PR fixes the problem by building the library with newer buildtools

vovander commented 6 years ago

Have the same issue!

rogerioit commented 6 years ago

I had the same issue. I applied the solution and it worked like a charm. Thanks for the help @ChristophKaser, you saved my monday.

hgoebl commented 6 years ago

Thanks @ChristophKaser

In the meantime, if switching from 2.3.0 to 3.0.0 of com.android.tools.build:gradle it is also necessary to change maven repository from jcenter() to google().

jiangbodev commented 6 years ago

It seems the author is not actively working on this project right now.

How can I make gradle use a modified version of this lib?

currently compile 'com.astuetz:pagerslidingtabstrip:1.0.1'

ChristophKaser commented 6 years ago

You can use jitpack.io:

repositories {
    maven { url "https://jitpack.io" }
}

dependencies {
    compile 'com.github.ChristophKaser:PagerSlidingTabStrip:d924189a70'
}