Intel Multi-OS Engine (MOE), a cross-platform library for Android and iOS

About Intel Multi-OS Engine which seems to be recommended for libGDX. https://github.com/libgdx/libgdx/wiki/Setting-up-your-Development-Environment-(Eclipse,-Intellij-IDEA,-NetBeans)

If you use Intel Multi-OS Engine, you can create cross-platform applications with Java or Kotlin.

Continuing from the previous story about Mobile Open JDK 9, I'll investigate. Compatible with Android and iOS, about Mobile OpenJDK 9

What is Intel Multi-OS Engine?

Is Intel Multi-OS Engine familiar with that "Intel is included"? Nana A cross-platform library developed by Intel.

It's OSS (Intel is also appealing). https://multi-os-engine.org/

There is also an org on GitHub. https://github.com/multi-os-engine

It's "moe" for short, so let's throw Core2Duo to those who say "moe" or something like that.

IDE for which plugins are provided

Eclipse, IntelliJ IDEA, Android Studio。

Probably just an IDE plugin, I think that any IDE that can build Gradle (even if it is not an IDE) can be used. It seems to be Gradle, but it seems that Maven plugin is also prepared. https://github.com/multi-os-engine/moe-plugin-maven

Required specifications for development environment

Mac

Win

How it works

The Multi-OS Engine runtime is based on the Android runtime ART. ART has some features that also perform well on iOS.

https://doc.multi-os-engine.org/multi-os-engine/2_Introduction/Introduction.htmlより引用

[Quoted from https://doc.multi-os-engine.org/multi-os-engine/2_Introduction/Introduction.html](https://doc.multi-os-engine.org/multi-os-engine/ 2_Introduction / Introduction.html)

So, the application written on Android can be built as it is as an application for iOS by the MOE plug-in. The figure below shows Android Studio as an example, but as mentioned above, the IDE does not matter. The Gradle plugin is available, so if it's a Gradle project, the IDE doesn't matter.

[Quoted from https://doc.multi-os-engine.org/multi-os-engine/2_Introduction/Introduction.html](https://doc.multi-os-engine.org/multi-os-engine/ 2_Introduction / Introduction.html)

What to do with iOS UI design

The UI part needs to be created with Xcode etc. like normal iOS development. However, if it is on a cross-platform compatible game engine such as libGDX, there is not much UI difference. If you are developing an app that requires you to be aware of the design guide for each platform, it seems that UI creation needs to be created for each platform.

It seems that a library called Nat4J bridges native and Java and binds the UI. Nat/J: Interoperability with Native Code

Preparation before trying

As a preliminary preparation, in my case I am using IntelliJ IDEA, so I installed the moe IDE plugin.

You can find it by searching Prefrences> Plugin> Browse Repositories ...> "multi-os". multi-os.png

Getting Started(Java)

The sample code has been uploaded on GitHub.

I will drop the sample code.

git clone https://github.com/multi-os-engine/moe-samples-java.git

Explore the contents

I will look at the contents

$ ls
Calculator		LocalizedString		SimpleChart
CurrencyConverter	MuseumMap		SpeakHere
FastJNI			NOTICE.txt		Taxi
HelloMaven		Planets			TheElements
InAppPurchase		README.md		TicTacToe

There are some sample apps included. Well, if you look at README.md, it's written around that. For the time being, let's run the Calculator this time.

The configuration of the Calculator app looks like this.

yank-no-MacBook-Pro:Calculator yy_yank$ tree
.
├── android
│   ├── build.gradle
│   └── src
│       └── main
│           ├── AndroidManifest.xml
│           ├── java
│           │   └── org
│           │       └── moe
│           │           └── samples
│           │               └── calculator
│           │                   └── android
│           │                       └── CalcActivity.java
│           └── res
│               ├── layout
│               │   └── calc_activity.xml
│               ├── mipmap-hdpi
│               │   └── ic_launcher.png
│               ├── mipmap-ldpi
│               │   └── ic_launcher.png
│               ├── mipmap-mdpi
│               │   └── ic_launcher.png
│               ├── mipmap-xhdpi
│               │   └── ic_launcher.png
│               ├── mipmap-xxhdpi
│               │   └── ic_launcher.png
│               ├── values
│               │   ├── colors.xml
│               │   ├── strings.xml
│               │   └── styles.xml
│               └── values-v21
│                   └── styles.xml
├── build.gradle
├── common
│   ├── build.gradle
│   └── src
│       └── main
│           └── java
│               └── org
│                   └── moe
│                       └── samples
│                           └── calculator
│                               └── common
│                                   ├── CalcOperations.java
│                                   ├── CalcOpsTypes.java
│                                   └── CalculatorAdapter.java
├── gradle
│   └── wrapper
│       ├── gradle-wrapper.jar
│       └── gradle-wrapper.properties
├── gradlew
├── gradlew.bat
├── ios
│   ├── build.gradle
│   ├── src
│   │   └── main
│   │       └── java
│   │           └── org
│   │               └── moe
│   │                   └── samples
│   │                       └── calculator
│   │                           └── ios
│   │                               ├── Main.java
│   │                               └── ui
│   │                                   └── AppViewController.java
│   └── xcode
│       ├── ios
│       │   ├── Assets.xcassets
│       │   │   ├── AppIcon.appiconset
│       │   │   │   ├── Contents.json
│       │   │   │   ├── [email protected]
│       │   │   │   ├── [email protected]
│       │   │   │   ├── [email protected]
│       │   │   │   ├── Icon-76-1.png
│       │   │   │   ├── Icon-76-10.png
│       │   │   │   ├── Icon-76-11.png
│       │   │   │   ├── Icon-76-12.png
│       │   │   │   ├── Icon-76-2.png
│       │   │   │   ├── Icon-76-3.png
│       │   │   │   ├── Icon-76-4.png
│       │   │   │   ├── Icon-76-5.png
│       │   │   │   ├── Icon-76-6.png
│       │   │   │   ├── Icon-76-7.png
│       │   │   │   ├── Icon-76-8.png
│       │   │   │   ├── Icon-76-9.png
│       │   │   │   ├── Icon-76.png
│       │   │   │   ├── [email protected]
│       │   │   │   ├── [email protected]
│       │   │   │   ├── [email protected]
│       │   │   │   └── [email protected]
│       │   │   ├── Contents.json
│       │   │   └── MOELogo.imageset
│       │   │       ├── Contents.json
│       │   │       └── moe-logo-200x200.png
│       │   ├── Base.lproj
│       │   │   ├── LaunchScreen.storyboard
│       │   │   └── Main.storyboard
│       │   ├── Info.plist
│       │   └── main.cpp
│       ├── ios-Test
│       │   ├── Info.plist
│       │   └── main.cpp
│       └── ios.xcodeproj
│           └── project.pbxproj
└── settings.gradle

47 directories, 57 files

android directory = android platform specific, ios directory = ios platform specific, common = common part. Each is treated as a Gradle module.

There is a class called CalcActivity.java for Android and AppViewController.java for iOS. This is each UI part. There is nothing special about the Android side. It's the same when developing on Android. iOS has various features.

Even if you look only at the class header, there are quite a few features.

AppViewController


@org.moe.natj.general.ann.Runtime(ObjCRuntime.class)
@ObjCClassName("AppViewController")
@RegisterOnStartup
public class AppViewController extends UIViewController {

UIViewController is an API provided by iOS, and the one that wraps it is prepared on the Multi-OS Engine side. For details on UIViewController, refer to Apple's API reference. UIViewController - API Reference

I would like you to take a quick look at the source, but since UIButton, UIColor, UILabel, etc. are also prepared on the Multi-OS Engine side, they can be used normally. Drawing processing is performed by the viewDidLoad method. If you are involved in iOS development, event handling etc. may be expressed without discomfort.

The essential common part contains logic that is used on both Android and iOS platforms. In this case, it's the logic of the four arithmetic operations that are the core of the Calculator app.

Try running on Android

For the time being, I have an actual Android device, so ./gradlew android: installDebug.

23:52:08: Executing external task 'installDebug'...
Configuration on demand is an incubating feature.
Incremental java compilation is an incubating feature.
:android:preBuild UP-TO-DATE
:android:preDebugBuild UP-TO-DATE
(Omission)
:android:installDebug
Installing APK 'android-debug.apk' on 'SHV35 - 6.0.1' for android:debug
Installed on 1 device.

BUILD SUCCESSFUL

Total time: 41.502 secs
23:52:52: External task execution finished 'installDebug'.

The app has been successfully installed.

As the name Calculator suggests, it's a calculator.

Screenshot_20170207-235347.png

Try it on iOS

I don't have an actual iOS device, but since it's a MacBook Pro, I'll run it on a Simulator. First, start the Simulator. Anything is fine.

./gradlew ios: moeLaunch -Pmoe.launcher.simulators = XXXXX (Simulator ID).

It will start after a while. Simulator is slow though.

The XXXXX part is the Simulator identifier that can be seen in Simulator> Hardware> Manage Device. This allows you to associate it with the Simulator.

simulator-identifier.png

Yes it worked!

ios-moelaunch.png

If you want to create an ipa file, there are various things such as the development team and provisioning profile settings. In that case, you need to write the related settings in ios / build.gradle.

moe {
    signing {
        // String, ID of the development team.
        developmentTeam

        // String, path to the provisioning profile or UUID.
        provisioningProfile

        // String, name of the provisioning profile (new in Xcode 8).
        provisioningProfileSpecifier

        // String, name of the signing identity
        signingIdentity
    }
}

Please refer to the details here.

https://github.com/multi-os-engine/moe-plugin-gradle/blob/master/README.md

Getting Started(Kotlin)

The sample code is also uploaded on GitHub.

I've already explained about it, so it feels like it's out of material, but the sample app is a little different.

$ ls
KotlinCalculator	KotlinRssReader		README.md
KotlinMuseumMap		NOTICE.txt

Please refer to README.md for details as in the example. I looked inside the Kotlin Calculator and found that the code was the same as the java sample. The configuration of Gradle is the same. It is android, ios, common. However, it is written in Kotlin. You probably used the IDE convert (IntelliJ IDEA will convert Java to Kotlin for you).

There is also a community

There is also a place where you can discuss.

Multi-OS Engine Forum As of February 2017, major version has already appeared, and it seems that there are many transfers from RoboVM, and there are already many users. The discussion is quite advanced, and if you look into the addictive points, it seems quite so.

The document is also very neat. https://doc.multi-os-engine.org

Summary

I think it feels pretty good.

Reference URL

Postscript

MOE is version 1.x as of 2017/02, It seems that version 2.x will include LLVM bitcode support. @snakeman Thank you for the information!

When I'm investigating in that connection I found an exchange on the forum called Does multi-os-engine have a roadmap ?. Does multi-os-engine have a roadmap?

As you can see from here

about it. There was also a Roadmap. 2.x seems to be released this year, so I'm looking forward to it too.

MOE Roadmap 2016 - 2017 Winter

Recommended Posts

Intel Multi-OS Engine (MOE), a cross-platform library for Android and iOS
I made a library for displaying tutorials on Android.
[Android] Cause and remedy for TransactionTooLargeException
Library collection useful for Android development