It is not possible to build Scala apps for Android on Apple silicon Macs at the moment (as of october 2024), because Gluon Substrate doesn't support it.
Details:
I have Homebrew and XCode on the Mac from before, giving me some tools that might not be there on a fresh start.
I downloaded graalvm-java23-darwin-aarch64-gluon-23+25.1-dev from https://github.com/gluonhq/graal/releases - the regular release didn't work - you need the one forked by the Gluon project.
Unpacked to /Library/Java/JavaVirtualMachines/graalvm-java23-darwin-aarch64-gluon-23+25.1-dev and allowed it to run:
sudo xattr -r -d com.apple.quarantine /Library/Java/JavaVirtualMachines/graalvm-java23-darwin-aarch64-gluon-23+25.1-dev
Used Maven 3.8.8 - Maven 3.9 has a number of bugs in plugin handling (actions/runner-images#7216) which makes it necessary to downgrade to 3.8.8. I installed Maven in a user folder.
.bash_profile settings:
export GRAALVM_HOME=/Library/Java/JavaVirtualMachines/graalvm-java23-darwin-aarch64-gluon-23+25.1-dev/Contents/Home
export JAVA_HOME=$GRAALVM_HOME
export PATH=$GRAALVM_HOME/bin:$PATH
export PATH=[yourpathhere]/apache-maven-3.8.8/bin:$PATH
Running helloscala with mvn gluonfx:run works with GluonFX plugin 1.0.16. Before building a native image I had to change gluonfx.maven.plugin.version to 1.0.24 in pom.xml. Running the app natively with mvn gluonfx:build gluonfx:nativerun then works.
Unfortunately, I couldn't build it for Android, because when I run mvn -Pandroid gluonfx:build gluonfx:package I get the error message
java.lang.IllegalArgumentException: We currently can't compile to aarch64-linux-android when running on aarch64-apple-darwin
at com.gluonhq.substrate.SubstrateDispatcher.getTargetConfiguration(SubstrateDispatcher.java:392)
It is not possible to build Scala apps for Android on Apple silicon Macs at the moment (as of october 2024), because Gluon Substrate doesn't support it.
Details:
I have Homebrew and XCode on the Mac from before, giving me some tools that might not be there on a fresh start.
I downloaded graalvm-java23-darwin-aarch64-gluon-23+25.1-dev from https://github.com/gluonhq/graal/releases - the regular release didn't work - you need the one forked by the Gluon project.
Unpacked to
/Library/Java/JavaVirtualMachines/graalvm-java23-darwin-aarch64-gluon-23+25.1-devand allowed it to run:sudo xattr -r -d com.apple.quarantine /Library/Java/JavaVirtualMachines/graalvm-java23-darwin-aarch64-gluon-23+25.1-devUsed Maven 3.8.8 - Maven 3.9 has a number of bugs in plugin handling (actions/runner-images#7216) which makes it necessary to downgrade to 3.8.8. I installed Maven in a user folder.
.bash_profile settings:
Running helloscala with
mvn gluonfx:runworks with GluonFX plugin 1.0.16. Before building a native image I had to changegluonfx.maven.plugin.versionto 1.0.24 in pom.xml. Running the app natively withmvn gluonfx:build gluonfx:nativerunthen works.Unfortunately, I couldn't build it for Android, because when I run
mvn -Pandroid gluonfx:build gluonfx:packageI get the error message