Closed aajakey closed 2 years ago
I also have the same issue, however, removing the recycler view's ID didn't solve the exception in my case. My app works fine with it and I have no issues during build time nor runtime. The exception occurs when the app is running for a larger amount of time in the background and the Android OS claims it's resources, i.e. the app state is stored. Next time the app is launched, the exception occurs during restoration of the state.
My XML structure is the same as above, the only difference is that I used a Relative instead of a Linear Layout.
It was really hard to pinpoint where this exception comes from, since the stack trace doesn't point to the library at all (see full trace below).
I was able to repeatedly reproduce this issue by enabling the "Don't keep activities" option in Settings - Developer options - Section Apps.
Unfortunately I couldn't find a workaround for this and had to remove the library from the app for now.
Here is the stack trace of the exception:
java.lang.RuntimeException: Parcel android.os.Parcel@eb77bb1: Unmarshalling unknown type code 2131296357 at offset 416
at android.os.Parcel.readValue(Parcel.java:3253)
at android.os.Parcel.readSparseArrayInternal(Parcel.java:3650)
at android.os.Parcel.readSparseArray(Parcel.java:2792)
at android.os.Parcel.readValue(Parcel.java:3231)
at android.os.Parcel.readArrayMapInternal(Parcel.java:3567)
at android.os.BaseBundle.initializeFromParcelLocked(BaseBundle.java:292)
at android.os.BaseBundle.unparcel(BaseBundle.java:236)
at android.os.Bundle.getSparseParcelableArray(Bundle.java:1079)
at com.android.internal.policy.PhoneWindow.restoreHierarchyState(PhoneWindow.java:2179)
at android.app.Activity.onRestoreInstanceState(Activity.java:1679)
at android.app.Activity.performRestoreInstanceState(Activity.java:1632)
at android.app.Instrumentation.callActivityOnRestoreInstanceState(Instrumentation.java:1356)
at android.app.ActivityThread.handleStartActivity(ActivityThread.java:3491)
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:2066)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:223)
at android.app.ActivityThread.main(ActivityThread.java:7656)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947)
I've run into a similar issue, but it seems that my exception is slightly different.
android.view.InflateException: Error inflating class <unknown>
Caused by: android.view.InflateException: Binary XML file line #71 in layout/fragment_dashboard: Error inflating class <unknown>
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:852)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:1004)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:959)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:1121)
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:1082)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:1124)
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:1082)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:1124)
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:1082)
at android.view.LayoutInflater.inflate(LayoutInflater.java:680)
at android.view.LayoutInflater.inflate(LayoutInflater.java:532)
at androidx.databinding.DataBindingUtil.inflate(DataBindingUtil.java:126)
at androidx.databinding.DataBindingUtil.inflate(DataBindingUtil.java:95)
at com.nek.respawn.view.DataBindingFragment.onCreateView(DataBindingFragment.kt:25)
at androidx.fragment.app.Fragment.performCreateView(Fragment.java:2961)
at androidx.fragment.app.FragmentStateManager.createView(FragmentStateManager.java:504)
at androidx.fragment.app.FragmentStateManager.moveToExpectedState(FragmentStateManager.java:259)
at androidx.fragment.app.FragmentManager.executeOpsTogether(FragmentManager.java:1793)
at androidx.fragment.app.FragmentManager.removeRedundantOperationsAndExecute(FragmentManager.java:1717)
at androidx.fragment.app.FragmentManager.execPendingActions(FragmentManager.java:1654)
at androidx.fragment.app.FragmentManager$4.run(FragmentManager.java:488)
at android.os.Handler.handleCallback(Handler.java:938)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:233)
at android.app.ActivityThread.main(ActivityThread.java:8010)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:631)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:978)
Caused by: java.lang.IllegalArgumentException: Spring stiffness constant must be positive.
at androidx.dynamicanimation.animation.SpringForce.setStiffness(SpringForce.java:138)
at com.factor.bouncy.BouncyRecyclerView.setupDirection(BouncyRecyclerView.kt:125)
at com.factor.bouncy.BouncyRecyclerView.setOrientation(BouncyRecyclerView.kt:30)
at com.factor.bouncy.BouncyRecyclerView.setLayoutManager(BouncyRecyclerView.kt:103)android.view.InflateException: Binary XML file line #71 in com.nek.respawn.debug:layout/fragment_dashboard: Binary XML file line #71 in com.nek.respawn.debug:layout/fragment_dashboard: Error inflating class <unknown>
Caused by: android.view.InflateException: Binary XML file line #71 in com.nek.respawn.debug:layout/fragment_dashboard: Error inflating class <unknown> //points to bouncyrecyclerview
Caused by: java.lang.reflect.InvocationTargetException
at java.lang.reflect.Constructor.newInstance0(Native Method)
//junk...
Caused by: java.lang.IllegalArgumentException: Spring stiffness constant must be positive.
at androidx.dynamicanimation.animation.SpringForce.setStiffness(SpringForce.java:138)
at com.factor.bouncy.BouncyRecyclerView.setupDirection(BouncyRecyclerView.kt:125)
at com.factor.bouncy.BouncyRecyclerView.setOrientation(BouncyRecyclerView.kt:30)
at com.factor.bouncy.BouncyRecyclerView.setLayoutManager(BouncyRecyclerView.kt:103)
//junk...
Especially interesting is this line: Caused by: java.lang.IllegalArgumentException: Spring stiffness constant must be positive.
Killing the app through logcat and opening it again throws this exception
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.andric.app/com.andric.app.MainActivity}: java.lang.RuntimeException: Parcel android.os.Parcel@2920ae7: Unmarshalling unknown type code 2131296744 at offset 1040 at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3792) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3968) at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:85) at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135) at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2307) at android.os.Handler.dispatchMessage(Handler.java:106) at android.os.Looper.loop(Looper.java:246) at android.app.ActivityThread.main(ActivityThread.java:8506) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:602) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1139) Caused by: java.lang.RuntimeException: Parcel android.os.Parcel@2920ae7: Unmarshalling unknown type code 2131296744 at offset 1040 at android.os.Parcel.readValue(Parcel.java:3265) at android.os.Parcel.readSparseArrayInternal(Parcel.java:3662) at android.os.Parcel.readSparseArray(Parcel.java:2804) at android.os.Parcel.readValue(Parcel.java:3243) at android.os.Parcel.readArrayMapInternal(Parcel.java:3579) at android.os.BaseBundle.initializeFromParcelLocked(BaseBundle.java:292) at android.os.BaseBundle.unparcel(BaseBundle.java:236) at android.os.Bundle.getSparseParcelableArray(Bundle.java:1079) at androidx.fragment.app.FragmentStateManager.restoreState(FragmentStateManager.java:405) at androidx.fragment.app.FragmentManager.restoreSaveState(FragmentManager.java:2733) at androidx.fragment.app.FragmentController.restoreSaveState(FragmentController.java:198) at androidx.fragment.app.FragmentActivity$2.onContextAvailable(FragmentActivity.java:149) at androidx.activity.contextaware.ContextAwareHelper.dispatchOnContextAvailable(ContextAwareHelper.java:99) at androidx.activity.ComponentActivity.onCreate(ComponentActivity.java:293) at androidx.fragment.app.FragmentActivity.onCreate(FragmentActivity.java:273) at androidx.appcompat.app.AppCompatActivity.onCreate(AppCompatActivity.java:115) at com.andric.app.MainActivity.onCreate(MainActivity.kt:53) at android.app.Activity.performCreate(Activity.java:8198) at android.app.Activity.performCreate(Activity.java:8182) at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1309) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3765) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3968) at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:85) at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135) at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2307) at android.os.Handler.dispatchMessage(Handler.java:106) at android.os.Looper.loop(Looper.java:246) at android.app.ActivityThread.main(ActivityThread.java:8506) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:602) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1139)
The problem is in the xml layout, specifically the id of the RecyclerView. Removing it no longer causes the exception.
<com.factor.bouncy.BouncyNestedScrollView android:id="@+id/nested_scroll_view" android:layout_width="match_parent" android:layout_height="match_parent" app:damping_ratio="DAMPING_RATIO_LOW_BOUNCY" app:fling_animation_size=".2" app:layout_behavior="com.google.android.material.appbar.AppBarLayout$ScrollingViewBehavior" app:overscroll_animation_size=".2" app:stiffness="STIFFNESS_LOW"> <LinearLayout android:id="@+id/linear_root" android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="vertical"> <androidx.recyclerview.widget.RecyclerView android:id="@+id/recycler_view" android:layout_width="match_parent" android:layout_height="181dp" android:nestedScrollingEnabled="false" android:orientation="horizontal" android:overScrollMode="never" android:paddingHorizontal="20dp" android:paddingVertical="10dp" app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager" app:reverseLayout="false" /> ... </LinearLayout> </com.factor.bouncy.BouncyNestedScrollView>
I've run into a similar issue, but it seems that my exception is slightly different.
android.view.InflateException: Error inflating class <unknown> Caused by: android.view.InflateException: Binary XML file line #71 in layout/fragment_dashboard: Error inflating class <unknown> 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:852) at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:1004) at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:959) at android.view.LayoutInflater.rInflate(LayoutInflater.java:1121) at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:1082) at android.view.LayoutInflater.rInflate(LayoutInflater.java:1124) at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:1082) at android.view.LayoutInflater.rInflate(LayoutInflater.java:1124) at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:1082) at android.view.LayoutInflater.inflate(LayoutInflater.java:680) at android.view.LayoutInflater.inflate(LayoutInflater.java:532) at androidx.databinding.DataBindingUtil.inflate(DataBindingUtil.java:126) at androidx.databinding.DataBindingUtil.inflate(DataBindingUtil.java:95) at com.nek.respawn.view.DataBindingFragment.onCreateView(DataBindingFragment.kt:25) at androidx.fragment.app.Fragment.performCreateView(Fragment.java:2961) at androidx.fragment.app.FragmentStateManager.createView(FragmentStateManager.java:504) at androidx.fragment.app.FragmentStateManager.moveToExpectedState(FragmentStateManager.java:259) at androidx.fragment.app.FragmentManager.executeOpsTogether(FragmentManager.java:1793) at androidx.fragment.app.FragmentManager.removeRedundantOperationsAndExecute(FragmentManager.java:1717) at androidx.fragment.app.FragmentManager.execPendingActions(FragmentManager.java:1654) at androidx.fragment.app.FragmentManager$4.run(FragmentManager.java:488) at android.os.Handler.handleCallback(Handler.java:938) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loop(Looper.java:233) at android.app.ActivityThread.main(ActivityThread.java:8010) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:631) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:978) Caused by: java.lang.IllegalArgumentException: Spring stiffness constant must be positive. at androidx.dynamicanimation.animation.SpringForce.setStiffness(SpringForce.java:138) at com.factor.bouncy.BouncyRecyclerView.setupDirection(BouncyRecyclerView.kt:125) at com.factor.bouncy.BouncyRecyclerView.setOrientation(BouncyRecyclerView.kt:30) at com.factor.bouncy.BouncyRecyclerView.setLayoutManager(BouncyRecyclerView.kt:103)android.view.InflateException: Binary XML file line #71 in com.nek.respawn.debug:layout/fragment_dashboard: Binary XML file line #71 in com.nek.respawn.debug:layout/fragment_dashboard: Error inflating class <unknown> Caused by: android.view.InflateException: Binary XML file line #71 in com.nek.respawn.debug:layout/fragment_dashboard: Error inflating class <unknown> //points to bouncyrecyclerview Caused by: java.lang.reflect.InvocationTargetException at java.lang.reflect.Constructor.newInstance0(Native Method) //junk... Caused by: java.lang.IllegalArgumentException: Spring stiffness constant must be positive. at androidx.dynamicanimation.animation.SpringForce.setStiffness(SpringForce.java:138) at com.factor.bouncy.BouncyRecyclerView.setupDirection(BouncyRecyclerView.kt:125) at com.factor.bouncy.BouncyRecyclerView.setOrientation(BouncyRecyclerView.kt:30) at com.factor.bouncy.BouncyRecyclerView.setLayoutManager(BouncyRecyclerView.kt:103) //junk...
Especially interesting is this line: Caused by: java.lang.IllegalArgumentException: Spring stiffness constant must be positive.
I also have the same issue, however, removing the recycler view's ID didn't solve the exception in my case. My app works fine with it and I have no issues during build time nor runtime. The exception occurs when the app is running for a larger amount of time in the background and the Android OS claims it's resources, i.e. the app state is stored. Next time the app is launched, the exception occurs during restoration of the state.
My XML structure is the same as above, the only difference is that I used a Relative instead of a Linear Layout.
It was really hard to pinpoint where this exception comes from, since the stack trace doesn't point to the library at all (see full trace below).
I was able to repeatedly reproduce this issue by enabling the "Don't keep activities" option in Settings - Developer options - Section Apps.
Unfortunately I couldn't find a workaround for this and had to remove the library from the app for now.
Here is the stack trace of the exception:
java.lang.RuntimeException: Parcel android.os.Parcel@eb77bb1: Unmarshalling unknown type code 2131296357 at offset 416 at android.os.Parcel.readValue(Parcel.java:3253) at android.os.Parcel.readSparseArrayInternal(Parcel.java:3650) at android.os.Parcel.readSparseArray(Parcel.java:2792) at android.os.Parcel.readValue(Parcel.java:3231) at android.os.Parcel.readArrayMapInternal(Parcel.java:3567) at android.os.BaseBundle.initializeFromParcelLocked(BaseBundle.java:292) at android.os.BaseBundle.unparcel(BaseBundle.java:236) at android.os.Bundle.getSparseParcelableArray(Bundle.java:1079) at com.android.internal.policy.PhoneWindow.restoreHierarchyState(PhoneWindow.java:2179) at android.app.Activity.onRestoreInstanceState(Activity.java:1679) at android.app.Activity.performRestoreInstanceState(Activity.java:1632) at android.app.Instrumentation.callActivityOnRestoreInstanceState(Instrumentation.java:1356) at android.app.ActivityThread.handleStartActivity(ActivityThread.java:3491) 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:2066) at android.os.Handler.dispatchMessage(Handler.java:106) at android.os.Looper.loop(Looper.java:223) at android.app.ActivityThread.main(ActivityThread.java:7656) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947)
Hello, does the problem still exist?
Killing the app through logcat and opening it again throws this exception
The problem is in the xml layout, specifically the id of the RecyclerView. Removing it no longer causes the exception.