Issue running Meteor.js Android App on Mac M1

Environment

  • Operating System: Mac M1 Ventura 13.0
export JAVA_HOME="/Library/Java/JavaVirtualMachines/zulu-8.jdk/Contents/Home"
export ANDROID_HOME=$HOME/Library/Android/sdk
export ANDROID_SDK_ROOT=${ANDROID_HOME}
export PATH=${PATH}:${ANDROID_HOME}/emulator
export PATH=$PATH:$ANDROID_HOME/tools:$ANDROID_HOME/platform-tools

Meteor.js

version@2.12
cordova-android@10.1.2
android-targetSdkVersion 31

Installed Packages

  • Gradle 7.5.1
  • Android SDK Build Tools 34.0.0-rc4
  • Android SDK Command Line Tools 9.0
  • Android Emulator 32.1.12
  • Android SDK Platform-Tools 34.0.1
> Task :CordovaLib:compileDebugJavaWithJavac FAILED
An exception has occurred in the compiler (1.8.0_332). Please file a bug against the Java compiler via the Java bug reporting page (http://bugreport.java.com) after checking the Bug Database (http://bugs.java.com) for duplicates. Include your program and the following diagnostic in your report. Thank you.pp on Android Emulator          /
java.lang.AssertionError: annotationType(): unrecognized Attribute name MODULE (class com.sun.tools.javac.util.UnsharedNameTable$NameImpl)
        at com.sun.tools.javac.util.Assert.error(Assert.java:133)
        at com.sun.tools.javac.code.TypeAnnotations.annotationType(TypeAnnotations.java:231)
        at com.sun.tools.javac.code.TypeAnnotations$TypeAnnotationPositions.separateAnnotationsKinds(TypeAnnotations.java:294)
        at com.sun.tools.javac.code.TypeAnnotations$TypeAnnotationPositions.visitMethodDef(TypeAnnotations.java:1066)
        at com.sun.tools.javac.tree.JCTree$JCMethodDecl.accept(JCTree.java:778)
        at com.sun.tools.javac.tree.TreeScanner.scan(TreeScanner.java:49)

Description

I’m trying to run my Meteor.js Android app using the meteor run android command on Mac M1, but I’m encountering errors. I have set up the necessary environment variables, installed the required packages and tools, but I’m still getting an error when compiling the app with CordovaLib:compileDebugJavaWithJavac.

The error message indicates an issue with the Java compiler. Specifically, the error message suggests that the MODULE attribute is unrecognized by the compiler. I’m unsure how to resolve this error, and I would appreciate any assistance in resolving this issue.

When I researched the error above, I saw a few places that said I should use java 1.11 above and I tried it, and in this case I am getting the error below.

Your system does not yet seem to fulfill all requirements to build apps for Android.
                                              
Please follow the installation instructions in the mobile guide:
http://guide.meteor.com/cordova.html#installing-prerequisites
                                              
Status of the individual requirements:        
✓ Java JDK                                    
✓ Android SDK                                 
✗ Android target: Command failed with exit code 1: avdmanager list target
            Exception in thread "main" java.lang.NoClassDefFoundError: javax/xml/bind/annotation/XmlSchema
                at com.android.repository.api.SchemaModule$SchemaModuleVersion.<init>(SchemaModule.java:156)
                at com.android.repository.api.SchemaModule.<init>(SchemaModule.java:75)
                at com.android.sdklib.repository.AndroidSdkHandler.<clinit>(AndroidSdkHandler.java:81)
                at com.android.sdklib.tool.AvdManagerCli.run(AvdManagerCli.java:213)
                at com.android.sdklib.tool.AvdManagerCli.main(AvdManagerCli.java:200)
            Caused by: java.lang.ClassNotFoundException: javax.xml.bind.annotation.XmlSchema
                at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:641)
                at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:188)
                at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
                ... 5 more
✓ Gradle 

Solution note for friends who have problems like me:

It was due to the cordova plugin that I did not mention above and escaped my attention.

cordova-plugin-qrscanner@2.6.0

What was the solution to resolve that plugin in the end, was it an upgrade, replacement or removal?

Actually I was not able to run cordova-plugin-qrscanner@2.6.0 package with andorid api 31. I tried the phonegap-plugin-barcodescanner@8.0.1 packages. The room did not work directly with api 31. It is necessary to edit the manifest file (android:exported=true|false). I tried my tests with api 30 and was able to run it successfully. phonegap-plugin-barcodescanner@8.0.1 I’ve seen edited forks of this package but I don’t know how to install local cordova package in Meteor. I need to research this.