title: Getting java.lang.IndexOutOfBoundsException: Index: 0, Size: 0 in react native
body: <p>I am new to <code>react-native</code>. when I try to run my app from the <code>android-studio</code> with my phone connected via USB (debug mode enabled). <code>Build succeeded</code> &amp; App got installed into the phone. but when I try to open the app, it <code>crashes</code> immediately. please check the screenshot for the error and java line from the debug mode.</p>
  
  <p><a href="https://i.stack.imgur.com/SiJv7.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/SiJv7.png" alt="enter image description here"></a></p>
  
  <p>error in debug:</p>
  
  <pre><code>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)
  </code></pre>
  
  <p>ArrayList.java (error block)</p>
  
  <pre><code>public E get(int index) {
          if (index &gt;= size)
              throw new IndexOutOfBoundsException(outOfBoundsMsg(index)); //line 437 (from this line it throws error)
          return (E) elementData[index];
      }
  </code></pre>
  
  <p>Please help me to fix this issue. if I need to share any extra info. please ask in the comments.</p>