Cannot build for Android

On several different projects, I am unable to get a successful build. This is after updating to MacOS Big Sur, this is the only change I have made. Here is the log:


Using java version “15.0.1” 2020-10-20
Java™ SE Runtime Environment (build 15.0.1+9-18)
Java HotSpot™ 64-Bit Server VM (build 15.0.1+9-18, mixed mode, sharing)
Dec 01 16:44:52.345 BUILD SUCCESSFUL
Total time: 1 second
Dec 01 16:45:06.108 Excluding specified files from build:
excluding: .ignore/*

                FAILURE: Build failed with an exception.
                
                * What went wrong:
                Execution failed for task ':App:compileReleaseJavaWithJavac'.
                > Could not find tools.jar. Please check that /Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home contains a valid JDK installation.
                
                * Try:
                Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
                
                * Get more help at https://help.gradle.org
                
                BUILD FAILED in 13s

Dec 01 16:45:06.220 Android build failed (256) after 16 seconds

I don’t know where I am supposed to find ‘tools.jar’, I have checked the path in the log, and found nothing there. I have made sure I have installed JDK

Can you try installing JDK8 as linked in the documentation?

Also, if you are using the latest build (2020.3627) the solution might be in the notes.

**NOTE:**
It seems that building on macOS is broken due to some signing/Xcode 12.2 issues. To fix iOS/Android build run

sudo xattr -dr com.apple.quarantine /Applications/Corona-*

This is a temporary fix while issue is being investigated.

If it does not work please take a look at what others did to solve the issue. I see there are several other topics about this error code - https://forums.solar2d.com/search?q=error%20256

Yes, as noted in the original post, I have followed the instructions to install JDK 8. Also, I have already followed the instructions in the latest build regarding the signing issue. I have also already perused the forums for a solution to my problem before making a post. Most of the posts are from several years ago, and not relevant to the current problem. Again the ONLY change I made was upgrading to OS Big Sur. Prior to that, I have had 0 issues building for Android.

Additionally, I am using the latest build, and found no solution in the patch notes, nor in the more recent ones.

The solution was to install both JDK and JRE, then copy tools.jar from the JDK lib folder to the JRE lib folder. I am not sure if the problem is with Solar2D. How does it determine where to look for the Java installation? Running /usr/libexec/java_home provides the path to the JDK, and I have made sure that the JDK directory is included in the PATH variable.

FWIW, for me, installing jdk-12.0.2 with the current version of gradle worked. I don’t understand any of this, but it worked for my setup and allowed me to finally build for android.

The necessary Java components are bundled with Solar2D these days, so it shouldn’t matter what JDK you have installed (or if you don’t have JDK installed at all) as long as you are using at least Solar2D 2020.3631.

I installed Solar on Windows first, then on Mac weeks later. In both cases I got the “Gradle/can’t find jar/JDE” nightmare. Maybe it’s just me. BTW I have to reinstall Solar a lot because McAfee will not let me keep lua.dll but at least I know that I’m current.