3

I am new to react-native. when I try to run my app from the android-studio with my phone connected via USB (debug mode enabled). Build succeeded & App got installed into the phone. but when I try to open the app, it crashes immediately. please check the screenshot for the error and java line from the debug mode.

enter image description here

error in debug:

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$11.run(RNIapModule.java:544)
        at com.dooboolab.RNIap.RNIapModule$2.onBillingSetupFinished(RNIapModule.java:103)
        at com.android.billingclient.api.BillingClientImpl$BillingServiceConnection$1.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 (error block)

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];
    }

Please help me to fix this issue. if I need to share any extra info. please ask in the comments.

5
  • ArrayList.java is probably irrelevant here. RNIapModule.onPurchasesUpdated is much more interesting. Is that your code? Or a library that you use? Commented Nov 22, 2019 at 10:51
  • @JoachimSauer that is an node moule` "react-native-iap": "^3.3.6"` Commented Nov 22, 2019 at 10:54
  • add your codes too Commented Nov 22, 2019 at 11:00
  • @TouhidulIslam what are the files I need to add? Commented Nov 22, 2019 at 11:26
  • 1
    Try 4.0.4 version of react-native-iap. To install exactly version write your terminal npm install [email protected] --save and clean/build your app. Commented Nov 22, 2019 at 11:56

1 Answer 1

2

with reference to @firats comment & issue raised by someone on react-native-iap module, i tried with [email protected]

Now, this error got fixed.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.