所以我们最近将buildToolsVersion更新为26.0.2现在我们的代码在我尝试创建CircularProgressButton时使用的CircularProgressButton库中崩溃(see library我知道我们使用不受支持的库得到了我们应得的)。
堆栈跟踪表明它是由InflationException“二进制XML文件行#0”引起的。但是当我在调试时跟踪它时,我可以看到TypedArray.getDimension()调用抛出了UnsupportedOperationExcetion,这是崩溃的真正根本原因。 getDimension()方法中发生的事情是我们期望TypedValue是TYPE_DIMENSION但它是TYPE_STRING。有没有人知道我在哪里可以看到属性或TypedValue是如何设置的?
完整堆栈跟踪:
java.lang.RuntimeException: Unable to start activity
ComponentInfo{com.salesrabbit.android.sales.universal/com.salesrabbit.android.sales.universal.nav.MainActivity}:
android.view.InflateException: Binary XML file line #0: Binary XML file line #0:
Error inflating class com.dd.CircularProgressButton
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2416)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2476)
at android.app.ActivityThread.-wrap11(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1344)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5417)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
Caused by: android.view.InflateException: Binary XML file line #0: Binary XML file line #0: Error inflating class com.dd.CircularProgressButton
at android.view.LayoutInflater.inflate(LayoutInflater.java:539)
at android.view.LayoutInflater.inflate(LayoutInflater.java:423)
at com.salesrabbit.android.sales.universal.auth.OnboardingFragment.onCreateView(OnboardingFragment.java:111)
at android.support.v4.app.Fragment.performCreateView(Fragment.java:2248)
at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1340)
at android.support.v4.app.FragmentManagerImpl.moveFragmentToExpectedState(FragmentManager.java:1569)
at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1636)
at android.support.v4.app.BackStackRecord.executeOps(BackStackRecord.java:758)
at android.support.v4.app.FragmentManagerImpl.executeOps(FragmentManager.java:2415)
at android.support.v4.app.FragmentManagerImpl.executeOpsTogether(FragmentManager.java:2201)
at android.support.v4.app.FragmentManagerImpl.optimizeAndExecuteOps(FragmentManager.java:2155)
at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:2064)
at android.support.v4.app.Fragment.performStart(Fragment.java:2270)
at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1381)
at android.support.v4.app.FragmentManagerImpl.moveFragmentToExpectedState(FragmentManager.java:1569)
at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1636)
at android.support.v4.app.FragmentManagerImpl.dispatchStart(FragmentManager.java:2984)
at android.support.v4.app.FragmentController.dispatchStart(FragmentController.java:203)
at android.support.v4.app.FragmentActivity.onStart(FragmentActivity.java:613)
at android.support.v7.app.AppCompatActivity.onStart(AppCompatActivity.java:178)
at com.trello.rxlifecycle2.components.support.RxAppCompatActivity.onStart(RxAppCompatActivity.java:66)
at com.salesrabbit.android.sales.universal.BaseActivity.onStart(BaseActivity.java:75)
at com.salesrabbit.android.sales.universal.nav.MainActivity.onStart(MainActivity.java:328)
at android.app.Instrumentation.callActivityOnStart(Instrumentation.java:1237)
at android.app.Activity.performStart(Activity.java:6268)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2379)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2476)
at android.app.ActivityThread.-wrap11(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1344)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5417)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
Caused by: android.view.InflateException: Binary XML file line #0: Error inflating class com.dd.CircularProgressButton
at android.view.LayoutInflater.createView(LayoutInflater.java:645)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:764)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:704)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:835)
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:798)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:838)
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:798)
at android.view.LayoutInflater.parse
编辑:这是我们使用CircularProgressButton的XML格式。它在一段时间内没有改变。
<com.dd.CircularProgressButton
android:id="@+id/loginButton"
style="?android:attr/buttonBarButtonStyle"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_weight="0.7"
android:layout_marginTop="4dp"
android:layout_marginBottom="4dp"
android:elevation="2dp"
android:textColor="@android:color/white"
android:textSize="16sp"
app:cpb_colorIndicator="?attr/colorPrimary"
app:cpb_colorIndicatorBackground="@color/cpb_grey"
app:cpb_colorProgress="?android:colorBackground"
app:cpb_selectorIdle="?attr/colorPrimary"
app:cpb_textIdle="@string/login_btn" />
答案 0 :(得分:0)
在项目的build.gradle中,将gradle版本配置为2.3.3,对我有用。
buildscript {
// other codes
dependencies {
classpath 'com.android.tools.build:gradle:2.3.3'
}
}