FATAL EXCEPTION: main Process: com.goom.project_532, PID: 25054 android.view.InflateException: Binary XML file

独自空忆成欢 提交于 2020-06-21 05:45:20

问题


In my scenario, I am using custom seekbar module and I have fragment_one_control and fragment_two_control both xml file I am using. Here, fragment_one_control to using include tag and referring fragment_two_control. Then from fragment_two_control I am calling my custom module seekbar. Here, Android 9 and below version working fine but I am getting crash in Android 10. How to resolve it?

Crash Details

2020-06-13 15:36:44.462 25054-25054/com.goom.project_532 E/AndroidRuntime: FATAL EXCEPTION: main
    Process: com.goom.project_532, PID: 25054
    android.view.InflateException: Binary XML file line #120 in com.goom.project_532:layout/fragment_one_control: Binary XML file line #58 in com.goom.project_532:layout/fragment_two_control:: Error inflating class com.kimso.sims.CustomSeekBar
    Caused by: android.view.InflateException: Binary XML file line #58 in com.goom.project_532:layout/fragment_two_control:: Error inflating class com.kimso.sims.CustomSeekBar
    Caused by: java.lang.reflect.InvocationTargetException
        at java.lang.reflect.Constructor.newInstance0(Native Method)
        at java.lang.reflect.Constructor.newInstance(Constructor.java:343)
        at android.view.LayoutInflater.createView(LayoutInflater.java:854)
        at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:1006)
        at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:961)
        at android.view.LayoutInflater.rInflate(LayoutInflater.java:1123)
        at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:1084)
        at android.view.LayoutInflater.rInflate(LayoutInflater.java:1126)
        at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:1084)
        at android.view.LayoutInflater.parseInclude(LayoutInflater.java:1263)
        at android.view.LayoutInflater.rInflate(LayoutInflater.java:1119)
        at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:1084)
        at android.view.LayoutInflater.rInflate(LayoutInflater.java:1126)
        at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:1084)
        at android.view.LayoutInflater.rInflate(LayoutInflater.java:1126)
        at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:1084)
        at android.view.LayoutInflater.inflate(LayoutInflater.java:682)
        at android.view.LayoutInflater.inflate(LayoutInflater.java:534)
        at com.semcon.jimsa.cfx.fragment.gymControlFragment.onCreateView(gymControlFragment.java:407)
        at androidx.fragment.app.Fragment.performCreateView(Fragment.java:2439)
        at androidx.fragment.app.FragmentManagerImpl.moveToState(FragmentManager.java:1460)
        at androidx.fragment.app.FragmentManagerImpl.moveFragmentToExpectedState(FragmentManager.java:1784)
        at androidx.fragment.app.FragmentManagerImpl.moveToState(FragmentManager.java:1852)
        at androidx.fragment.app.BackStackRecord.executeOps(BackStackRecord.java:802)
        at androidx.fragment.app.FragmentManagerImpl.executeOps(FragmentManager.java:2625)
        at androidx.fragment.app.FragmentManagerImpl.executeOpsTogether(FragmentManager.java:2411)
        at androidx.fragment.app.FragmentManagerImpl.removeRedundantOperationsAndExecute(FragmentManager.java:2366)
        at androidx.fragment.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:2273)
        at androidx.fragment.app.FragmentManagerImpl.dispatchStateChange(FragmentManager.java:3273)
        at androidx.fragment.app.FragmentManagerImpl.dispatchActivityCreated(FragmentManager.java:3229)
        at androidx.fragment.app.FragmentController.dispatchActivityCreated(FragmentController.java:201)
        at androidx.fragment.app.FragmentActivity.onStart(FragmentActivity.java:620)
        at androidx.appcompat.app.AppCompatActivity.onStart(AppCompatActivity.java:178)
        at com.semcon.jimsa.roboguicehelper.KubaAppCompatActivity.onStart(KubaAppCompatActivity.java:141)
        at android.app.Instrumentation.callActivityOnStart(Instrumentation.java:1433)
        at android.app.Activity.performStart(Activity.java:7978)
        at android.app.ActivityThread.handleStartActivity(ActivityThread.java:3512)
        at android.app.servertransaction.TransactionExecutor.performLifecycleSequence(TransactionExecutor.java:221)
        at android.app.servertransaction.TransactionExecutor.cycleToPath(TransactionExecutor.java:201)
        at android.app.servertransaction.TransactionExecutor.executeLifecycleState(TransactionExecutor.java:173)
        at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:97)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2175)
2020-06-13 15:36:44.464 25054-25054/com.goom.project_532 E/AndroidRuntime:     at android.os.Handler.dispatchMessage(Handler.java:107)
        at android.os.Looper.loop(Looper.java:237)
        at android.app.ActivityThread.main(ActivityThread.java:7860)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1075)
     Caused by: java.lang.NullPointerException: Attempt to invoke interface method 'void java.util.List.clear()' on a null object reference
        at android.widget.AbsSeekBar.updateGestureExclusionRects(AbsSeekBar.java:1001)
        at android.widget.AbsSeekBar.setThumbPos(AbsSeekBar.java:985)
        at android.widget.AbsSeekBar.updateThumbAndTrackPos(AbsSeekBar.java:878)
        at android.widget.AbsSeekBar.updateDrawableBounds(AbsSeekBar.java:1942)
        at android.widget.ProgressBar.onSizeChanged(ProgressBar.java:2196)
        at android.widget.AbsSeekBar.onSizeChanged(AbsSeekBar.java:837)
        at com.kimso.sims.CustomSeekBar.onSizeChanged(jimsaSeekBar.java:242)
        at com.kimso.sims.CustomSeekBar.setProgressInternally(jimsaSeekBar.java:435)
        at com.kimso.sims.CustomSeekBar.setProgress(jimsaSeekBar.java:312)
        at android.widget.ProgressBar.<init>(ProgressBar.java:376)
        at android.widget.AbsSeekBar.<init>(AbsSeekBar.java:184)
        at android.widget.SeekBar.<init>(SeekBar.java:89)
        at android.widget.SeekBar.<init>(SeekBar.java:85)
        at android.widget.SeekBar.<init>(SeekBar.java:81)
        at com.kimso.sims.CustomSeekBar.<init>(jimsaSeekBar.java:82)
            ... 48 more

fragment_one_control.xml

 <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginTop="16dp"
        android:layout_gravity="center"
        android:layout_below="@id/errors_layout"
        android:gravity="center"
        android:orientation="horizontal"
        android:weightSum="10">
        <FrameLayout
            android:id="@+id/compartment1"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_weight="5"
            android:layout_gravity="center"
            android:gravity="center">
            <include
                layout="@layout/fragment_two_control"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_gravity="center"
                android:gravity="center"/>
        </FrameLayout>
        <View
            android:id="@+id/demo”
            android:layout_width="1dp"
            android:layout_height="match_parent"
            android:layout_margin="6dp"
            android:background="@color/colorDivider"
            android:visibility="visible"/>
        <FrameLayout
            android:id="@+id/demo2”
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_weight="5"
            android:layout_gravity="center"
            android:gravity="center"
            android:visibility="visible">
<!--            <include-->
<!--                layout="@layout/fragment_two_control"-->
<!--                android:layout_width="match_parent"-->
<!--                android:layout_height="wrap_content"-->
<!--                android:layout_gravity="center"-->
<!--                android:gravity="center"/>-->
        </FrameLayout>
    </LinearLayout>

fragment_two_control.xml

<com.kimso.sims.CustomSeekBar
    android:id="@+id/compartment_sb"
    android:layout_width="36dp"
    android:layout_height="122dp"
    android:orientation="vertical"
    app:startProgress="0"
    app:minDisplayableValue=“-10”
    app:maxDisplayableValue="11”
    app:textSize="10sp"
    app:backgroundColor="@color/colorSliderBackground"
    app:tintColor="@color/colorButton"
    app:disabledColor="@color/colorThumbDimmed"/>

来源:https://stackoverflow.com/questions/62358427/fatal-exception-main-process-com-goom-project-532-pid-25054-android-view-inf

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!