1

所以我们最近将 buildToolsVersion 更新为 26.0.2 现在我们的代码在尝试创建 CircularProgressButton 时使用的 CircularProgressButton 库中崩溃(请参阅库,我知道我们使用不受支持的库得到了我们应得的)。

堆栈跟踪表明它是由 InflationException“Binary XML file line #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" />
4

1 回答 1

0

在项目的 build.gradle 中,将 gradle 版本配置为 2.3.3,它适用于我。

buildscript {
    // other codes

    dependencies {
        classpath 'com.android.tools.build:gradle:2.3.3'
    }
}
于 2018-06-30T16:05:46.020 回答