Cannot build for Android even with debug key

This is the error I am getting. It is on a Mac using Solar2d 3640 and using the ore provided inside the simulator. Have tried using different versions of Java but all fail with different types of errors. I assume the are packaged with the simulator should work. Same problem on both Big Sur or Catalina. Please help. It appears to be a problem with the dynamic loading of a class that does not implement one of the methods.

Testing credentials for '/Applications/Corona-3640/Resource Library/Android/debug.keystore': 
Mar 25 08:20:05.920 Picked up JAVA_TOOL_OPTIONS: -Duser.language=en
Mar 25 08:20:06.317 Exception in thread "main" 
Mar 25 08:20:06.326 java.lang.NoSuchMethodError: com.sun.jarsigner.ContentSignerParameters.getTSAPolicyID()Ljava/lang/String;
Mar 25 08:20:06.326 	at sun.security.tools.jarsigner.TimestampedSigner.generateSignedData(TimestampedSigner.java:141)
                    	at sun.security.tools.jarsigner.SignatureFile$Block.(Main.java:2807)
                    	at sun.security.tools.jarsigner.SignatureFile.generateBlock(Main.java:2704)
                    	at sun.security.tools.jarsigner.Main.signJar(Main.java:1669)
                    	at sun.security.tools.jarsigner.Main.run(Main.java:281)
                    	at sun.security.tools.jarsigner.Main.main(Main.java:128)

Have you been able to build an empty project? Otherwise, it could help if you could provide more details.

Thanks for the response. I have tried building the HelloWorld project supplied with the Solar2D distribution and it fails in the same way. It has to be something to do with the java environment. I have tried removing all versions of java so that it will use the one packed with the Solar2D distribution and it does. I also got a friend to try and build the same project on their Mac and it built OK. I am about to give up dn have ordered a cheap Windows laptop to just run Solar2D on.

The other strange thing about the Mac is it is not possible to remove the version of java in /usr/bin.