String IndexOutOfBounds Exception while using extensions in companion app

and ?

This worked fine on android 8 if i move it to a new tablet with Android 12 i get always the error

When i move the extensions then i run the companion.
Even if i remove the permission same result.

1 Like

Hi TIMAI2
yes SM-T05 (Galaxy Tab A7) and android 12
On a chinese tablet KEP android 10 it works! Any suggestions ?

Temporarily use the companion app on those devices which work or test using the apk file while the MIT App Inventor team hopefully will look into this issue soon
@Susan_Lane
@ewpatton

Taifun

1 Like

Has anyone produced a complete stack trace?

1 Like

and it doesn't work. I missed part of the message. Sorry

This is the output I get from adb logcat *:E when connecting with code

11-22 09:26:56.625 14085 14085 E AssetFetcher: Error in form.loadComponents
11-22 09:26:56.625 14085 14085 E AssetFetcher: java.lang.StringIndexOutOfBoundsException: start 1, end 0, length 0
11-22 09:26:56.625 14085 14085 E AssetFetcher: 	at java.lang.AbstractStringBuilder.checkRangeSIOOBE(AbstractStringBuilder.java:1729)
11-22 09:26:56.625 14085 14085 E AssetFetcher: 	at java.lang.AbstractStringBuilder.substring(AbstractStringBuilder.java:1022)
11-22 09:26:56.625 14085 14085 E AssetFetcher: 	at java.lang.StringBuilder.substring(StringBuilder.java:87)
11-22 09:26:56.625 14085 14085 E AssetFetcher: 	at java.lang.AbstractStringBuilder.substring(AbstractStringBuilder.java:973)
11-22 09:26:56.625 14085 14085 E AssetFetcher: 	at java.lang.StringBuilder.substring(StringBuilder.java:87)
11-22 09:26:56.625 14085 14085 E AssetFetcher: 	at com.google.appinventor.components.runtime.ReplForm.loadComponents(ReplForm.java:480)
11-22 09:26:56.625 14085 14085 E AssetFetcher: 	at com.google.appinventor.components.runtime.util.AssetFetcher.loadExtensions(AssetFetcher.java:137)
11-22 09:26:56.625 14085 14085 E AssetFetcher: 	at java.lang.reflect.Method.invoke(Native Method)
11-22 09:26:56.625 14085 14085 E AssetFetcher: 	at gnu.expr.PrimProcedure.apply(PrimProcedure.java:285)
11-22 09:26:56.625 14085 14085 E AssetFetcher: 	at gnu.mapping.CallContext.runUntilDone(CallContext.java:234)
11-22 09:26:56.625 14085 14085 E AssetFetcher: 	at gnu.mapping.CallContext.runUntilValue(CallContext.java:298)
11-22 09:26:56.625 14085 14085 E AssetFetcher: 	at gnu.mapping.MethodProc.applyN(MethodProc.java:113)
11-22 09:26:56.625 14085 14085 E AssetFetcher: 	at gnu.mapping.ProcedureN.apply0(ProcedureN.java:24)
11-22 09:26:56.625 14085 14085 E AssetFetcher: 	at kawa.lang.Promise.force(Promise.java:27)
11-22 09:26:56.625 14085 14085 E AssetFetcher: 	at kawa.lang.Promise.force(Promise.java:37)
11-22 09:26:56.625 14085 14085 E AssetFetcher: 	at kawa.lib.misc.force(misc.scm:99)
11-22 09:26:56.625 14085 14085 E AssetFetcher: 	at com.google.youngandroid.runtime$frame9.lambda20(runtime4706405383590784482.scm:3569)
11-22 09:26:56.625 14085 14085 E AssetFetcher: 	at com.google.youngandroid.runtime$frame9.apply0(runtime4706405383590784482.scm:3566)
11-22 09:26:56.625 14085 14085 E AssetFetcher: 	at gnu.expr.ModuleMethod.apply0(ModuleMethod.java:186)
11-22 09:26:56.625 14085 14085 E AssetFetcher: 	at gnu.mapping.RunnableClosure.run(RunnableClosure.java:78)
11-22 09:26:56.625 14085 14085 E AssetFetcher: 	at android.os.Handler.handleCallback(Handler.java:942)
11-22 09:26:56.625 14085 14085 E AssetFetcher: 	at android.os.Handler.dispatchMessage(Handler.java:99)
11-22 09:26:56.625 14085 14085 E AssetFetcher: 	at android.os.Looper.loopOnce(Looper.java:201)
11-22 09:26:56.625 14085 14085 E AssetFetcher: 	at android.os.Looper.loop(Looper.java:288)
11-22 09:26:56.625 14085 14085 E AssetFetcher: 	at android.app.ActivityThread.main(ActivityThread.java:7918)
11-22 09:26:56.625 14085 14085 E AssetFetcher: 	at java.lang.reflect.Method.invoke(Native Method)
11-22 09:26:56.625 14085 14085 E AssetFetcher: 	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
11-22 09:26:56.625 14085 14085 E AssetFetcher: 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:936)

1 Like

and more from a adb logcat

logcat.txt (33.0 KB)

there were hundreds of these as well

11-22 09:22:22.782  4205  5356 E Finsky  : [63] mxv.apply(797): AU2: RequiredVehicleState is missing.
11-22 09:22:22.783  4205  5356 E Finsky  : [63] mxv.apply(857): AU2: RequiredInteractivityState is missing.
11-22 09:22:22.784  4205  5356 E Finsky  : [63] mxv.apply(987): AU2: RequiredBatteryLevel is missing.

3 posts were split to a new topic: My app fails Play Store pre-launch tests

I have the same problem (getting the out-of-bounds message when trying to run latest version of companion). Running Android 13 on Samsung S20. Everything was working fine yesterday morning with older version of companion (2.70?). Accidently deleted it off my phone. Reloaded companion from Google Play. Gotten the error ever since. Any way to get access to older versions of companion to try?

I don't get this error, but I can't connect to the companion because the extension jar file isn't being sent, and neither are resources like images. Oddly enough, everything works fine on my locally compiled server.

Here is a shared Sync.com archive of recent Companions:

The problem seems to be in Companion itself. When I use Companion compiled locally, this error does not occur.

Once my locally compiled Companion has downloaded the resources and jar files to ASD, then connecting to Companion installed from GooglePlay works fine. So the problem is in downloading resources from the server to ASD.

Maybe the new Companion after the ListView hot fix will fix the situation.

1 Like

We don't apply any patches in production that would affect the extension loading path. I'm going to run some tests and see if I can reproduce it.

1 Like

On 2.73u:

AssetFetcher            usap64                              usap64                               E  Error in form.loadComponents (Ask Gemini)
                                                                                                                                        java.lang.StringIndexOutOfBoundsException: start 1, end 0, length 0
                                                                                                                                        	at java.lang.AbstractStringBuilder.checkRangeSIOOBE(AbstractStringBuilder.java:1729)
                                                                                                                                        	at java.lang.AbstractStringBuilder.substring(AbstractStringBuilder.java:1022)
                                                                                                                                        	at java.lang.StringBuilder.substring(StringBuilder.java:87)
                                                                                                                                        	at java.lang.AbstractStringBuilder.substring(AbstractStringBuilder.java:973)
                                                                                                                                        	at java.lang.StringBuilder.substring(StringBuilder.java:87)
                                                                                                                                        	at com.google.appinventor.components.runtime.ReplForm.loadComponents(ReplForm.java:480)
                                                                                                                                        	at com.google.appinventor.components.runtime.util.AssetFetcher.loadExtensions(AssetFetcher.java:137)
                                                                                                                                        	at java.lang.reflect.Method.invoke(Native Method)
                                                                                                                                        	at gnu.expr.PrimProcedure.apply(PrimProcedure.java:285)
                                                                                                                                        	at gnu.mapping.CallContext.runUntilDone(CallContext.java:234)
                                                                                                                                        	at gnu.mapping.CallContext.runUntilValue(CallContext.java:298)
                                                                                                                                        	at gnu.mapping.MethodProc.applyN(MethodProc.java:113)
                                                                                                                                        	at gnu.mapping.ProcedureN.apply0(ProcedureN.java:24)
                                                                                                                                        	at kawa.lang.Promise.force(Promise.java:27)
                                                                                                                                        	at kawa.lang.Promise.force(Promise.java:37)
                                                                                                                                        	at kawa.lib.misc.force(misc.scm:99)
                                                                                                                                        	at com.google.youngandroid.runtime$frame9.lambda20(runtime4706405383590784482.scm:3569)
                                                                                                                                        	at com.google.youngandroid.runtime$frame9.apply0(runtime4706405383590784482.scm:3566)
                                                                                                                                        	at gnu.expr.ModuleMethod.apply0(ModuleMethod.java:186)
                                                                                                                                        	at gnu.mapping.RunnableClosure.run(RunnableClosure.java:78)
                                                                                                                                        	at android.os.Handler.handleCallback(Handler.java:958)
                                                                                                                                        	at android.os.Handler.dispatchMessage(Handler.java:99)
                                                                                                                                        	at android.os.Looper.loopOnce(Looper.java:222)
                                                                                                                                        	at android.os.Looper.loop(Looper.java:314)
                                                                                                                                        	at android.app.ActivityThread.main(ActivityThread.java:8658)
                                                                                                                                        	at java.lang.reflect.Method.invoke(Native Method)
                                                                                                                                        	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:565)
                                                                                                                                        	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1081)

I think this error may simply be due to lack of resources in the ASD Companion.

The first attempt to connect after installing Companion ended with an error. Another attempt and the connection was problem-free. Something is not stable.

In my case there were 3 error symptoms:

  • error: java.lang.StringIndexOutOfBoundsException
  • error: Unable to load file...../classes.jar
  • and a problem that after updating the extension with new methods, these methods were not available in companion, i.e. the classes.jar file did not update in asd but the connection to companion was successful.
1 Like

@Mike_B , @Patryk_F

What happens if you try a project without extensions ? (as previously suggested)

What happens if you try a project with no extensions but also with some media assets ?

Without extensions it work in all my tablets and android versions

1 Like

Thank you, we are getting somewhere.

@Taifun

Should we create a new topic, e.g. Companion Extension Issues: nb199 and 2.73u and move all the topics there ?

3 Likes