zhihu / Matisse

:fireworks: A well-designed local image and video selector for Android
Apache License 2.0
12.52k stars 2.07k forks source link

MatisseActivity : android.view.InflateException #829

Open jayakrishnan-pm opened 3 years ago

jayakrishnan-pm commented 3 years ago

InflateException in v0.5.3-beta3

New crash reported in the latest beta version of the library. My live app's stability has been affected by this exception and many exceptions are keeping coming. Kindly advice for a solution. Thanks in advance.

Lib Version : v0.5.3-beta3 (Prev version: v0.5.2) Android Version: 10, API Level 29 Device: OPPO CPH1723

com.zhihu.matisse.ui.MatisseActivity}: android.view.InflateException: Binary XML file line #33: Binary XML file line #33: Error inflating class TextView
       at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2904)
       at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2969)
       at android.app.ActivityThread.-wrap12(ActivityThread.java)
       at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1691)
       at android.os.Handler.dispatchMessage(Handler.java:110)
       at android.os.Looper.loop(Looper.java:232)
       at android.app.ActivityThread.main(ActivityThread.java:6699)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1103)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:964)

Steps to reproduce App crashes when calling the following method on button click,

Matisse.from(getActivity())
                    .choose(MimeType.ofImage(), false)
                    .theme(R.style.GalleryBrowseTheme)
                    .countable(false)
                    .showSingleMediaType(true)
                    .maxSelectable(1)
                    .restrictOrientation(ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED)
                    .thumbnailScale(0.85f)
                    .imageEngine(new Glide4Engine())
                    .forResult(REQUEST_CODE_CHOOSE);
zdd commented 3 years ago

Same with you, this only happened when you use your own theme, how to fix this?

jayakrishnan-pm commented 3 years ago

@zdd Below is the customized theme used in the code.

<style name="GalleryBrowseTheme" parent="Matisse.Zhihu">
        <item name="colorPrimary">@color/colorPrimary</item>
        <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
    </style>
zdd commented 3 years ago

@zdd Below is the customized theme used in the code.

<style name="GalleryBrowseTheme" parent="Matisse.Zhihu">
        <item name="colorPrimary">@color/colorPrimary</item>
        <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
    </style>

thank you, it works