Got this error "java.lang.RuntimeException: no such class" when import extension

Ove - what Browser are you using? It must be Firefox or Chrome.

what's the android version? is your Companion the latest version? Is any problem when compile to apk?

Found a workaround in this thread:

It's apparently a bug, and the workaround is to load your app in AI Companion first. After that Emulator will work for that session.

1 Like

That is not a 100% solution since the Emulator is not compatible with everything you throw at it.

If you have the AI2 Companion on a device for testing, it is better to use it rather than the Emulator - you are then testing how Android executes your code and how Android displays your GUI.

1 Like

Guys this is a bug.
I've tried with the simplest app, just a button or something like that add any extension at all and Companion with not work period until you remove the extension.
Can one of the devs point me in a direction to look so I can go after the code that does this.

Are you using the CompCreator extension or another extension? Please point it out before you reply.

Also, please, still show your blocks and the extension version that you are using before jumping to a conclusion that "this is a bug". The extension you are using may be an older version that have some bugs, and your blocks may have something missing (such as initializing a view for some extensions).

@Gordon_Lu What part of ANY extension don't you understand.

I'm sorry, I misread your post.

If you haven't, you should exit the companion and reconnect again for starters. The extension is considered like an asset file and sent to the companion when you are connecting, and maybe, the extension is not sent to your device.

If this still persists, then you may have to build the app in order to test.

How to avoid runtime errors with the companion app

  1. After importing an extension, please restart the companion app.

  2. If you like to use an extension on a different screen, in Screen1 additionally drag the extension into the working area.

While starting the companion app, all necessary assets and also the imported extensions of your project will be copied to your device. So in case the no such class error shows up, the extension code to run the extension is not available on your device. Without that code the companion app is not able to execute methods from the extension.

In case restarting the companion app does not work for you after trying several times, then as it looks like the only way for you to test you app will be after building it using the apk file.

Taken from App Inventor Extensions | Pura Vida Apps.

If that still is a problem, clear the assets of your companion and try.

Android or iOS?
Error message? Post a screenshot of it.

1 Like

I am using Android ver 9 on my phone, connected via USB
The extension I am currently trying to use is ColinTreeListView but that same happens no matter which I try (FirebaseAuth, FirebaseStorage, TaifunTextBox and more always fails).
I will try that clear assets shortly.

This is actually funny (not).
I imported that deleteAssetsCompanion.aia, certainly does not load into companion, so I built it and installed and list files show blank array delete files seems to do nothing.
I restart the browser and companion upon restart the deleteAssetsCompanion was the last project so it autoloads and wham case in point error.

Does this simple test app work for you (with TaifunTextbox extension):
TaifunTextbox.aia (18.8 KB)

If not, post a screenshot again and try to connect via "AI Companion" (WiFi).

I got a different error now.
Screenshot from 2022-12-25 04-44-58

BTW: I saw another flash by before that

Build the APK and try ...

Did you connect via "AI Companion" (or via USB again)?

Via USB, I have no WIFI to try.
For what its worth I've been filtering logcat and I see a bunch of _values POST but I don't see _extensions.
12-25 04:59:03.449 20200 20254 D AppInvHTTPD: POST '/_values'

So did you try testing with the APK?

Btw, I have no issues with USB connection.

1 Like

Yes I did test with APK, that works fine. Using the APK is how i've using AI2 because the companion has never worked with extensions for me but its become a pain to do so here I am trying to get it working.
When I examine the logs and grok the code it almost seems like the scheme code is getting evaluated before the extension get there.
Still groking