Java Error Error from Companion: java.lang.RuntimeException: invalid syntax in eval form: :8:1: caught exception in inliner for # - java.lang.RuntimeException: no such class:

UPDATE:

I check it using the ai2-test (Built: June 3 2022 Version: ai2-test-20220603) with the same result.

Gus

If you're on Windows, the version of Android bundled in the 2.x branch of emulator products is too old to support extensions. There is a newer bundle that we are putting together based on Android 10 that will support extensions to some degree (e.g., extensions that don't need hardware support).

As a workaround, if you have Android Studio installed you can start an Android Virtual Device and install the companion there. So long as that emulator is running before you select the Emulator option from the Connect menu App Inventor will connect to it rather than its built-in emulator (aiStarter.exe still needs to be running in this configuration).

Hi,
Thanks for your response.

I'm on GNU/Linux machines. I work with extensions since 2017 and never have this problem. I'm using both emulators (App Inventor included on the appinventor2-setup-2.3) and all works fine until the last month ¿or the previous App Inventor version?.

In fact I do have a couple of App Inventor servers (older versions) and all works like expected.
From my observations I can tell that the Companion works fine until I drop a extension component on the project. In that moment the device screen is frozen and the mentioned error message apear on the IDE side. In that moment if the extension component is removed it's possible to send "Update Companion Screen" and the connection between the emulated device and the IDE works again.

I think that there is a bug on the new App Inventor server. I can try to build the previous version and make it a try.

Please tell me if that can help to diagnose the problem.

Gus

I found this on the puravidaapps.com

" 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."

¿Must we conclude that there is a know (and open) problem with the extensions in the current version of AI2?

In that case, ¿how can we help to solve it?

Gus

No, we cannot conclude that statement or situation. I have never had these errors with companion (Genymotion emulator and real device) or compiled apps with the nb189+ releases, along with many others. It just seems to be some users (which includes you) who have this problem. This makes it more difficult to track down. Evan has explained above the possible issues with the AppInventor Emulator.

OK, do you think there is a way in which I (we) can contribute to diagnose/solve this problem?

I'm not using Genymotion but I can try it if the results can give us some clues about this problem.
Thanks again,
Gus

First step is to ensure we are all working from the same page.

I am running Xubuntu Linux 20.04 LTS, you say you are running on GNU/Linux as well....

AppInventor
http://ai2.appinventor.mit.edu
Built: June 19 2022 Version: nb189a

Use Chrome/Chromium browser - assume up to date
(mine is Version 103.0.5060.53 (Official Build) snap (64-bit)

Companion
Companion Version Use Companion: 2.63 or 2.63u

Use real device and connect via wifi

Extension (we will use one of mine)
uk.co.metricrat.base91.aix (6.2 KB)

Create new project and import the extension.
Report any errors

Post the project here.

Here is my test project
extErrorTest1.aia (8.2 KB)

No errors reported

Yes, I'm using SMP Debian 5.10.28-1 (2021-04-09) x86_64 GNU/Linux.

I don´t have a real device right now. So I opened the project you share here using the same AI2 server (but using Firefox browser and the companion 2.63u running on the emulator) I have the same error:
Error de Companion: java.lang.RuntimeException: invalid syntax in eval form: :22:1: caught exception in inliner for # - java.lang.RuntimeException: no such class: uk.co.metricrat.base91.Base91...

Using the Chrome browser, the error message takes longer to apear.
In both cases, is enough to remove the extension from the Screen1 in order to recover the companion connection

Now we have an inconclusive test....

I fired up the emulator to test the same project. Of five attempts it showed the runtime error once, the other four times it just crashed back to the emulator main screen.

I removed the extension and tried again, the project again would not load.

So thumbs down for the emulator all round from me at the moment.

Given that you do not have a real device, (you've been working on AppInventor for 6 years, and no real device ?) I suggest you try Genymotion, which provides an Android 10 emulator. This runs well on Linux, you need to use the Emulator.apk for x86, and also use tick the Legacy box. Ensure you set the virtual device to "bridged" in the settings so that the emulator is running on the same network. Oh, you will probably need @ 1.5gb of RAM.

Hi
Thanks for your help.

I think we are very close to isolate the problem.

In fact I do install the Genymotion. In the process, I must update the adb executable on the GNU/Linux side, install the ARM_Translation on the emulated Android device and reconfigure my VirtuallBox network's) but, at the end, all worked really fine. I will explore this new (for me) environment in the near future.

The bad news: I do receive exactly the same error.

I know it's not easy, but belive me I don´t use cel phone :slight_smile:

The good news:
I tried using my wife's phone and, like we expected, all works fine. So the problem is related to the emulator (all of them, the AppInventor bundled, the Android SDK bundled and the Genymotion)

After connect the real device I do try again with the emulated device and all worked!

In brief:
The problem "dissapear" after we establish a connection with a real device. In order to make it fail you must start a fresh work session (close your AI2 session, stop the aiStarter, emulator) and try to establish a connection with the emulated device without connect your real device. In my environment this cause a error 100% of the times.

Now I suspect that Rendezvous server/connection can be related to this error
¿What do you think?

Gus

Companion 2.63 on Huawei P10 Lite Android 8 wired via USB. APK works ok on the same phone.

Error from Companion: java.lang.RuntimeException: invalid syntax in eval form: :2300:1: caught exception in inliner for # - java.lang.RuntimeException: no such class: com.sunny.CustomWebView.CustomWebView ..........

Hello, I have the same problem (the first message in this conversation). I'm using Windows 11 + Chrome. I have just installed the AppInventor 2 software, so it is updated. I'm a teacher and I can't use mobile devices with my students. So, I really need this emulator working.

Could anyone help me?

Your errors are consistent with an outdated Companion, which loads separately from the emulator.

For a more current emulator and Companion, see the first link in

The newer emulator comes preloaded with a more current Companion.

Thank you! It worked :slight_smile:

Hello, I also teach with AppInventor and have the same issue as vita_h. ABG user told to use the "current emulator ... see the first link". Do you mean the Emulator Open Beta (MIT_App_Inventor_Tools_30.263.0_win_setup64.exe)?

I tried it and it worked, but this file is much larger than version 2.3.0. Also the installation crashed when it tried to install Intel Hardware Accelerated Execution Manager due to missing system requirements. Do I have to install this version now on any classroom pc anyway for using App Inventor?

Thank you :slight_smile:

I have a Windows 11 laptop like that.
I use an Android phone when testing on that laptop, to avoid the aggravation of emulation.

Here's what I have heard about different emulators ...

What are the technical specs for the computer where the emulator is crashing? The Intel HAXM support is only for 64-bit Intel processors so that might be a source of your issue.