BlocklyCompile Errors Prevent Successly Building App Inventor

Here is what the terminal spits out after running the command ant:
buildlog.txt (36.7 KB)

I haven't made any changes to the source, the goal is to try to build App Inventor and run it locally on my machine, which makes this build failing even more confusing because it's not like there is a syntax error or something in the code.

I did run the command git submodule update --init before building.

I also ran buildtools doctor before building and it returned:

Diagnosing your system...

[PASS] Java is installed.
[PASS] Required version of Java is installed.
[PASS] Git is installed.
[PASS] Git submodules are properly set up.
[PASS] Google Cloud SDK is installed.

Passed 5 checks and 0 failing

The fact that I get a pass on Git submodules are properly set up. is what is tripping me up because that would mean Blockly is correctly set up on my machine. If that's the case, why is BlocklyCompile running into errors?

(This is also in the attached text file, located at the bottom, this is part of the file that I'd like to focus on)

BlocklyCompile:
     [java] Exception in thread "main" java.lang.ExceptionInInitializerError
     [java]     at org.plovr.cli.BuildCommand.runCommandWithOptions(BuildCommand.java:58)
     [java]     at org.plovr.cli.BuildCommand.runCommandWithOptions(BuildCommand.java:31)
     [java]     at org.plovr.cli.AbstractCommandRunner.runCommand(AbstractCommandRunner.java:41)
     [java]     at org.plovr.cli.Command.execute(Command.java:47)
     [java]     at org.plovr.cli.Main.mainWithExitCode(Main.java:56)
     [java]     at org.plovr.cli.Main.main(Main.java:30)
     [java] Caused by: com.google.inject.internal.util.$ComputationException: java.lang.ExceptionInInitializerError
     [java]     at com.google.inject.internal.util.$MapMaker$StrategyImpl.compute(MapMaker.java:553)
     [java]     at com.google.inject.internal.util.$MapMaker$StrategyImpl.compute(MapMaker.java:419)
     [java]     at com.google.inject.internal.util.$CustomConcurrentHashMap$ComputingImpl.get(CustomConcurrentHashMap.java:2041)
     [java]     at com.google.inject.internal.FailableCache.get(FailableCache.java:50)
     [java]     at com.google.inject.internal.ConstructorInjectorStore.get(ConstructorInjectorStore.java:49)
     [java]     at com.google.inject.internal.ConstructorBindingImpl.initialize(ConstructorBindingImpl.java:125)
     [java]     at com.google.inject.internal.InjectorImpl.initializeBinding(InjectorImpl.java:507)
     [java]     at com.google.inject.internal.AbstractBindingProcessor$Processor$1.run(AbstractBindingProcessor.java:159)
     [java]     at com.google.inject.internal.ProcessedBindingData.initializeBindings(ProcessedBindingData.java:44)
     [java]     at com.google.inject.internal.InternalInjectorCreator.initializeStatically(InternalInjectorCreator.java:122)
     [java]     at com.google.inject.internal.InternalInjectorCreator.build(InternalInjectorCreator.java:106)
     [java]     at com.google.inject.Guice.createInjector(Guice.java:95)
     [java]     at com.google.inject.Guice.createInjector(Guice.java:72)
     [java]     at com.google.inject.Guice.createInjector(Guice.java:62)
     [java]     at com.google.template.soy.GuiceInitializer.initializeIfNecessary(GuiceInitializer.java:55)
     [java]     at com.google.template.soy.SoyFileSet$Builder.<init>(SoyFileSet.java:141)
     [java]     at com.google.template.soy.SoyFileSet$Builder.<init>(SoyFileSet.java:125)
     [java]     at org.plovr.CompileRequestHandler.<clinit>(CompileRequestHandler.java:33)
     [java]     ... 6 more
     [java] Caused by: java.lang.ExceptionInInitializerError
     [java]     at com.google.inject.internal.cglib.reflect.$FastClassEmitter.<init>(FastClassEmitter.java:67)
     [java]     at com.google.inject.internal.cglib.reflect.$FastClass$Generator.generateClass(FastClass.java:72)
     [java]     at com.google.inject.internal.cglib.core.$DefaultGeneratorStrategy.generate(DefaultGeneratorStrategy.java:25)
     [java]     at com.google.inject.internal.cglib.core.$AbstractClassGenerator.create(AbstractClassGenerator.java:216)
     [java]     at com.google.inject.internal.cglib.reflect.$FastClass$Generator.create(FastClass.java:64)
     [java]     at com.google.inject.internal.BytecodeGen.newFastClass(BytecodeGen.java:207)
     [java]     at com.google.inject.internal.DefaultConstructionProxyFactory.create(DefaultConstructionProxyFactory.java:53)
     [java]     at com.google.inject.internal.ProxyFactory.create(ProxyFactory.java:153)
     [java]     at com.google.inject.internal.ConstructorInjectorStore.createConstructor(ConstructorInjectorStore.java:89)
     [java]     at com.google.inject.internal.ConstructorInjectorStore.access$000(ConstructorInjectorStore.java:28)
     [java]     at com.google.inject.internal.ConstructorInjectorStore$1.create(ConstructorInjectorStore.java:36)
     [java]     at com.google.inject.internal.ConstructorInjectorStore$1.create(ConstructorInjectorStore.java:32)
     [java]     at com.google.inject.internal.FailableCache$1.apply(FailableCache.java:39)
     [java]     at com.google.inject.internal.util.$MapMaker$StrategyImpl.compute(MapMaker.java:549)
     [java]     ... 23 more
     [java] Caused by: java.lang.reflect.InaccessibleObjectException: Unable to make protected final java.lang.Class java.lang.ClassLoader.defineClass(java.lang.String,byte[],int,int,java.security.ProtectionDomain) throws java.lang.ClassFormatError accessible: module java.base does not "opens java.lang" to unnamed module @762efe5d
     [java]     at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:354)
     [java]     at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:297)
     [java]     at java.base/java.lang.reflect.Method.checkCanSetAccessible(Method.java:199)
     [java]     at java.base/java.lang.reflect.Method.setAccessible(Method.java:193)
     [java]     at com.google.inject.internal.cglib.core.$ReflectUtils$2.run(ReflectUtils.java:56)
     [java]     at java.base/java.security.AccessController.doPrivileged(AccessController.java:318)
     [java]     at com.google.inject.internal.cglib.core.$ReflectUtils.<clinit>(ReflectUtils.java:46)
     [java]     ... 37 more

BUILD FAILED
C:\Users\Current User\Documents\MIT App Inventor\appinventor-sources\appinventor\build.xml:16: The following error occurred while executing this line:
C:\Users\Current User\Documents\MIT App Inventor\appinventor-sources\appinventor\build-common.xml:299: The following error occurred while executing this line:
C:\Users\Current User\Documents\MIT App Inventor\appinventor-sources\appinventor\blocklyeditor\build.xml:120: Java returned: 1

java -version:

openjdk version "17.0.1" 2021-10-19
OpenJDK Runtime Environment (build 17.0.1+12-39)
OpenJDK 64-Bit Server VM (build 17.0.1+12-39, mixed mode, sharing)

ant -version:

Apache Ant(TM) version 1.10.12 compiled on October 13 2021

1 Like

add app inventor sources folder in exclusion or turn off your antivirus

I already tried and it still doesn't build

@karlv350 sir, is this a fresh copy of appinventor-sources or did you make any edits
if yes(if you made edits), then did you change anything related to Blockly?

I think its not a java or ant problem...

@karlv350 do you have Python Installed?

P.S: This too could be a reason:

The space between Current User and in the MIT App Inventor DIRs may cause the problem, but I think this PR solved that issue :thinking:

Yes, it's a fresh fork of the original source. I have not tampered anything. I mentioned this in the original post.

Yes I have Python 3.10.0 already installed.

I highly doubt the spaces are causing any trouble because other components of App Inventor are able to build just fine. I can investigate this though.

1 Like

Sir did you fork and download it or clone is locally using this command - git clone https://github.com/YOUR_USER_NAME/appinventor-sources
because that too may cause any problem...

I cloned my fork

1 Like

Run git pull origin master in appinventor-sources folder

Can you elaborate why we should use it and what does that command does?

Hello @karlv350,
Appinventor is designed to build and run on Java 8, using a later java version could cause multiple errors in different parts of the sources.

The output of the java -version command you posted indicates you have Java 17 installed, please try to downgrade to java 8, restart the terminal, and try again to build the sources.

Note: Spaces in the path of the Appinventor clone should cause no problems if the fork is using the latest Appinventor sources.

5 Likes

@karlv350 as I see in your main post you have installed java 17.0.1 instead of java 1.8.x

App inventor is complied with java 1.8.x

You can also see this in the README file of the project ...

(Last line of the introduction section.)

It means if the master branch was updated with the new features then you need to pull the code from remote repository to local repository otherwise you could not be able to access new features of the app inventor.

2 Likes

I'll try to compile using Java 8. Is there a preference between OpenJDK and Oracle though? Would a JDK from either work fine, as long as it's Java 8? Also, if you don't mind, can you post a link to a Java 8 JDK download. This might be a case of me just being bad at googling things, but the reason why I used the latest Java version from OpenJDK is because I couldn't find specifically version Java 8 on their website

https://www.oracle.com/java/technologies/javase/javase8u211-later-archive-downloads.html

1 Like

No, both should work fine with appinventor, as long as they are java 8.

@dora_paz has posted the link for Oracle's JDK. you can also find OpenJDK's downloads from here:
Latest release | AdoptOpenJDK - Open source, prebuilt OpenJDK binaries

2 Likes

Yup, I guess my Java version was messing things up. I used OpenJDK's Java 8 JDK and successfully compiled the entire project. Seeing that BUILD SUCCESSFUL message after 3 minutes of compiling was so relieving, haha. Thank you guys for the help!

4 Likes

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.