Help with ant build for appinventor-sources-old - Java returned: 137 and DX returned 1 errors

Hello everyone,

I'm trying to set up my local App Inventor development environment using the appinventor-sources-old branch. I have been facing persistent build errors. I have tried many troubleshooting steps but am now stuck.

My Goal: I need to successfully build the project to work on my first bug fix.

Problem Summary: The build fails after a few minutes with a BUILD FAILED message. The main error message is Java returned: 137. We have also seen DX returned an error code during the process.

What I Have Done:

  • I have manually applied a number of fixes to build.xml and other files to resolve initial compilation errors.
  • I have set the ANT_OPTS variable.
  • I have used the java -Xmx3g command to give the build process more memory, as my PC has 3.7Gi of RAM.
  • I have installed the required Android SDK Platform 19.

My System Information:

  • OS: Ubuntu
  • free -h output:

total used free shared buff/cache available Mem: 3.7Gi 430Mi 3.3Gi 504Ki 96Mi 3.3Gi Swap: 1.0Gi 99Mi 924Mi

Final Error Message:

[java] solution is to recompile the class from source, using an up-to-date compiler
[java] and without specifying any "-target" type options. The consequence of ignoring
[java] this warning is that reflective operations on this class will incorrectly
[java] indicate that it is not an inner class.
[java] warning: Ignoring InnerClasses attribute for an anonymous inner class
[java] (org.mortbay.jetty.servlet.HashSessionManager$2) that doesn't come with an
[java] associated EnclosingMethod attribute. This class was probably produced by a
[java] compiler that did not target the modern .class file format. The recommended
[java] solution is to recompile the class from source, using an up-to-date compiler
[java] and without specifying any "-target" type options. The consequence of ignoring
[java] this warning is that reflective operations on this class will incorrectly
[java] indicate that it is not an inner class.
[java] warning: Ignoring InnerClasses attribute for an anonymous inner class
[java] (org.mortbay.resource.JarResource$1) that doesn't come with an
[java] associated EnclosingMethod attribute. This class was probably produced by a
[java] compiler that did not target the modern .class file format. The recommended
[java] solution is to recompile the class from source, using an up-to-date compiler
[java] and without specifying any "-target" type options. The consequence of ignoring
[java] this warning is that reflective operations on this class will incorrectly
[java] indicate that it is not an inner class.
[java] warning: Ignoring InnerClasses attribute for an anonymous inner class
[java] (org.mortbay.xml.XmlParser$Node$1) that doesn't come with an
[java] associated EnclosingMethod attribute. This class was probably produced by a
[java] compiler that did not target the modern .class file format. The recommended
[java] solution is to recompile the class from source, using an up-to-date compiler
[java] and without specifying any "-target" type options. The consequence of ignoring
[java] this warning is that reflective operations on this class will incorrectly
[java] indicate that it is not an inner class.
[java] 2 errors; aborting
[java] [RunMultidex] ERROR: DX returned an error code
[java] [RunMultidex] Task errored in 34.818 seconds

BUILD FAILED
/home/muskan/appinventor-sources-old/appinventor/build.xml:22: The following error occurred while executing this line:
/home/muskan/appinventor-sources-old/appinventor/buildserver/build.xml:222: Java returned: 1

Total time: 4 minutes 13 seconds

Thank you for your help.

You need to post the entire log. The error likely occurred earlier and what you've included only shows the error count.

Build failure after fixing a previous issue: DX returned an error code

Hi @ewpatton ,

Hope you're doing well.

Thank you for your last message. I managed to solve the previous build error (Java returned: 137) that I was stuck on.

However, after fixing that, I've now encountered a new build failure. The error message is DX returned an error code, which seems to be related to a multidex issue.

To fix it, I tried these steps:

  1. Running the ant command with -Dappinventor.multidex=true
  2. Also adding the Java compiler flags -Dbuild.compiler.source=1.6 -Dbuild.compiler.target=1.6 along with the multidex flag.
  3. I even tried adding <property name="appinventor.multidex" value="true"/> directly to the buildserver/build.xml file.

Unfortunately, none of these attempts worked, and the build is still failing with the same error.

I tried to post the full error log, but it was too long and exceeded the character limit for new users on the forum.

I've pasted the most critical part of the log below. It contains the key errors at the end of the build process. If you need the full log, I can upload it to Google Drive and share the link.

Could you please help me with this?

Thanks, Muskan Kumari

 [java] warning: Ignoring InnerClasses attribute for an anonymous inner class
     [java] (org.mortbay.jetty.HttpFields$3) that doesn't come with an
     [java] associated EnclosingMethod attribute. This class was probably produced by a
     [java] compiler that did not target the modern .class file format. The recommended
     [java] solution is to recompile the class from source, using an up-to-date compiler
     [java] and without specifying any "-target" type options. The consequence of ignoring
     [java] this warning is that reflective operations on this class will incorrectly
     [java] indicate that it is *not* an inner class.
     [java] warning: Ignoring InnerClasses attribute for an anonymous inner class
     [java] (org.mortbay.jetty.HttpFields$5) that doesn't come with an
     [java] associated EnclosingMethod attribute. This class was probably produced by a
     [java] compiler that did not target the modern .class file format. The recommended
     [java] solution is to recompile the class from source, using an up-to-date compiler
     [java] and without specifying any "-target" type options. The consequence of ignoring
     [java] this warning is that reflective operations on this class will incorrectly
     [java] indicate that it is *not* an inner class.
     [java] warning: Ignoring InnerClasses attribute for an anonymous inner class
     [java] (org.mortbay.jetty.Request$1) that doesn't come with an
     [java] associated EnclosingMethod attribute. This class was probably produced by a
     [java] compiler that did not target the modern .class file format. The recommended
     [java] solution is to recompile the class from source, using an up-to-date compiler
     [java] and without specifying any "-target" type options. The consequence of ignoring
     [java] this warning is that reflective operations on this class will incorrectly
     [java] indicate that it is *not* an inner class.
     [java] warning: Ignoring InnerClasses attribute for an anonymous inner class
     [java] (org.mortbay.jetty.deployer.ContextDeployer$1) that doesn't come with an
     [java] associated EnclosingMethod attribute. This class was probably produced by a
     [java] compiler that did not target the modern .class file format. The recommended
     [java] solution is to recompile the class from source, using an up-to-date compiler
     [java] and without specifying any "-target" type options. The consequence of ignoring
     [java] this warning is that reflective operations on this class will incorrectly
     [java] indicate that it is *not* an inner class.
     [java] warning: Ignoring InnerClasses attribute for an anonymous inner class
     [java] (org.mortbay.jetty.nio.SelectChannelConnector$1) that doesn't come with an
     [java] associated EnclosingMethod attribute. This class was probably produced by a
     [java] compiler that did not target the modern .class file format. The recommended
     [java] solution is to recompile the class from source, using an up-to-date compiler
     [java] and without specifying any "-target" type options. The consequence of ignoring
     [java] this warning is that reflective operations on this class will incorrectly
     [java] indicate that it is *not* an inner class.
     [java] warning: Ignoring InnerClasses attribute for an anonymous inner class
     [java] (org.mortbay.jetty.security.HashUserRealm$1) that doesn't come with an
     [java] associated EnclosingMethod attribute. This class was probably produced by a
     [java] compiler that did not target the modern .class file format. The recommended
     [java] solution is to recompile the class from source, using an up-to-date compiler
     [java] and without specifying any "-target" type options. The consequence of ignoring
     [java] this warning is that reflective operations on this class will incorrectly
     [java] indicate that it is *not* an inner class.
     [java] warning: Ignoring InnerClasses attribute for an anonymous inner class
     [java] (org.mortbay.jetty.security.HashUserRealm$2) that doesn't come with an
     [java] associated EnclosingMethod attribute. This class was probably produced by a
     [java] compiler that did not target the modern .class file format. The recommended
     [java] solution is to recompile the class from source, using an up-to-date compiler
     [java] and without specifying any "-target" type options. The consequence of ignoring
     [java] this warning is that reflective operations on this class will incorrectly
     [java] indicate that it is *not* an inner class.
     [java] warning: Ignoring InnerClasses attribute for an anonymous inner class
     [java] (org.mortbay.jetty.security.SecurityHandler$1) that doesn't come with an
     [java] associated EnclosingMethod attribute. This class was probably produced by a
     [java] compiler that did not target the modern .class file format. The recommended
     [java] solution is to recompile the class from source, using an up-to-date compiler
     [java] and without specifying any "-target" type options. The consequence of ignoring
     [java] this warning is that reflective operations on this class will incorrectly
     [java] indicate that it is *not* an inner class.
     [java] warning: Ignoring InnerClasses attribute for an anonymous inner class
     [java] (org.mortbay.jetty.security.SecurityHandler$2) that doesn't come with an
     [java] associated EnclosingMethod attribute. This class was probably produced by a
     [java] compiler that did not target the modern .class file format. The recommended
     [java] solution is to recompile the class from source, using an up-to-date compiler
     [java] and without specifying any "-target" type options. The consequence of ignoring
     [java] this warning is that reflective operations on this class will incorrectly
     [java] indicate that it is *not* an inner class.
     [java] warning: Ignoring InnerClasses attribute for an anonymous inner class
     [java] (org.mortbay.jetty.security.SslSocketConnector$SslConnection$1) that doesn't come with an
     [java] associated EnclosingMethod attribute. This class was probably produced by a
     [java] compiler that did not target the modern .class file format. The recommended
     [java] solution is to recompile the class from source, using an up-to-date compiler
     [java] and without specifying any "-target" type options. The consequence of ignoring
     [java] this warning is that reflective operations on this class will incorrectly
     [java] indicate that it is *not* an inner class.
     [java] warning: Ignoring InnerClasses attribute for an anonymous inner class
     [java] (org.mortbay.jetty.servlet.HashSessionManager$1) that doesn't come with an
     [java] associated EnclosingMethod attribute. This class was probably produced by a
     [java] compiler that did not target the modern .class file format. The recommended
     [java] solution is to recompile the class from source, using an up-to-date compiler
     [java] and without specifying any "-target" type options. The consequence of ignoring
     [java] this warning is that reflective operations on this class will incorrectly
     [java] indicate that it is *not* an inner class.
     [java] warning: Ignoring InnerClasses attribute for an anonymous inner class
     [java] (org.mortbay.jetty.servlet.HashSessionManager$2) that doesn't come with an
     [java] associated EnclosingMethod attribute. This class was probably produced by a
     [java] compiler that did not target the modern .class file format. The recommended
     [java] solution is to recompile the class from source, using an up-to-date compiler
     [java] and without specifying any "-target" type options. The consequence of ignoring
     [java] this warning is that reflective operations on this class will incorrectly
     [java] indicate that it is *not* an inner class.
     [java] warning: Ignoring InnerClasses attribute for an anonymous inner class
     [java] (org.mortbay.resource.JarResource$1) that doesn't come with an
     [java] associated EnclosingMethod attribute. This class was probably produced by a
     [java] compiler that did not target the modern .class file format. The recommended
     [java] solution is to recompile the class from source, using an up-to-date compiler
     [java] and without specifying any "-target" type options. The consequence of ignoring
     [java] this warning is that reflective operations on this class will incorrectly
     [java] indicate that it is *not* an inner class.
     [java] warning: Ignoring InnerClasses attribute for an anonymous inner class
     [java] (org.mortbay.xml.XmlParser$Node$1) that doesn't come with an
     [java] associated EnclosingMethod attribute. This class was probably produced by a
     [java] compiler that did not target the modern .class file format. The recommended
     [java] solution is to recompile the class from source, using an up-to-date compiler
     [java] and without specifying any "-target" type options. The consequence of ignoring
     [java] this warning is that reflective operations on this class will incorrectly
     [java] indicate that it is *not* an inner class.
     [java] 2 errors; aborting
     [java] [RunMultidex] ERROR: DX returned an error code
     [java] [RunMultidex] Task errored in 27.861 seconds

BUILD FAILED
/home/muskan/appinventor-sources-old/appinventor/build.xml:22: The following error occurred while executing this line:
/home/muskan/appinventor-sources-old/appinventor/buildserver/build.xml:223: Java returned: 1

Total time: 41 seconds