skydoves / Balloon

:balloon: Modernized and sophisticated tooltips, fully customizable with an arrow and animations for Android.
https://skydoves.github.io/libraries/balloon/html/balloon/com.skydoves.balloon/index.html
Apache License 2.0
3.75k stars 292 forks source link

Crash with AppCompatImageView in balloon_layout_body.xml on some devices #412

Closed guahirah closed 1 year ago

guahirah commented 1 year ago

Crash log on Firebase

Fatal Exception: android.view.InflateException Binary XML file line #67 in xxx.xxx.xxx:layout/balloon_layout_body: Binary XML file line #67 in xxx.xxx.xxx:layout/balloon_layout_body: Error inflating class androidx.appcompat.widget.AppCompatImageView

Web capture_18-1-2023_23519_console firebase google com

skydoves commented 1 year ago

Hey @guahirah, could you please check does your app theme is based on AppCompat or Material?

For example. I'm also wondering if you're using it in a Jetpack Compose project.

  <style name="Theme.ChatGPTAndroid" parent="Theme.AppCompat.DayNight.NoActionBar">
    <item name="android:statusBarColor">@color/green_darker</item>
  </style>
guahirah commented 1 year ago

Hey @skydoves I'm not using Jetpack Compose, my app theme is based on Material3.

<style name="App.Theme" parent="Theme.Material3.DayNight.NoActionBar"/>

AppCompat version: androidx.appcompat:appcompat:1.7.0-alpha01

I can't reproduce the crash with my device or the emulator. It only happened to some users, catch by Firebase. Thank you

cp-radhika-s commented 1 year ago

Any update on this @skydoves? I'm facing the same issue.

skydoves commented 1 year ago

Hey @guahirah , @cp-radhika-s, would you guys can check if your app module project's gradle allows vector resource like the below? https://developer.android.com/develop/ui/views/graphics/vector-drawable-resources

vectorDrawables.useSupportLibrary = true

The default source of the arrow is a vector image.

guahirah commented 1 year ago

Hey @skydoves, I don't use it since my app minSdkVersion 21

I'm also using a vector image with src, and it works fine. I think the problem is with srcCompat

guahirah commented 1 year ago

Also, i'm hide the arrow

setArrowSize(0)
setIsVisibleArrow(false)
egorikftp commented 1 year ago

The same issue on some devices:

Fatal Exception: android.view.InflateException: Binary XML file line #67: Binary XML file line #67: Error inflating class androidx.appcompat.widget.AppCompatImageView

I use Theme.MaterialComponents.DayNight.NoActionBar with full Compose app.

Souce: https://github.com/egorikftp/GrodnoRoads Ballow usage: https://github.com/egorikftp/GrodnoRoads/blob/release/features/map/map-ui/src/main/kotlin/com/egoriku/grodnoroads/map/foundation/UsersCount.kt

skydoves commented 1 year ago

Thanks for providing the crash messages! I will increment the min sdk of Balloon to 21 because version 21 supports most devices. Then we don't need to use AppCompatImageView and 'srcCompat' to support under SDK version 21.

image (1)

skydoves commented 1 year ago

Balloon 1.5.3 has been released!