Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

添加IntButton在布局的时候报错 #64

Open
hlzIrving opened this issue Sep 25, 2018 · 5 comments
Open

添加IntButton在布局的时候报错 #64

hlzIrving opened this issue Sep 25, 2018 · 5 comments

Comments

@hlzIrving
Copy link

布局:

<com.bilibili.magicasakura.widgets.TintButton
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:text="123"/>
错误:Caused by: android.view.InflateException: Binary XML file line #9: Error inflating class com.bilibili.magicasakura.widgets.TintButton

我添加了依赖implementation 'com.bilibili:magicasakura:0.1.8@aar'
内部的属性也没错,所以不太清楚为啥会报这个错误,本人用的是4.4.2夜神模拟器跑的

@xyczero
Copy link
Member

xyczero commented Sep 25, 2018

整个布局加载只有TintButton出错了?那可能需要你debug看下TintButton初始化时具体发生的错误了

@hlzIrving
Copy link
Author

整个布局加载只有TintButton出错了?那可能需要你debug看下TintButton初始化时具体发生的错误了

我把依赖删除,使用库的形式添加magicasakura,在TintButton内打断点,也是在4.4.2夜神模拟器运行,竟然没有崩溃,成功跑起来了。所以,这到底是啥原因崩溃的。

@xyczero
Copy link
Member

xyczero commented Sep 26, 2018

😂那通过依赖的形式打断点看看呢

@hlzIrving
Copy link
Author

hlzIrving commented Sep 27, 2018

joy那通过依赖的形式打断点看看呢

Caused by: java.lang.NoClassDefFoundError: android.support.v4.graphics.drawable.DrawableWrapper
at com.bilibili.magicasakura.utils.ThemeUtils.getWrapperDrawable(ThemeUtils.java:270)
at com.bilibili.magicasakura.utils.ThemeUtils.containsNinePatch(ThemeUtils.java:245)
at com.bilibili.magicasakura.widgets.AppCompatBackgroundHelper.recoverPadding(AppCompatBackgroundHelper.java:197)
at com.bilibili.magicasakura.widgets.AppCompatBackgroundHelper.setBackgroundDrawable(AppCompatBackgroundHelper.java:122)
at com.bilibili.magicasakura.widgets.AppCompatBackgroundHelper.loadFromAttribute(AppCompatBackgroundHelper.java:65)
at com.bilibili.magicasakura.widgets.TintButton.(TintButton.java:59)
at com.bilibili.magicasakura.widgets.TintButton.(TintButton.java:48)
at java.lang.reflect.Constructor.constructNative(Native Method) 
at java.lang.reflect.Constructor.newInstance(Constructor.java:423) 
at android.view.LayoutInflater.createView(LayoutInflater.java:594) 
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:696) 
at android.view.LayoutInflater.rInflate(LayoutInflater.java:755) 
at android.view.LayoutInflater.inflate(LayoutInflater.java:492) 
at android.view.LayoutInflater.inflate(LayoutInflater.java:397) 
at android.view.LayoutInflater.inflate(LayoutInflater.java:353) 
依赖下断点在这里报错了。4.4.2夜神模拟器运行

@xyczero
Copy link
Member

xyczero commented Sep 30, 2018

😯这个类是v4里的。。。感觉是模拟器的锅

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants