Skip to content
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

Fatal Exception: java.lang.IndexOutOfBoundsException: offset(1) should be less than line limit(0) #40722

Closed
chengweibo opened this issue Oct 9, 2023 · 9 comments
Labels
Needs: Repro This issue could be improved with a clear list of steps to reproduce the issue. Needs: Triage 🔍 Type: Too Old Version

Comments

@chengweibo
Copy link

chengweibo commented Oct 9, 2023

Description

Sumsung Galaxy A71 , Sumsung Galaxy A32, Sumsung Galaxy A53 phone the following crash occurs , hope to give me solution,thanks
Fatal Exception: java.lang.IndexOutOfBoundsException: offset(1) should be less than line limit(0)
at android.text.TextLine.measure(TextLine.java:389)
at android.text.Layout.getHorizontal(Layout.java:1254)
at android.text.Layout.getHorizontal(Layout.java:1230)
at android.text.Layout.getPrimaryHorizontal(Layout.java:1200)
at android.widget.TextView.bringPointIntoView(TextView.java:11046)
at android.widget.TextView.updateAfterEdit(TextView.java:11983)
at android.widget.Editor.finishBatchEdit(Editor.java:2086)
at android.widget.Editor.endBatchEdit(Editor.java:2068)
at android.widget.TextView.endBatchEdit(TextView.java:9931)
at android.widget.TextView.doKeyDown(TextView.java:9505)
at android.widget.TextView.onKeyDown(TextView.java:9275)
at android.view.KeyEvent.dispatch(KeyEvent.java:3508)
at android.view.View.dispatchKeyEvent(View.java:15395)
at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:1978)
at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:1978)
at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:1978)
at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:1978)
at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:1978)
at android.widget.ScrollView.dispatchKeyEvent(ScrollView.java:738)
at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:1978)
at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:1978)
at com.facebook.react.ReactRootView.dispatchKeyEvent(ReactRootView.java:234)
at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:1978)
at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:1978)
at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:1978)
at com.android.internal.policy.DecorView.superDispatchKeyEvent(DecorView.java:1100)
at com.android.internal.policy.PhoneWindow.superDispatchKeyEvent(PhoneWindow.java:1961)
at android.app.Activity.dispatchKeyEvent(Activity.java:4342)
at androidx.core.app.ComponentActivity.superDispatchKeyEvent(ComponentActivity.java:122)
at androidx.core.view.KeyEventDispatcher.dispatchKeyEvent(KeyEventDispatcher.java:84)
at androidx.core.app.ComponentActivity.dispatchKeyEvent(ComponentActivity.java:140)
at com.android.internal.policy.DecorView.dispatchKeyEvent(DecorView.java:924)
at android.view.ViewRootImpl$ViewPostImeInputStage.processKeyEvent(ViewRootImpl.java:8056)
at android.view.ViewRootImpl$ViewPostImeInputStage.onProcess(ViewRootImpl.java:7864)
at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:7213)
at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:7270)
at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:7236)
at android.view.ViewRootImpl$AsyncInputStage.forward(ViewRootImpl.java:7434)
at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:7244)
at android.view.ViewRootImpl$AsyncInputStage.apply(ViewRootImpl.java:7491)
at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:7217)
at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:7270)
at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:7236)
at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:7244)
at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:7217)
at android.view.ViewRootImpl.deliverInputEvent(ViewRootImpl.java:10788)
at android.view.ViewRootImpl.doProcessInputEvents(ViewRootImpl.java:10676)
at android.view.ViewRootImpl.enqueueInputEvent(ViewRootImpl.java:10632)
at android.view.ViewRootImpl$ViewRootHandler.handleMessageImpl(ViewRootImpl.java:6822)
at android.view.ViewRootImpl$ViewRootHandler.handleMessage(ViewRootImpl.java:6697)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loopOnce(Looper.java:226)
at android.os.Looper.loop(Looper.java:313)
at android.app.ActivityThread.main(ActivityThread.java:8757)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:571)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1067)

React Native Version

0.64.2

Output of npx react-native info

react native app

Steps to reproduce

react native app

Snack, screenshot, or link to a repository

react native app

@github-actions github-actions bot added Needs: Repro This issue could be improved with a clear list of steps to reproduce the issue. Type: Too Old Version labels Oct 9, 2023
@github-actions
Copy link

github-actions bot commented Oct 9, 2023

⚠️ Missing Reproducible Example
ℹ️ We could not detect a reproducible example in your issue report. Please provide either:
  • If your bug is UI related: a Snack
  • If your bug is build/update related: use our Reproducer Template. A reproducer needs to be in a GitHub repository under your username.

@github-actions
Copy link

github-actions bot commented Oct 9, 2023

⚠️ Too Old Version of React Native
ℹ️ It looks like your issue or the example you provided uses a Too Old Version of React Native.

Due to the number of issues we receive, we're currently only accepting new issues against one of the supported versions. Please upgrade to latest and verify if the issue persists (alternatively, create a new project and repro the issue in it). If you cannot upgrade, please open your issue on StackOverflow to get further community support.

@github-actions github-actions bot closed this as completed Oct 9, 2023
@mmehmet
Copy link

mmehmet commented Dec 13, 2023

I can add that this is also happening to us - very similar devices (Samsung a73xq and Samsung x1s)

we are using React Native 0.72.6

Exception java.lang.IndexOutOfBoundsException: offset(1) should be less than line limit(0)
  at android.text.TextLine.measure (TextLine.java:389)
  at android.text.Layout.getHorizontal (Layout.java:1254)
  at android.text.Layout.getHorizontal (Layout.java:1230)
  at android.text.Layout.getPrimaryHorizontal (Layout.java:1200)
  at android.widget.TextView.bringPointIntoView (TextView.java:11046)
  at android.widget.TextView.updateAfterEdit (TextView.java:11983)
  at android.widget.Editor.finishBatchEdit (Editor.java:2086)
  at android.widget.Editor.endBatchEdit (Editor.java:2068)
  at android.widget.TextView.endBatchEdit (TextView.java:9931)
  at android.widget.TextView.doKeyDown (TextView.java:9505)
  at android.widget.TextView.onKeyDown (TextView.java:9275)
  at android.view.KeyEvent.dispatch (KeyEvent.java:3508)
  at android.view.View.dispatchKeyEvent (View.java:15395)
  at android.view.ViewGroup.dispatchKeyEvent (ViewGroup.java:1978)
  at android.view.ViewGroup.dispatchKeyEvent (ViewGroup.java:1978)
  at android.view.ViewGroup.dispatchKeyEvent (ViewGroup.java:1978)
  at android.view.ViewGroup.dispatchKeyEvent (ViewGroup.java:1978)
  at android.widget.ScrollView.dispatchKeyEvent (ScrollView.java:738)
  at android.view.ViewGroup.dispatchKeyEvent (ViewGroup.java:1978)
  at android.view.ViewGroup.dispatchKeyEvent (ViewGroup.java:1978)
  at android.view.ViewGroup.dispatchKeyEvent (ViewGroup.java:1978)
  at android.view.ViewGroup.dispatchKeyEvent (ViewGroup.java:1978)
  at android.view.ViewGroup.dispatchKeyEvent (ViewGroup.java:1978)
  at android.view.ViewGroup.dispatchKeyEvent (ViewGroup.java:1978)
  at android.view.ViewGroup.dispatchKeyEvent (ViewGroup.java:1978)
  at android.view.ViewGroup.dispatchKeyEvent (ViewGroup.java:1978)
  at android.view.ViewGroup.dispatchKeyEvent (ViewGroup.java:1978)
  at android.view.ViewGroup.dispatchKeyEvent (ViewGroup.java:1978)
  at android.view.ViewGroup.dispatchKeyEvent (ViewGroup.java:1978)
  at android.view.ViewGroup.dispatchKeyEvent (ViewGroup.java:1978)
  at android.view.ViewGroup.dispatchKeyEvent (ViewGroup.java:1978)
  at com.facebook.react.ReactRootView.dispatchKeyEvent (ReactRootView.java:309)
  at android.view.ViewGroup.dispatchKeyEvent (ViewGroup.java:1978)
  at android.view.ViewGroup.dispatchKeyEvent (ViewGroup.java:1978)
  at android.view.ViewGroup.dispatchKeyEvent (ViewGroup.java:1978)
  at android.view.ViewGroup.dispatchKeyEvent (ViewGroup.java:1978)
  at android.view.ViewGroup.dispatchKeyEvent (ViewGroup.java:1978)
  at com.android.internal.policy.DecorView.superDispatchKeyEvent (DecorView.java:1104)
  at com.android.internal.policy.PhoneWindow.superDispatchKeyEvent (PhoneWindow.java:1961)
  at android.app.Activity.dispatchKeyEvent (Activity.java:4342)
  at androidx.core.app.ComponentActivity.superDispatchKeyEvent (ComponentActivity.java:126)
  at androidx.core.view.KeyEventDispatcher.dispatchKeyEvent (KeyEventDispatcher.java:86)
  at androidx.core.app.ComponentActivity.dispatchKeyEvent (ComponentActivity.java:144)
  at androidx.appcompat.app.AppCompatActivity.dispatchKeyEvent (AppCompatActivity.java:604)
  at androidx.appcompat.view.WindowCallbackWrapper.dispatchKeyEvent (WindowCallbackWrapper.java:60)
  at androidx.appcompat.app.AppCompatDelegateImpl$AppCompatWindowCallback.dispatchKeyEvent (AppCompatDelegateImpl.java:3413)
  at com.android.internal.policy.DecorView.dispatchKeyEvent (DecorView.java:928)
  at android.view.ViewRootImpl$ViewPostImeInputStage.processKeyEvent (ViewRootImpl.java:8056)
  at android.view.ViewRootImpl$ViewPostImeInputStage.onProcess (ViewRootImpl.java:7864)
  at android.view.ViewRootImpl$InputStage.deliver (ViewRootImpl.java:7213)
  at android.view.ViewRootImpl$InputStage.onDeliverToNext (ViewRootImpl.java:7270)
  at android.view.ViewRootImpl$InputStage.forward (ViewRootImpl.java:7236)
  at android.view.ViewRootImpl$AsyncInputStage.forward (ViewRootImpl.java:7434)
  at android.view.ViewRootImpl$InputStage.apply (ViewRootImpl.java:7244)
  at android.view.ViewRootImpl$AsyncInputStage.apply (ViewRootImpl.java:7491)
  at android.view.ViewRootImpl$InputStage.deliver (ViewRootImpl.java:7217)
  at android.view.ViewRootImpl$InputStage.onDeliverToNext (ViewRootImpl.java:7270)
  at android.view.ViewRootImpl$InputStage.forward (ViewRootImpl.java:7236)
  at android.view.ViewRootImpl$InputStage.apply (ViewRootImpl.java:7244)
  at android.view.ViewRootImpl$InputStage.deliver (ViewRootImpl.java:7217)
  at android.view.ViewRootImpl.deliverInputEvent (ViewRootImpl.java:10788)
  at android.view.ViewRootImpl.doProcessInputEvents (ViewRootImpl.java:10676)
  at android.view.ViewRootImpl.enqueueInputEvent (ViewRootImpl.java:10632)
  at android.view.ViewRootImpl$ViewRootHandler.handleMessageImpl (ViewRootImpl.java:6822)
  at android.view.ViewRootImpl$ViewRootHandler.handleMessage (ViewRootImpl.java:6697)
  at android.os.Handler.dispatchMessage (Handler.java:106)
  at android.os.Looper.loopOnce (Looper.java:226)
  at android.os.Looper.loop (Looper.java:313)
  at android.app.ActivityThread.main (ActivityThread.java:8762)
  at java.lang.reflect.Method.invoke
  at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:604)
  at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1067)

@chengweibo
Copy link
Author

I can add that this is also happening to us - very similar devices (Samsung a73xq and Samsung x1s)

we are using React Native 0.72.6

Exception java.lang.IndexOutOfBoundsException: offset(1) should be less than line limit(0)
  at android.text.TextLine.measure (TextLine.java:389)
  at android.text.Layout.getHorizontal (Layout.java:1254)
  at android.text.Layout.getHorizontal (Layout.java:1230)
  at android.text.Layout.getPrimaryHorizontal (Layout.java:1200)
  at android.widget.TextView.bringPointIntoView (TextView.java:11046)
  at android.widget.TextView.updateAfterEdit (TextView.java:11983)
  at android.widget.Editor.finishBatchEdit (Editor.java:2086)
  at android.widget.Editor.endBatchEdit (Editor.java:2068)
  at android.widget.TextView.endBatchEdit (TextView.java:9931)
  at android.widget.TextView.doKeyDown (TextView.java:9505)
  at android.widget.TextView.onKeyDown (TextView.java:9275)
  at android.view.KeyEvent.dispatch (KeyEvent.java:3508)
  at android.view.View.dispatchKeyEvent (View.java:15395)
  at android.view.ViewGroup.dispatchKeyEvent (ViewGroup.java:1978)
  at android.view.ViewGroup.dispatchKeyEvent (ViewGroup.java:1978)
  at android.view.ViewGroup.dispatchKeyEvent (ViewGroup.java:1978)
  at android.view.ViewGroup.dispatchKeyEvent (ViewGroup.java:1978)
  at android.widget.ScrollView.dispatchKeyEvent (ScrollView.java:738)
  at android.view.ViewGroup.dispatchKeyEvent (ViewGroup.java:1978)
  at android.view.ViewGroup.dispatchKeyEvent (ViewGroup.java:1978)
  at android.view.ViewGroup.dispatchKeyEvent (ViewGroup.java:1978)
  at android.view.ViewGroup.dispatchKeyEvent (ViewGroup.java:1978)
  at android.view.ViewGroup.dispatchKeyEvent (ViewGroup.java:1978)
  at android.view.ViewGroup.dispatchKeyEvent (ViewGroup.java:1978)
  at android.view.ViewGroup.dispatchKeyEvent (ViewGroup.java:1978)
  at android.view.ViewGroup.dispatchKeyEvent (ViewGroup.java:1978)
  at android.view.ViewGroup.dispatchKeyEvent (ViewGroup.java:1978)
  at android.view.ViewGroup.dispatchKeyEvent (ViewGroup.java:1978)
  at android.view.ViewGroup.dispatchKeyEvent (ViewGroup.java:1978)
  at android.view.ViewGroup.dispatchKeyEvent (ViewGroup.java:1978)
  at android.view.ViewGroup.dispatchKeyEvent (ViewGroup.java:1978)
  at com.facebook.react.ReactRootView.dispatchKeyEvent (ReactRootView.java:309)
  at android.view.ViewGroup.dispatchKeyEvent (ViewGroup.java:1978)
  at android.view.ViewGroup.dispatchKeyEvent (ViewGroup.java:1978)
  at android.view.ViewGroup.dispatchKeyEvent (ViewGroup.java:1978)
  at android.view.ViewGroup.dispatchKeyEvent (ViewGroup.java:1978)
  at android.view.ViewGroup.dispatchKeyEvent (ViewGroup.java:1978)
  at com.android.internal.policy.DecorView.superDispatchKeyEvent (DecorView.java:1104)
  at com.android.internal.policy.PhoneWindow.superDispatchKeyEvent (PhoneWindow.java:1961)
  at android.app.Activity.dispatchKeyEvent (Activity.java:4342)
  at androidx.core.app.ComponentActivity.superDispatchKeyEvent (ComponentActivity.java:126)
  at androidx.core.view.KeyEventDispatcher.dispatchKeyEvent (KeyEventDispatcher.java:86)
  at androidx.core.app.ComponentActivity.dispatchKeyEvent (ComponentActivity.java:144)
  at androidx.appcompat.app.AppCompatActivity.dispatchKeyEvent (AppCompatActivity.java:604)
  at androidx.appcompat.view.WindowCallbackWrapper.dispatchKeyEvent (WindowCallbackWrapper.java:60)
  at androidx.appcompat.app.AppCompatDelegateImpl$AppCompatWindowCallback.dispatchKeyEvent (AppCompatDelegateImpl.java:3413)
  at com.android.internal.policy.DecorView.dispatchKeyEvent (DecorView.java:928)
  at android.view.ViewRootImpl$ViewPostImeInputStage.processKeyEvent (ViewRootImpl.java:8056)
  at android.view.ViewRootImpl$ViewPostImeInputStage.onProcess (ViewRootImpl.java:7864)
  at android.view.ViewRootImpl$InputStage.deliver (ViewRootImpl.java:7213)
  at android.view.ViewRootImpl$InputStage.onDeliverToNext (ViewRootImpl.java:7270)
  at android.view.ViewRootImpl$InputStage.forward (ViewRootImpl.java:7236)
  at android.view.ViewRootImpl$AsyncInputStage.forward (ViewRootImpl.java:7434)
  at android.view.ViewRootImpl$InputStage.apply (ViewRootImpl.java:7244)
  at android.view.ViewRootImpl$AsyncInputStage.apply (ViewRootImpl.java:7491)
  at android.view.ViewRootImpl$InputStage.deliver (ViewRootImpl.java:7217)
  at android.view.ViewRootImpl$InputStage.onDeliverToNext (ViewRootImpl.java:7270)
  at android.view.ViewRootImpl$InputStage.forward (ViewRootImpl.java:7236)
  at android.view.ViewRootImpl$InputStage.apply (ViewRootImpl.java:7244)
  at android.view.ViewRootImpl$InputStage.deliver (ViewRootImpl.java:7217)
  at android.view.ViewRootImpl.deliverInputEvent (ViewRootImpl.java:10788)
  at android.view.ViewRootImpl.doProcessInputEvents (ViewRootImpl.java:10676)
  at android.view.ViewRootImpl.enqueueInputEvent (ViewRootImpl.java:10632)
  at android.view.ViewRootImpl$ViewRootHandler.handleMessageImpl (ViewRootImpl.java:6822)
  at android.view.ViewRootImpl$ViewRootHandler.handleMessage (ViewRootImpl.java:6697)
  at android.os.Handler.dispatchMessage (Handler.java:106)
  at android.os.Looper.loopOnce (Looper.java:226)
  at android.os.Looper.loop (Looper.java:313)
  at android.app.ActivityThread.main (ActivityThread.java:8762)
  at java.lang.reflect.Method.invoke
  at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:604)
  at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1067)

There is a scene that reappears. Please describe it in detail.thank you

@antoinerousseau
Copy link
Contributor

Same here on Oppo CPH2145

java.lang.IndexOutOfBoundsException: offset(447) should be less than line limit(252)
    at android.text.TextLine.measure(TextLine.java:398)
    at android.text.Layout.getHorizontal(Layout.java:1246)
    at android.text.Layout.getHorizontal(Layout.java:1222)
    at android.text.Layout.getPrimaryHorizontal(Layout.java:1192)
    at android.text.Layout.getPrimaryHorizontal(Layout.java:1181)
    at com.facebook.react.uimanager.ReactAccessibilityDelegate.getBoundsInParent(ReactAccessibilityDelegate.java:662)
    at com.facebook.react.uimanager.ReactAccessibilityDelegate.onPopulateNodeForVirtualView(ReactAccessibilityDelegate.java:641)
    at androidx.customview.widget.ExploreByTouchHelper.createNodeForChild(ExploreByTouchHelper.java:805)
    at androidx.customview.widget.ExploreByTouchHelper.obtainAccessibilityNodeInfo(ExploreByTouchHelper.java:725)
    at androidx.customview.widget.ExploreByTouchHelper$MyNodeProvider.createAccessibilityNodeInfo(ExploreByTouchHelper.java:1253)
    at androidx.core.view.accessibility.AccessibilityNodeProviderCompat$AccessibilityNodeProviderApi16.createAccessibilityNodeInfo(AccessibilityNodeProviderCompat.java:46)
    at android.view.AccessibilityInteractionController$AccessibilityNodePrefetcher.prefetchDescendantsOfVirtualNode(AccessibilityInteractionController.java:1572)
    at android.view.AccessibilityInteractionController$AccessibilityNodePrefetcher.prefetchDescendantsOfRealNode(AccessibilityInteractionController.java:1481)
    at android.view.AccessibilityInteractionController$AccessibilityNodePrefetcher.prefetchAccessibilityNodeInfos(AccessibilityInteractionController.java:1243)
    at android.view.AccessibilityInteractionController.findAccessibilityNodeInfoByAccessibilityIdUiThread(AccessibilityInteractionController.java:396)
    at android.view.AccessibilityInteractionController.-$$Nest$mfindAccessibilityNodeInfoByAccessibilityIdUiThread
    at android.view.AccessibilityInteractionController$PrivateHandler.handleMessage(AccessibilityInteractionController.java:1647)
    at android.os.Handler.dispatchMessage(Handler.java:106)
    at android.os.Looper.loopOnce(Looper.java:240)
    at android.os.Looper.loop(Looper.java:351)
    at android.app.ActivityThread.main(ActivityThread.java:8423)
    at java.lang.reflect.Method.invoke(Method.java)
    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:584)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1013)

@egealpay1
Copy link

Why this issue is closed? Is it solved?

@priami93
Copy link

priami93 commented Aug 25, 2024

It's not solved!
In 0.74.3 it still occur

@xiushaomin
Copy link

Is there any workaround?

@antoinerousseau
Copy link
Contributor

Is there any workaround?

You can try adding force 'androidx.compose.ui:ui-text:1.6.8' to your app/build.gradle in resolutionStrategy but it made Stripe crash in our case (if you don't use Stripe you can try it)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Needs: Repro This issue could be improved with a clear list of steps to reproduce the issue. Needs: Triage 🔍 Type: Too Old Version
Projects
None yet
Development

No branches or pull requests

6 participants