Unable to compile using Ant

Hi, I just cloned the appinventor repo and I am trying to compile it but I'm getting the following error:

[java] Generated 497 files
[java] Included 0 files from jar/zip files.
[java] Checking for deleted files
[java] Done!
     [java] Apr 14, 2022 9:12:51 AM com.google.appinventor.buildserver.Compiler runAaptPackage
     [java] INFO: AAPT time: 0.977 seconds
     [java] Annotation processing got disabled, since it requires a 1.6 compliant JVM
     [java] ----------
     [java] 1. ERROR in /tmp/1649907767233_0.6779229595555606-0/build/generated/src/androidx/constraintlayout/widget/R.java (at line 1)
     [java] 	// AUTO-GENERATED FILE.  DO NOT MODIFY. 
     [java] 	^
     [java] The type java.lang.Object cannot be resolved. It is indirectly referenced from required .class files
     [java] ----------
     [java] 2. ERROR in /tmp/1649907767233_0.6779229595555606-0/build/generated/src/androidx/constraintlayout/widget/R.java (at line 9)
     [java] 	public final class R {
     [java] 	                   ^
     [java] Implicit super constructor Object() is undefined for default constructor. Must define an explicit constructor
     [java] ----------
     [java] 3. ERROR in /tmp/1649907767233_0.6779229595555606-0/build/generated/src/androidx/constraintlayout/widget/R.java (at line 10)
     [java] 	public static final class attr {
     [java] 	                          ^^^^
     [java] Implicit super constructor Object() is undefined for default constructor. Must define an explicit constructor
     [java] ----------
     .
     .
     .
     [java] 195. ERROR in /tmp/1649907767233_0.6779229595555606-0/build/generated/src/org/osmdroid/library/R.java (at line 10)
     [java] 	public static final class drawable {
     [java] 	                          ^^^^^^^^
     [java] Implicit super constructor Object() is undefined for default constructor. Must define an explicit constructor
     [java] ----------
     [java] 196. ERROR in /tmp/1649907767233_0.6779229595555606-0/build/generated/src/org/osmdroid/library/R.java (at line 34)
     [java] 	public static final class id {
     [java] 	                          ^^
     [java] Implicit super constructor Object() is undefined for default constructor. Must define an explicit constructor
     [java] ----------
     [java] 197. ERROR in /tmp/1649907767233_0.6779229595555606-0/build/generated/src/org/osmdroid/library/R.java (at line 41)
     [java] 	public static final class layout {
     [java] 	                          ^^^^^^
     [java] Implicit super constructor Object() is undefined for default constructor. Must define an explicit constructor
     [java] ----------
     [java] 198. ERROR in /tmp/1649907767233_0.6779229595555606-0/build/generated/src/org/osmdroid/library/R.java (at line 44)
     [java] 	public static final class string {
     [java] 	                          ^^^^^^
     [java] Implicit super constructor Object() is undefined for default constructor. Must define an explicit constructor
     [java] ----------
     [java] 198 problems (198 errors)
     [java] javac returned error code 1

./buildtools doctor returned this

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

I am using

javac 1.8.0_312
openjdk version "1.8.0_312"
OpenJDK Runtime Environment (build 1.8.0_312-8u312-b07-0ubuntu1~21.10-b07)
OpenJDK 64-Bit Server VM (build 25.312-b07, mixed mode)

My operating system is Ubuntu, so does it have to do anything with why the code is not compiling?

I had not set JAVA_HOME to path
So,

export PATH=$JAVA_HOME/jre/bin:$PATH

Worked!

1 Like

Great! Click the "Solution" icon on your post to mark it as a solution, so people reading this next time will know the solution.

1 Like