String IndexOutOfBounds Exception while using extensions in companion app

Just tested my cam64 extn demo app on Google Pixel 4a, Android 13 with companion 2.73u, and get the same error:

Unable to load extensions.java.lang.StringIndexOutOfBoundsException: start 1, end 0, length 0

Does not then load the app in companion. So it seems not a device specific issue, but a bug in companion 2.73 on Android <14 ? Also tested on other aia projects with extensions, getting the same result.

[EDIT - also tested on my Genymotion Emulator, which runs an Android 12 Google Pixel 3XL. This also fails to load an aia project with the same error.]

[EDIT - Compiled app works OK on these devices]

2 Likes

Even adding the extention without any block returns the runtime error in companion.

@MikeTemp and @F_H
Are these Sansung devices?

Taifun
(using a Samsung A54 running Android 14 and do not have that issue)

My Android 10 is a Samsung Galaxy S9 SM-G960U
My Android 13 is a Galaxy A71 5G SM-A716U1

1 Like

Today on android14 I noticed that resources are not being sent to companion. Although yesterday everything was fine on 2.73

I try on Samsung S20 FE 5G SM-G781B/DS. The problem still exists but not limited to only this. Lets see if this one resolves first then taking care of other issues.

Error adding extension: Unable to load extensions.java.lang.StringIndexOutOfBoundsException: String index out of range: -1

adb logcat: 11-21 17:32:37.527 16629 17117 D AssetFetcher: target file = /storage/emulated/0/Android/data/edu.mit.appinventor.aicompanion3/files/assets/external_comps/com.bosonshiggs.chatflow/classes.jar

This is happening with any extension

Android 11

1 Like

tested on old Asus with Android 7 and Companion v. 2.73, on Honor Magic 5 lite and Companion v.2.73u and on Xiaomi Redmi 9 with Companion v.2.73 and with any extension

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.