My app is crashing after updating to Android Studio 3 RC1
(Gradle
4, Android Gradle
plugin 3 RC2).
This is the error I am having:
java.lang.RuntimeException: Unable to start activity ComponentInfo{*****}:
android.view.InflateException: Binary XML file line #0: Binary XML file line #0:
Error inflating class com.viewpagerindicator.CirclePageIndicator
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2817)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2892)
at android.app.ActivityThread.-wrap11(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1593)
at android.os.Handler.dispatchMessage(Handler.java:105)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6541)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:767)
Caused by: android.view.InflateException: Binary XML file line #0: Binary XML file line #0: Error inflating class com.viewpagerindicator.CirclePageIndicator
Caused by: android.view.InflateException: Binary XML file line #0: Error inflating class com.viewpagerindicator.CirclePageIndicator
Caused by: java.lang.reflect.InvocationTargetException
at java.lang.reflect.Constructor.newInstance0(Native Method)
at java.lang.reflect.Constructor.newInstance(Constructor.java:334)
at android.view.LayoutInflater.createView(LayoutInflater.java:647)
at uk.co.chrisjenx.calligraphy.CalligraphyLayoutInflater.createCustomViewInternal(CalligraphyLayoutInflater.java:211)
at uk.co.chrisjenx.calligraphy.CalligraphyLayoutInflater.access$000(CalligraphyLayoutInflater.java:20)
at uk.co.chrisjenx.calligraphy.CalligraphyLayoutInflater$PrivateWrapperFactory2.onCreateView(CalligraphyLayoutInflater.java:302)
at android.view.LayoutInflater$FactoryMerger.onCreateView(LayoutInflater.java:186)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:780)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:730)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:863)
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:824)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:866)
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:824)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:866)
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:824)
at android.view.LayoutInflater.inflate(LayoutInflater.java:515)
at uk.co.chrisjenx.calligraphy.CalligraphyLayoutInflater.inflate(CalligraphyLayoutInflater.java:60)
at android.view.LayoutInflater.inflate(LayoutInflater.java:423)
at android.view.LayoutInflater.inflate(LayoutInflater.java:374)
at android.support.v7.app.AppCompatDelegateImplV9.setContentView(AppCompatDelegateImplV9.java:287)
at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:139)
at com.raimbekov.android.sajde.zikr.ZikrActivity.onCreate(ZikrActivity.java:195)
at android.app.Activity.performCreate(Activity.java:6975)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1213)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2770)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2892)
at android.app.ActivityThread.-wrap11(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1593)
at android.os.Handler.dispatchMessage(Handler.java:105)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6541)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:767)
Caused by: java.lang.UnsupportedOperationException: Can't convert value at index 5 to color: type=0x5
10-20 10:48:09.562 6156-6156 E/AndroidRuntime: at android.content.res.TypedArray.getColor(TypedArray.java:473)
at com.viewpagerindicator.CirclePageIndicator.<init>(CirclePageIndicator.java:96)
at com.viewpagerindicator.CirclePageIndicator.<init>(CirclePageIndicator.java:72)
... 34 more
I didn't have this problem before update (on Android Studio
2). It is also described on github, but no answer.
Changecompile 'com.viewpagerindicator:library:2.4.1@aar'
tocompile 'com.github.JakeWharton:ViewPagerIndicator:2.4.1'
It'll work. There is a problem with the library.
My project uses android gradle plugin 3.0 and compileSdk 27. I wasn't able to make it work with this setup using the suggested solutions (compile 'com.github.JakeWharton:ViewPagerIndicator:2.4.1'
) in this thread.
It was complaining about methods like ViewPager#removeOnPageChangeListener
not existing which have been added in version 24 of the support library. I think it has to do with the fact that the library has android-support-v4.jar directly baked in.
I didn't want to go through all my xml files and set the attributes programmatically so I ended up creating a fork that uses gradle to build the library and bumps compileSdk/minSdk/support-v4 to more modern versions.
You can find the project here https://github.com/splatte/ViewPagerIndicator
To use it in your project, get it from jitpack like so:
allprojects {
repositories {
maven { url "https://jitpack.io" }
}
}
and then:
dependencies {
implementation 'com.github.splatte:ViewPagerIndicator:3.0.0'
}
(There must be another project that does this in the sea of 4.300 forks that ViewPagerIndicator has, but I didn't know how to find it.)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With