Intel Multi OS Engine and Java 8 For Android / IOS

Datetime:2016-08-23 00:34:30          Topic: Java8  Andrew Development           Share

Some notes on cross platform android / ios development.

Intel open-sourced their Multi OS Engine . You can fork it on github . Hopefully this is not just a dump of the project and Intel and the community stay involved in it.

This looks like a really promising multi platform engine that will have decent performance. In the past I've used Starling, but there are other tools such as PhoneGap, Kivy, etc. One of the things I am really interested in is a snappy UI response and quick start-up time. A lot of interpreted frameworks allow you to have one code base, but the way MOE is approaching this is to use dedicated iOS and Android code for UI components, and shared code for everything common. This is probably a pretty good setup if you can separate out your business logic from UI code.

Here is how to get Android Studio set up to use Java 8 on OS X.

Prerequisites

  1. Install the latest Java 8 JDK from Oracle.
  2. Install Android Studio .
  3. Install the Intel Multi OS engine .

For Step 3 you have to temporarily change your ~/Library/LaunchAgents dir to world writable, as it is owned by root, and the moe_install.sh script writes a file into there. You could maybe run it as sudo, I haven't tried.

Setting Up Android Studio

This is where the real googling and stack-overflow-fu start, but I will save you the effort. It seemed like it would work OK for Java 7 but I wanted to use Java 8.

First, follow the instructions in the getting started guide for the Intel Multi OS Engine . They work but leave you with a project that will not compile and run in an emulator. To get it running, continue below.

After that, do this in your project:

Enable Java 8

Inside the android section of the app module's build.gradle add the following compileOptions :

android {

...

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
}

Enable Jack

Add jackOptions to enable jack, also inside the android section of the app module's build.gradle :

android {

...

    defaultConfig {

        ...

        jackOptions {
            enabled true
        }
    }
}

Give Jack More Memory

For some reason jack takes gobs of memory even for a hello world application, so this gives it gobs of memory.

Add this inside gradle.properties

org.gradle.jvmargs=-Xmx8120M

Side by side screenshot

After that, you should be able to launch the app in both the Android emulator and the iOS simulator. The UI looks different in each because the UI portion is configured separately for each platform.

I think I will delve into Kotlin and see if I can get it working in this case. There are some kotlin examples on github . I'm not super keen on Java so hopefully that will help reduce some of the burden of writing Java.





About List