Skip to content

fix(android): ScrollView BadParcelableException #10213

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Feb 17, 2023

Conversation

CatchABus
Copy link
Contributor

@CatchABus CatchABus commented Feb 14, 2023

PR Checklist

What is the current behavior?

Android scroll view throws BadParcelableException on state restore.

What is the new behavior?

Android restores scroll view position state properly.
This also fixes:

  • A problem that caused HorizontalScrollView restore value not to apply
  • A related NPE in GridLayout when it's nesting a scroll view

Reference: https://stackoverflow.com/a/59299710
Fixes/Implements/Closes #10200 .

@nx-cloud
Copy link

nx-cloud bot commented Feb 14, 2023

☁️ Nx Cloud Report

CI is running/has finished running commands for commit 1e33caa. As they complete they will appear below. Click to see the status, the terminal output, and the build insights.

📂 See all runs for this branch


✅ Successfully ran 2 targets

Sent with 💌 from NxCloud.

@jcassidyav
Copy link
Contributor

Looks Good here.

@NathanWalker NathanWalker added this to the 8.5 milestone Feb 16, 2023
@NathanWalker NathanWalker merged commit a26a03e into NativeScript:main Feb 17, 2023
@SeanKelly369
Copy link

Our QA tester ran into the following error and it cause the app to crash after being left idle overnight and left running in the background. We are unfortunately unable to ascertain where exactly the exception was thrown.

Error: ClassNotFoundException when unmarshalling: androidx.core.widget.NestedScrollView$SavedState

@CatchABus
Copy link
Contributor Author

Our QA tester ran into the following error and it cause the app to crash after being left idle overnight and left running in the background. We are unfortunately unable to ascertain where exactly the exception was thrown.

Error: ClassNotFoundException when unmarshalling: androidx.core.widget.NestedScrollView$SavedState

This fix isn't included in 8.4.7. Should be available in 8.4.8-next releases though.

@SeanKelly369
Copy link

I'm using 8.5.0 beta. Hopefully, the fix will be in this version when it is out soon. Ran into a similar crash just now when opening a pdf from a link in the app.

@jcassidyav
Copy link
Contributor

jcassidyav commented Mar 3, 2023

Just to be clear, what version of @nativescript/core are you running I don't see a 8.5 beta of core, 8.4.8-next will have the fix.

@SeanKelly369
Copy link

Ah, I see. It is a nativescript/core issue. I'm on 8.4.7

@NathanWalker
Copy link
Contributor

You can use @nativescript/core next or alpha to fix this - 8.5 is set to release before March 31st.

@CatchABus
Copy link
Contributor Author

Stacktrace from one of the crashes ->

An uncaught Exception occurred on "main" thread. Unable to resume activity {com.app.place/com.tns.NativeScriptActivity}: com.tns.NativeScriptException: Calling js method onCreateView failed Error: java.lang.NoSuchMethodError: no non-static method "Landroid/view/View;.setFocusable(Ljava/lang/String;)Ljava/io/File;"

StackTrace: java.lang.RuntimeException: Unable to resume activity {com.app.place/com.tns.NativeScriptActivity}: com.tns.NativeScriptException: Calling js method onCreateView failed Error: java.lang.NoSuchMethodError: no non-static method "Landroid/view/View;.setFocusable(Ljava/lang/String;)Ljava/io/File;" at android.app.ActivityThread.performResumeActivity(ActivityThread.java:4001) at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:4033) at android.app.servertransaction.ResumeActivityItem.execute(ResumeActivityItem.java:51) at android.app.servertransaction.TransactionExecutor.executeLifecycleState(TransactionExecutor.java:145) at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:70) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1977) at android.os.Handler.dispatchMessage(Handler.java:106) at android.os.Looper.loop(Looper.java:193) at android.app.ActivityThread.main(ActivityThread.java:6923) 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:870) Caused by: com.tns.NativeScriptException: Calling js method onCreateView failed Error: java.lang.NoSuchMethodError: no non-static method "Landroid/view/View;.setFocusable(Ljava/lang/String;)Ljava/io/File;" at com.tns.Runtime.callJSMethodNative(Native Method) at com.tns.Runtime.dispatchCallJSMethodNative(Runtime.java:1302) at com.tns.Runtime.callJSMethodImpl(Runtime.java:1188) at com.tns.Runtime.callJSMethod(Runtime.java:1175) at com.tns.Runtime.callJSMethod(Runtime.java:1153) at com.tns.Runtime.callJSMethod(Runtime.java:1149) at com.tns.FragmentClass.onCreateView(FragmentClass.java:55) at androidx.fragment.app.Fragment.performCreateView(Fragment.java:3104) at androidx.fragment.app.FragmentStateManager.createView(FragmentStateManager.java:524) at androidx.fragment.app.FragmentStateManager.moveToExpectedState(FragmentStateManager.java:261) at androidx.fragment.app.FragmentManager.executeOpsTogether(FragmentManager.java:1899) at androidx.fragment.app.FragmentManager.removeRedundantOperationsAndExecute(FragmentManager.java:1817) at androidx.fragment.app.FragmentManager.execPendingActions(FragmentManager.java:1760) at androidx.fragment.app.FragmentController.execPendingActions(FragmentController.java:495) at androidx.fragment.app.FragmentActivity.onResume(FragmentActivity.java:312) at android.app.Instrumentation.callActivityOnResume(Instrumentation.java:1434) at android.app.Activity.performResume(Activity.java:7304) at android.app.ActivityThread.performResumeActivity(ActivityThread.java:3993) ... 11 more Caused by: java.lang.NoSuchMethodError: no non-static method "Landroid/view/View;.setFocusable(Ljava/lang/String;)Ljava/io/File;" ... 29 more

This PR is already merged so let's post that stuff in the initial issue. #10239

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Android][NS 8.4] Exception thrown when restoring state for ScrollView
4 participants