I received this crash report in my Google Play Console which I myself never experience.
java.lang.RuntimeException:
at android.app.ActivityThread.performLaunchActivity (ActivityThread.java:2505)
at android.app.ActivityThread.handleLaunchActivity (ActivityThread.java:2577)
at android.app.ActivityThread.access$1000 (ActivityThread.java:164)
at android.app.ActivityThread$H.handleMessage (ActivityThread.java:1462)
at android.os.Handler.dispatchMessage (Handler.java:102)
at android.os.Looper.loop (Looper.java:160)
at android.app.ActivityThread.main (ActivityThread.java:5541)
at java.lang.reflect.Method.invoke (Method.java)
at java.lang.reflect.Method.invoke (Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run (ZygoteInit.java:964)
at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:759)
Caused by: java.lang.StringIndexOutOfBoundsException:
at java.lang.String.startEndAndLength (String.java:504)
at java.lang.String.substring (String.java:1333)
at .Word.onCreate (Word.java)
at android.app.Activity.performCreate (Activity.java:6093)
at android.app.Instrumentation.callActivityOnCreate (Instrumentation.java:1106)
at android.app.ActivityThread.performLaunchActivity (ActivityThread.java:2458)
at android.app.ActivityThread.handleLaunchActivity (ActivityThread.java:2577)
at android.app.ActivityThread.access$1000 (ActivityThread.java:164)
at android.app.ActivityThread$H.handleMessage (ActivityThread.java:1462)
at android.os.Handler.dispatchMessage (Handler.java:102)
at android.os.Looper.loop (Looper.java:160)
at android.app.ActivityThread.main (ActivityThread.java:5541)
at java.lang.reflect.Method.invoke (Method.java)
at java.lang.reflect.Method.invoke (Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run (ZygoteInit.java:964)
at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:759)
This crash report doesn't mention which line of my Word.java
class is causing the problem. In my class, I use the following substring
method.
definition = defn.substring(0, defn.indexOf("@"));
sentence = rawMeaning.substring(rawMeaning.lastIndexOf('@') + 1);
Examples of my defn
string are test1@test2
, test1@
. Every of my defn
string string contains @
. Some string contains character after @
, some do not contains any character after @
. My rawMeaning
string share a similar format with my defn
string.
It is interesting that I received another crash report which give me similar error but it mentioned the error is caused my in app billing, StringIndexOutOfBoundsException caused by in app billing queryInventoryAsync
How to solve this?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…