String IndexOutOfBounds Exception while using extensions in companion app

Try this app: soundTest2.aia (8.9 KB)

Remove the Companion folder on your Android 14 test device, reload the browser and check again ...


There is no external_comps folder:

I don't know if there should be such a folder there. I don't have this folder either, but it works. I'll try your project right away.

What android version on your Bluestacks emulator ?

Note: it is not the extension's problem, it is that the companion has not loaded the classes.jar file properly.

For Android 14 and later we had to move the assets folder to the private data directory. The problem being that in Android 14, Google now requires that executable files (classes.jar) be marked read only, but some device manufacturers mount the partition in /storage/emulated/0 using a file system that does not allow the files to be marked read-only. However /data (the private data directory) is ext4 and thus respects the API call to make the file read only.

That would include Google (Pixel) then?

I believe the Pixel was fine (my Pixel 6 with Android 14 does not exhibit the issue). We mostly saw it on Samsung devices. We even had the read/write problem manifest on some of our Samsung tablets but not others, even though supposedly they are all the same model number.

1 Like

Your project works in companion, buttons generate sounds. But I don't have any files in the assets folder.

Now everything is clear. Clearing the app data in its settings will clear this private data?

If I connect via USB (and add another extension) I get both extensions in the external_comps folder:

and both extensions work fine.

It looks like despite android14, companion behaves like in older android. Like it doesn't detect the version correctly.

My phone also had this error but only until the middle of last week. Then it went away.

1 Like

I also have nothing in the private folder. And if I want to check the cache, it shows me the error of lack of permissions "READ_EXTERNAL_STORAGE" which shouldn't be on Android14. But even though Private is empty, the extension in companion works.

As I said several times, my Android 14 test device is a Pixel 7 Pro (Android 14).

With reference to what I wrote here, try this:

On Android 14+ device

  • Create a new project
  • load up one of your own extensions
  • test in companion - should work
  • now build/create a new version of your extension
  • update your existing extension in the project with your newly created version
  • test in companion - should fail - not loading the classes.jar file, or similar runtime error

this would be very similar to most extension developers workflow when testing new features in their extension

As I also said several times, I always remove the Companion folder (to avoid things not being updated correctly/completely) before I test a new version of an extension, reload the browser and then connect to Companion...

Yes, I encountered such an error a week ago when I updated my ListViewPlus extension. Maybe that's why I had this error a week ago. But then it also showed that methods were missing, which were added in the new version.

This has never been necessary before now. I also did a reinstall of the companion app, which cleared the files, and still the problem arises.

This has happened to me several times before.

Regardless, the same error message about classes.jar is happening to other users, who are not doing this.

Why?

You can also write in your PrivateDir. Right?
Or where exactly are the extensions stored? Obviously not in:
/storage/emulated/0/Android/data/edu.mit.appinventor.aicompanion3/files/data/assets/external_comps/


And why didn't we get any issue with Niotron (also on Android 14)?