Home Features Docs Blog Support GitHub

MOE 1.8 Testing available, with m1 based mac support

This is a SNAPSHOT version with m1 based mac support. No other functional change to the tools and SDK compare to the current MOE Gradle Plugin 1.7.4 & SDK 1.7.3.

It should run properly on m1 mac and also the app should run inside m1 based ios simulator.

I only have a handful of projects to test with so it might have issues that I didn’t find. Please comment below if you find any problem, or report it in our Discord channel.

To use a SNAPSHOT version of moe-gradle plugin, update your “budil.gradle”:

buildscript {
    repositories {
        maven { url 'https://oss.sonatype.org/content/repositories/snapshots/' }
    }
    dependencies {
        classpath group: 'org.multi-os-engine', name: 'moe-gradle', version: '1.8.0-SNAPSHOT'
    }
    configurations.all {
        resolutionStrategy.cacheChangingModulesFor 60, 'seconds'
    }
}

And remember to refresh the xcode project settings through Inject/Refresh Xcode Project Settings option in Android Studio/Intellij, or with the moeUpdateXcodeSettings gradle task.

5 Likes

Very cool @Noisyfox!

1 Like

Hi, @Noisyfox. Thanks again for your hard work.
Snapshot works well for me.

A question. Will it be possible to add “My Mac (Designed for iPad)” target selection to Android Studio? Currently I can select it only from Xcode.

Interesting, I’ll take a look.

Updates: https://developer.apple.com/forums/thread/673778 is preventing me from building the app for m1 mac through command line. Until this get solved, then it won’t be possible to build & run the app for m1 mac.

1 Like

Weird. I already released my app to app store. No issues. I used MOE 1.8. Tested everything on M1 Mac mini.
I do builds via Xcode and Android studio. App works on Iphone, Mac and simulators.

1 Like

Yes, you build & run your iOS app on M1 mac directly via Xcode, but I haven’t found a way of doing that through command line or in Android Studio. So if you want to run & debug it on M1 mac, you need to start the app from Xcode atm.

Hi! I didn`t use command line. But click on “Debug” in AS was building my app and running it on device or simulator.
Now I updated project to use Java 11. So I should not use retrolabda anymore?
It fails with error:

Error! Failed to transform some classes
java.lang.IllegalStateException: Cannot initialize dumper; unexpected JDK implementation. Please run Retrolambda using the Java agent (enable forking in the Maven plugin).
at net.orfjackal.retrolambda.lambdas.LambdaClassDumper.install(LambdaClassDumper.java:38)
at net.orfjackal.retrolambda.Retrolambda.run(Retrolambda.java:53)
at net.orfjackal.retrolambda.Main.main(Main.java:26)
Caused by: java.lang.NoSuchFieldException: modifiers
at java.base/java.lang.Class.getDeclaredField(Class.java:2549)
at net.orfjackal.retrolambda.lambdas.LambdaClassDumper.makeNonFinal(LambdaClassDumper.java:59)
at net.orfjackal.retrolambda.lambdas.LambdaClassDumper.install(LambdaClassDumper.java:32)
… 2 more

What is the alternative? If I rewrite my code to not use retrolambda will it work?

Make sure you are using JDK 11, and having

sourceCompatibility = 1.8
targetCompatibility = 1.8

set to your ios module & common module.

Thanks!

There is still some issues in my project. So I`ll skip upgrade of gradle for now. BTW, plugin 1.8.0 not found for me. 1.8.0-SNAPSHOT works.

I see suggestion in AS to upgrade to 1.8.0. But when I do it I see: Screen Shot 2021-08-02 at 12.41.16 AM

Oh crap my bad… I mistyped the version… It’s been fixed in 1.8.1 now.

1 Like

Finally got my app working with JDK 11.
Selecting JDK version in Android Studio was not enough. I was have to install new Java in the system (see java -version in the Terminal).
My bad was that I installed “OpenJDK 16.0.2” for some reason. Correct one is “Java SE 11.0.12”. Now I have 3 JDK versions.

App started working after setting JAVA_HOME to “/Library/Java/JavaVirtualMachines/jdk-11.0.12.jdk/Contents/Home” in . I used this guide https://mkyong.com/java/how-to-set-java_home-environment-variable-on-mac-os-x/

Setting path to Java in gradle.properties file also works, but I don`t want to keep it in a file so I changed JAVA_HOME in a system.

Maybe this will be useful for someone.

UPD. Builds from Xcode still does not work… Probably because “/usr/libexec/java_home” returns jdk 16. Even if “java -version” and “echo $JAVA_HOME” reruns jdk 11

UPD2.
Fixed Xcode build by setting MOE_JAVA_VERSION_OVERRIDE in Build Phase in xCode. I don`t know why it does not work without this change.
Screen Shot 2021-08-03 at 10.29.41 PM

1 Like

Because the JAVA_HOME (and other environment variables) in your .zshrc won’t be picked up by GUI applications including Xcode.

Also to set environment variables in Xcode, you could directly do this in the build settings. I won’t suggest you to modify the MOE build phase because it will be overwritten by MOE plugin everytime you use Inject/Refresh Xcode Project Settings.
image

Although the MOE_JAVA_VERSION_OVERRIDE setting will be reset to empty string if you refresh the xcode settings (this might be fixed in the future), but it’s more obvious in source control than the build phase.

That`s much better. Thank you!