得到 java.lang.IndexOutOfBoundsException: Index: 0, Size: 0 in react native
Getting java.lang.IndexOutOfBoundsException: Index: 0, Size: 0 in react native
我是 react-native
的新手。当我尝试从 android-studio
运行 我的应用程序时,我的 phone 通过 USB 连接(启用调试模式)。 Build succeeded
应用程序已安装到 phone。但是当我尝试打开该应用程序时,它立即 crashes
。请检查错误的屏幕截图和调试模式中的 java 行。
调试错误:
E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.parable.rnmvp, PID: 18237
java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
at java.util.ArrayList.get(ArrayList.java:437)
at com.dooboolab.RNIap.RNIapModule.onPurchasesUpdated(RNIapModule.java:517)
at com.dooboolab.RNIap.RNIapModule.run(RNIapModule.java:544)
at com.dooboolab.RNIap.RNIapModule.onBillingSetupFinished(RNIapModule.java:103)
at com.android.billingclient.api.BillingClientImpl$BillingServiceConnection.run(BillingClientImpl.java:1521)
at android.os.Handler.handleCallback(Handler.java:873)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:232)
at android.app.ActivityThread.main(ActivityThread.java:7165)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:576)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:888)
ArrayList.java(错误块)
public E get(int index) {
if (index >= size)
throw new IndexOutOfBoundsException(outOfBoundsMsg(index)); //line 437 (from this line it throws error)
return (E) elementData[index];
}
请帮我解决这个问题。如果我需要分享任何额外信息。请在评论中提问。
参考 @firats
评论和 issue 有人在 react-native-iap 模块上提出的,我尝试 react-native-iap@4.0.4
现在,此错误已修复。
我是 react-native
的新手。当我尝试从 android-studio
运行 我的应用程序时,我的 phone 通过 USB 连接(启用调试模式)。 Build succeeded
应用程序已安装到 phone。但是当我尝试打开该应用程序时,它立即 crashes
。请检查错误的屏幕截图和调试模式中的 java 行。
调试错误:
E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.parable.rnmvp, PID: 18237
java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
at java.util.ArrayList.get(ArrayList.java:437)
at com.dooboolab.RNIap.RNIapModule.onPurchasesUpdated(RNIapModule.java:517)
at com.dooboolab.RNIap.RNIapModule.run(RNIapModule.java:544)
at com.dooboolab.RNIap.RNIapModule.onBillingSetupFinished(RNIapModule.java:103)
at com.android.billingclient.api.BillingClientImpl$BillingServiceConnection.run(BillingClientImpl.java:1521)
at android.os.Handler.handleCallback(Handler.java:873)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:232)
at android.app.ActivityThread.main(ActivityThread.java:7165)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:576)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:888)
ArrayList.java(错误块)
public E get(int index) {
if (index >= size)
throw new IndexOutOfBoundsException(outOfBoundsMsg(index)); //line 437 (from this line it throws error)
return (E) elementData[index];
}
请帮我解决这个问题。如果我需要分享任何额外信息。请在评论中提问。
参考 @firats
评论和 issue 有人在 react-native-iap 模块上提出的,我尝试 react-native-iap@4.0.4
现在,此错误已修复。