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:

Hi All we keep getting this java error when trying to emulate projects any help would be appreciated error is below

Error from Companion: java.lang.RuntimeException: invalid syntax in eval form: :8:1: caught exception in inliner for # - java.lang.RuntimeException: no such class: com.google.appinventor.components.runtime.com.google.appinventor.components.runtime.Canvas gnu.bytecode.ObjectType.getReflectClass(ObjectType.java:148) gnu.bytecode.ClassType.getModifiers(ClassType.java:103) gnu.bytecode.ClassType.isInterface(ClassType.java:471) gnu.expr.InlineCalls.checkType(InlineCalls.java:56) gnu.expr.InlineCalls.visit(InlineCalls.java:49) gnu.expr.InlineCalls.visitSetExpValue(InlineCalls.java:363) gnu.expr.InlineCalls.visitSetExpValue(InlineCalls.java:28) gnu.expr.ExpVisitor.visitSetExp(ExpVisitor.java:114) gnu.expr.InlineCalls.visitSetExp(InlineCalls.java:369) gnu.expr.InlineCalls.visitSetExp(InlineCalls.java:28) gnu.expr.SetExp.visit(SetExp.java:406) gnu.expr.ExpVisitor.visit(ExpVisitor.java:55) gnu.expr.InlineCalls.visit(InlineCalls.java:46) gnu.expr.InlineCalls.visitBeginExp(InlineCalls.java:272) gnu.expr.InlineCalls.visitBeginExp(InlineCalls.java:28) gnu.expr.BeginExp.visit(BeginExp.java:156) gnu.expr.ExpVisitor.visit(ExpVisitor.java:51) gnu.expr.InlineCalls.visit(InlineCalls.java:46) gnu.expr.InlineCalls.visitBeginExp(InlineCalls.java:272) gnu.expr.InlineCalls.visitBeginExp(InlineCalls.java:28) gnu.expr.BeginExp.visit(BeginExp.java:156) gnu.expr.ExpVisitor.visit(ExpVisitor.java:51) gnu.expr.InlineCalls.visit(InlineCalls.java:46) gnu.expr.InlineCalls.visitLetExp(InlineCalls.java:317) gnu.expr.InlineCalls.visitLetExp(InlineCalls.java:28) gnu.expr.LetExp.visit(LetExp.java:207) gnu.expr.ExpVisitor.visit(ExpVisitor.java:51) gnu.expr.InlineCalls.visit(InlineCalls.java:46) gnu.expr.InlineCalls.visit(InlineCalls.java:28) gnu.expr.LambdaExp.visitChildrenOnly(LambdaExp.java:1664) gnu.expr.LambdaExp.visitChildren(LambdaExp.java:1651) gnu.expr.InlineCalls.visitScopeExp(InlineCalls.java:279) gnu.expr.InlineCalls.visitLambdaExp(InlineCalls.java:349) gnu.expr.InlineCalls.visitLambdaExp(InlineCalls.java:28) gnu.expr.LambdaExp.visit(LambdaExp.java:1640) gnu.expr.ExpVisitor.visit(ExpVisitor.java:55) gnu.expr.InlineCalls.visit(InlineCalls.java:46) gnu.expr.InlineCalls.visit(InlineCalls.java:28) gnu.expr.ExpVisitor.visitAndUpdate(ExpVisitor.java:162) gnu.expr.ExpVisitor.visitExps(ExpVisitor.java:176) gnu.expr.ApplyExp.visitArgs(ApplyExp.java:416) gnu.kawa.reflect.CompileInvoke.validateApplyInvoke(CompileInvoke.java:23) java.lang.reflect.Method.invokeNative(Native Method) java.lang.reflect.Method.invoke(Method.java:521) gnu.expr.InlineCalls.maybeInline(InlineCalls.java:467) gnu.expr.QuoteExp.validateApply(QuoteExp.java:150) gnu.expr.ReferenceExp.validateApply(ReferenceExp.java:191) gnu.kawa.functions.CompilationHelpers.validateApplyToArgs(CompilationHelpers.java:66) java.lang.reflect.Method.invokeNative(Native Method) java.lang.reflect.Method.invoke(Method.java:521) gnu.expr.InlineCalls.maybeInline(InlineCalls.java:467) gnu.expr.QuoteExp.validateApply(QuoteExp.java:150) gnu.expr.ReferenceExp.validateApply(ReferenceExp.java:191) gnu.expr.InlineCalls.visitApplyExp(InlineCalls.java:119) gnu.expr.InlineCalls.visitApplyExp(InlineCalls.java:28) gnu.expr.ApplyExp.visit(ApplyExp.java:411) gnu.expr.ExpVisitor.visit(ExpVisitor.java:55) gnu.expr.InlineCalls.visit(InlineCalls.java:46) gnu.expr.QuoteExp.validateApply(QuoteExp.java:162) gnu.expr.ReferenceExp.validateApply(ReferenceExp.java:191) gnu.kawa.functions.CompilationHelpers.validateApplyToArgs(CompilationHelpers.java:66) java.lang.reflect.Method.invokeNative(Native Method) java.lang.reflect.Method.invoke(Method.java:521) gnu.expr.InlineCalls.maybeInline(InlineCalls.java:467) gnu.expr.QuoteExp.validateApply(QuoteExp.java:150) gnu.expr.ReferenceExp.validateApply(ReferenceExp.java:191) gnu.expr.InlineCalls.visitApplyExp(InlineCalls.java:119) gnu.expr.InlineCalls.visitApplyExp(InlineCalls.java:28) gnu.expr.ApplyExp.visit(ApplyExp.java:411) gnu.expr.ExpVisitor.visit(ExpVisitor.java:51) gnu.expr.InlineCalls.visit(InlineCalls.java:46) gnu.expr.InlineCalls.visitBeginExp(InlineCalls.java:272) gnu.expr.InlineCalls.visitBeginExp(InlineCalls.java:28) gnu.expr.BeginExp.visit(BeginExp.java:156) gnu.expr.ExpVisitor.visit(ExpVisitor.java:51) gnu.expr.InlineCalls.visit(InlineCalls.java:46) gnu.expr.InlineCalls.visit(InlineCalls.java:28) gnu.expr.LambdaExp.visitChildrenOnly(LambdaExp.java:1664) gnu.expr.LambdaExp.visitChildren(LambdaExp.java:1651) gnu.expr.InlineCalls.visitScopeExp(InlineCalls.java:279) gnu.expr.InlineCalls.visitLambdaExp(InlineCalls.java:349) gnu.expr.InlineCalls.visitLambdaExp(InlineCalls.java:28) gnu.expr.ExpVisitor.visitModuleExp(ExpVisitor.java:103) gnu.expr.ModuleExp.visit(ModuleExp.java:482) gnu.expr.ExpVisitor.visit(ExpVisitor.java:51) gnu.expr.InlineCalls.visit(InlineCalls.java:46) gnu.expr.InlineCalls.inlineCalls(InlineCalls.java:33) gnu.expr.Compilation.walkModule(Compilation.java:994) gnu.expr.Compilation.process(Compilation.java:1965) gnu.expr.ModuleInfo.loadByStages(ModuleInfo.java:330) gnu.expr.ModuleExp.evalModule1(ModuleExp.java:238) gnu.expr.ModuleExp.evalModule(ModuleExp.java:198) gnu.expr.Language.eval(Language.java:943) gnu.expr.Language.eval(Language.java:883) gnu.expr.Language.eval(Language.java:865) com.google.appinventor.components.runtime.util.AppInvHTTPD.serve(AppInvHTTPD.java:188) com.google.appinventor.components.runtime.util.NanoHTTPD$HTTPSession.run(NanoHTTPD.java:470) java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1068) java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:561) java.lang.Thread.run(Thread.java:1096)

Are you using the very latest companion app ?

We installed MIT_Appinventor_Tools_2.3.0

image

Is this for PC?

Perhaps you need to explain your setup.....

Sorry it is on windows PC when running the aistarter and emulator, the emulator doesn't load the project and then the java error come up on the web page

I believe this is a bug in the latest release (nb189), that affects the emulator.I do not see this error when using the companioi app with a real device.

Ah okay thanks, have started another topic about using a real device over separate vlans not sure if this is something you'd be able to help with.

I have the same error with all my extensions.
In order to reproduce it, just create a new project and add any extension. In the moment that you drop the extension to the Screen you get the error.
I try using both emulators (AppInventor and Android SDK), different companion versions, and extensions (in fact I do compile a very basic extension), but I do have the same 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:" followed with the extension Class name
I can do any test that can help to diagnose the problem.
Thanks
Gus

In case you want to try other emulators, to decouple the emulator from the Companion version, see

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