Open francesco98 opened 6 years ago
Hi @francesco98. Could you provide the code of the whole XML that you are trying to use this button? It is very hard to debug this problem without the understanding the context where you are trying to use this library. Anyway, which version are you using?
I am also facing the same error. I am just using it simply in my xml file as I use other buttons. Here is the code:-
<br.com.simplepass.loading_button_lib.customViews.CircularProgressButton android:id="@+id/Circular" android:layout_width="match_parent" android:layout_height="wrap_content" android:text="Fetch"/>
Here is the error: Caused by: android.view.InflateException: Binary XML file line #187: Binary XML file line #187: Error inflating class br.com.simplepass.loading_button_lib.customViews.CircularProgressButton
Caused by: android.view.InflateException: Binary XML file line #187: Error inflating class br.com.simplepass.loading_button_lib.customViews.CircularProgressButton
I am using Android Studio Version 3.1.2. Please resolve this error as fast as possible..
Hello @rajgar114. Could you please post the whole content of your XML?
Thanks I have updated the version from implementation 'br.com.simplepass:loading-button-android:1.13.3' to implementation 'br.com.simplepass:loading-button-android:1.14.0'
and now it is working fine for me..
Good to know it works now. What about you @francesco98?
Same problem here
Exception:
E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.ext.pow.poke, PID: 5099
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.ext.pow.poke/com.ext.pow.poke.LoginActivity}: android.view.InflateException: Binary XML file line #0: Binary XML file line #0: Error inflating class br.com.simplepass.loading_button_lib.customViews.CircularProgressButton
at android.app.ActivityThread.performLaunchActivity(Unknown Source:524)
at android.app.ActivityThread.handleLaunchActivity(Unknown Source:30)
at android.app.ActivityThread.-wrap11(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(Unknown Source:80)
at android.os.Handler.dispatchMessage(Unknown Source:21)
at android.os.Looper.loop(Unknown Source:139)
at android.app.ActivityThread.main(Unknown Source:71)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Unknown Source:11)
at com.android.internal.os.ZygoteInit.main(Unknown Source:203)
Caused by: android.view.InflateException: Binary XML file line #0: Binary XML file line #0: Error inflating class br.com.simplepass.loading_button_lib.customViews.CircularProgressButton
Caused by: android.view.InflateException: Binary XML file line #0: Error inflating class br.com.simplepass.loading_button_lib.customViews.CircularProgressButton
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(Unknown Source:194)
at android.view.LayoutInflater.createViewFromTag(Unknown Source:197)
at android.view.LayoutInflater.createViewFromTag(Unknown Source:6)
at android.view.LayoutInflater.rInflate(Unknown Source:101)
at android.view.LayoutInflater.rInflateChildren(Unknown Source:9)
at android.view.LayoutInflater.rInflate(Unknown Source:112)
at android.view.LayoutInflater.rInflateChildren(Unknown Source:9)
at android.view.LayoutInflater.inflate(Unknown Source:264)
at android.view.LayoutInflater.inflate(Unknown Source:20)
at android.view.LayoutInflater.inflate(Unknown Source:3)
at android.support.v7.app.AppCompatDelegateImplV9.setContentView(AppCompatDelegateImplV9.java:287)
at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:139)
at com.ext.pow.poke.LoginActivity.onCreate(LoginActivity.java:49)
at android.app.Activity.performCreate(Unknown Source:3)
at android.app.Instrumentation.callActivityOnCreate(Unknown Source:3)
at android.app.ActivityThread.performLaunchActivity(Unknown Source:466)
at android.app.ActivityThread.handleLaunchActivity(Unknown Source:30)
at android.app.ActivityThread.-wrap11(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(Unknown Source:80)
at android.os.Handler.dispatchMessage(Unknown Source:21)
at android.os.Looper.loop(Unknown Source:139)
at android.app.ActivityThread.main(Unknown Source:71)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Unknown Source:11)
at com.android.internal.os.ZygoteInit.main(Unknown Source:203)
Caused by: java.lang.RuntimeException: Error reading background... Use a shape or a color in xml!
at br.com.simplepass.loading_button_lib.customViews.CircularProgressButton.loadGradientDrawable(CircularProgressButton.java:213)
at br.com.simplepass.loading_button_lib.customViews.CircularProgressButton.init(CircularProgressButton.java:136)
at br.com.simplepass.loading_button_lib.customViews.CircularProgressButton.<init>(CircularProgressButton.java:84)
at java.lang.reflect.Constructor.newInstance0(Native Method)
at java.lang.reflect.Constructor.newInstance(Constructor.java:334)
XML:
<br.com.simplepass.loading_button_lib.customViews.CircularProgressButton
android:id="@+id/buttonLogin"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:background="@drawable/button_rounded_white"
android:elevation="5dp"
android:stateListAnimator="@null"
android:text="SIGN IN"
android:textColor="#00b1ba"
android:translationZ="2dp"
app:spinning_bar_color="#bfbfbf"
app:spinning_bar_padding="6dp" />
Whole XML: https://pastebin.com/nd0ctJ1r
I get this exception only with 1.14.0 but i need this one for fix the error with btn.startAnimation()
in onCreate()
.
Thank you
@powext Had the same issue right now. Do you have <ripple></ripple>
in your "drawable/button_rounded_white" file? If so, replace it with <selector></selector>
Even I am facing the same issue. Without specifying background as drawable it works fine, but crashes when drawable is set as background.
I have the same problem.
I have my own view that extends from CircularProgressButton
. When I try to set to background drawable with Ripple effect crash happens.
The problem occurs when loadGradientDrawable
is called. It tries to find RippleDrawable in if-else-if cases but there are no such case. And next code is executed:
if (mGradientDrawable.morphingDrawable == null) {
throw new RuntimeException("Error reading background... Use a shape or a color in xml!");
}
Everything is working fine in 1.12.1 version though.
Same problem here with version 2.0.7 when I try to apply the Widget.MaterialComponents.Button
style:
<br.com.simplepass.loadingbutton.customViews.CircularProgressButton
style="@style/Widget.MaterialComponents.Button"
android:id="@+id/my_id"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="2dp"
android:layout_gravity="center"
android:text="Foobar"
app:spinning_bar_color="@color/colorAccent"
app:spinning_bar_padding="5dp"/>
In Utils.parseGradientDrawable
the drawable is a RippleDrawable, so the else
branch of the when
throws a RuntimeException.
I am having a problem. Android: 4.4 KitKat Device: All Android Studio 3.4.2 Build # AI-183.6156.11.34.5692245, built on June 27, 2019. JRE: 1.8.0_152-release-1343-b01 x86_64 JVM: JetBrains 64-bit OpenJDK Server VM s.r.o macOS 10.14.4
Error Occurs When Creating Layout in xml
Process: br.com.app.my.pack, PID: 7016
android.view.InflateException: Binary XML file line #172: Error inflating class br.com.simplepass.loading_button_lib.customViews.CircularProgressButton
//Line 172 <br.com.simplepass.loading_button_lib.customViews.CircularProgressButton
...
I will try to migrate to
implementation 'br.com.simplepass: loading-button-android: 2.1.5'
androidX
and communicate if it works.
Hi
works
removed
android:drawableEnd="@drawable/ic_check_circle"
android:drawableRight="@drawable/ic_check_circle"
我也遇到了这个问题 原因是shape文件错误,之前错误的写发如下
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape android:shape="rectangle">
<solid android:color="@color/color_app_red" />
<corners android:radius="25dp" />
</shape>
</item>
</selector>
修改为:
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle"
>
<solid android:color="@color/color_app_red" />
<corners android:radius="25dp" />
</shape>
解决问题
Hello everybody,
I don't know if my answer helps anyone here, but I had the same issue as above. And what I was doing wrong was to use this: <br.com.simplepass.loading_button_lib.customViews.CircularProgressButton android:id="@+id/bContinuarValidation" style="@style/continueButton" android:layout_gravity="center_horizontal" android:layout_marginTop="10dp" android:text="@string/verificar" app:initialCornerAngle="27dp" app:spinning_bar_color="#fff" app:spinning_bar_padding="0dp" app:spinning_bar_width="4dp" android:enabled="false"/>
Instead of this:
<br.com.simplepass.loadingbutton.customViews.CircularProgressButton
android:id="@+id/bContinuarValidation"
style="@style/continueButton"
android:layout_gravity="center_horizontal"
android:layout_marginTop="10dp"
android:text="@string/verificar"
app:initialCornerAngle="27dp"
app:spinning_bar_color="#fff"
app:spinning_bar_padding="0dp"
app:spinning_bar_width="4dp"
android:enabled="false"/>
Currently, I'm using version 2.2.0.
Thanks I have updated the version from implementation 'br.com.simplepass:loading-button-android:1.13.3' to implementation 'br.com.simplepass:loading-button-android:1.14.0'
and now it is working fine for me..
Does this still exist? Trying to include it I get:
Error: Caused by: org.gradle.internal.resolve.ModuleVersionNotFoundException: Could not find br.com.simplepass:loading-button-android:1.14.0.
Hi,
I'm trying to use the CircularProgressButton, but I receive this error:
This is my XML:
Could you help me? Thanks