On certain android phones, users are getting the following exception. I tried multiple solutions available on Google and stack overflow but none seem to be working.
This is the exact exception from firebase crashlytics
android.view.ViewGroup.offsetRectBetweenParentAndChild (ViewGroup.java:6458)
android.view.ViewGroup.offsetDescendantRectToMyCoords (ViewGroup.java:6383)
android.widget.ScrollView.isWithinDeltaOfScreen (ScrollView.java:1323)
android.widget.ScrollView.onSizeChanged (ScrollView.java:1738)
android.view.View.sizeChange (View.java:23682)
android.view.View.setFrame (View.java:23634)
android.view.View.layout (View.java:23483)
android.view.ViewGroup.layout (ViewGroup.java:6575)
android.widget.FrameLayout.layoutChildren (FrameLayout.java:332)
android.widget.FrameLayout.onLayout (FrameLayout.java:270)
android.view.View.layout (View.java:23488)
android.view.ViewGroup.layout (ViewGroup.java:6575)
android.widget.RelativeLayout.onLayout (RelativeLayout.java:1103)
android.view.View.layout (View.java:23488)
android.view.ViewGroup.layout (ViewGroup.java:6575)
android.widget.FrameLayout.layoutChildren (FrameLayout.java:332)
android.widget.FrameLayout.onLayout (FrameLayout.java:270)
android.view.View.layout (View.java:23488)
android.view.ViewGroup.layout (ViewGroup.java:6575)
android.widget.LinearLayout.setChildFrame (LinearLayout.java:1841)
android.widget.LinearLayout.layoutVertical (LinearLayout.java:1673)
android.widget.LinearLayout.onLayout (LinearLayout.java:1582)
android.view.View.layout (View.java:23488)
android.view.ViewGroup.layout (ViewGroup.java:6575)
android.widget.FrameLayout.layoutChildren (FrameLayout.java:332)
android.widget.FrameLayout.onLayout (FrameLayout.java:270)
android.view.View.layout (View.java:23488)
android.view.ViewGroup.layout (ViewGroup.java:6575)
android.widget.LinearLayout.setChildFrame (LinearLayout.java:1841)
android.widget.LinearLayout.layoutVertical (LinearLayout.java:1673)
android.widget.LinearLayout.onLayout (LinearLayout.java:1582)
android.view.View.layout (View.java:23488)
android.view.ViewGroup.layout (ViewGroup.java:6575)
android.widget.FrameLayout.layoutChildren (FrameLayout.java:332)
android.widget.FrameLayout.onLayout (FrameLayout.java:270)
com.android.internal.policy.DecorView.onLayout (DecorView.java:867)
android.view.View.layout (View.java:23488)
android.view.ViewGroup.layout (ViewGroup.java:6575)
android.view.ViewRootImpl.performLayout (ViewRootImpl.java:4119)
android.view.ViewRootImpl.performTraversals (ViewRootImpl.java:3495)
android.view.ViewRootImpl.doTraversal (ViewRootImpl.java:2416)
android.view.ViewRootImpl$TraversalRunnable.run (ViewRootImpl.java:9478)
android.view.Choreographer$CallbackRecord.run (Choreographer.java:1242)
android.view.Choreographer.doCallbacks (Choreographer.java:996)
android.view.ChoreographerExtImpl.checkScrollOptSceneEnable (ChoreographerExtImpl.java:383)
android.view.Choreographer.doFrame (Choreographer.java:865)
android.view.Choreographer$FrameDisplayEventReceiver.run (Choreographer.java:1227)
android.os.Handler.handleCallback (Handler.java:938)
android.os.Handler.dispatchMessage (Handler.java:99)
android.os.Looper.loopOnce (Looper.java:233)
android.os.Looper.loop (Looper.java:344)
android.app.ActivityThread.main (ActivityThread.java:8248)
java.lang.reflect.Method.invoke (Method.java)
com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:589)
com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1071)
Here is my build.gradle configuration
apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'
apply plugin: 'com.google.firebase.crashlytics'
android {
compileSdkVersion 33
defaultConfig {
multiDexEnabled true
applicationId "com.packageName"
minSdkVersion 19
targetSdkVersion 33
versionCode "VERSION_CODE"
versionName "VERSION_NAME"
vectorDrawables.useSupportLibrary = true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility 1.8
targetCompatibility 1.8
}
namespace 'com.packageName'
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'androidx.appcompat:appcompat:1.5.1'
implementation 'androidx.core:core:1.9.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
implementation 'com.google.android.material:material:1.7.0'
implementation 'androidx.vectordrawable:vectordrawable:1.1.0'
implementation 'androidx.browser:browser:1.4.0'
implementation 'androidx.palette:palette:1.0.0'
implementation 'androidx.cardview:cardview:1.0.0'
implementation 'androidx.media:media:1.6.0'
implementation 'androidx.multidex:multidex:2.0.1'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'androidx.work:work-runtime:2.7.1'
implementation 'com.google.android.play:core:1.10.3'
implementation 'com.google.firebase:firebase-core:21.1.1'
implementation 'com.google.firebase:firebase-analytics:21.2.0'
implementation 'com.google.firebase:firebase-messaging:23.1.0'
implementation 'com.google.firebase:firebase-config:21.2.0'
implementation 'com.google.firebase:firebase-ads:21.3.0'
implementation 'com.google.firebase:firebase-crashlytics:18.3.1'
implementation 'com.android.volley:volley:1.2.1'
implementation 'com.google.code.gson:gson:2.8.6'
implementation 'org.jsoup:jsoup:1.11.3'
implementation 'com.facebook.shimmer:shimmer:0.4.0'
implementation 'com.synnapps:carouselview:0.1.5'
implementation 'com.squareup.picasso:picasso:2.5.2'
implementation 'saschpe.android:customtabs:2.0.3'
implementation 'com.mikhaellopez:circularfillableloaders:1.3.2'
implementation 'io.github.inflationx:calligraphy3:3.1.1'
implementation 'io.github.inflationx:viewpump:2.0.3'
}
Here is my xml layout
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent">
<androidx.coordinatorlayout.widget.CoordinatorLayout
android:id="@+id/main_content_layout"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_above="@+id/fragment_container">
<include
android:id="@+id/layoutToolbarOnly"
layout="@layout/template_toolbar_activity" />
<androidx.core.widget.NestedScrollView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@color/color_app_bg"
app:layout_behavior="@string/appbar_scrolling_view_behavior">
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:focusableInTouchMode="true"
android:orientation="vertical">
<include
android:id="@+id/errorContainer"
layout="@layout/error_contextual"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:visibility="gone" />
<LinearLayout
android:id="@+id/contentLayout"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="3dp"
android:layout_marginRight="3dp"
android:focusableInTouchMode="true"
android:orientation="vertical"
android:visibility="gone">
<include
layout="@layout/song_cover_image"
android:layout_width="fill_parent"
android:layout_height="210.0dp" />
<LinearLayout
android:id="@+id/cvPromotion"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:background="@color/colorWhite"
android:orientation="vertical"
android:padding="10dp"
android:visibility="gone">
<TextView
android:id="@+id/promotionHeader"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/txt_promotion_header"
android:textColor="@color/black_opaque_50" />
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recyclerView"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:clipToPadding="false" />
</LinearLayout>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:layout_marginBottom="3dp"
android:background="@color/colorWhite"
android:orientation="vertical"
android:padding="10dp">
<TextView
android:id="@+id/song_publisher_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/txt_warning_head"
android:textColor="@color/black_opaque_50" />
<TextView
style="@style/DetailSemiSmallStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="5.0dip"
android:text="@string/default_txt"
android:textColor="@color/black_opaque_80" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
</androidx.core.widget.NestedScrollView>
</androidx.coordinatorlayout.widget.CoordinatorLayout>
<FrameLayout
android:id="@+id/fragment_container"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true" />
</RelativeLayout>
I tried many ways explained in other stack overflow posts but none of those seem to be working. Most of the solutions available were pointed some EditText element but my layout doesn't have any EditText in it.
I'm not able to reproduce this crash. Any thoughts?