Building LibGDX iOS Apps in IntelliJ using new RoboVM plugin

Until recently, if you were developing for iOS with LibGDX, you were better of using Eclipse or command line as your development environment.  Now however there is a beta plugin for RoboVM, the technology that enables Java on iOS.  This tutorial is going to take a quick look at the process.

Before you begin, you need to configure two things.  First IntelliJ needs to be running on Java VM 1.7 or higher.  This is trickier than it sounds, as by default it ships with a 1.6VM as there used to be some compatibility problems.  Fortunately I have already covered this process in this post

Next you need to increase the amount of memory allocated to the VM by IntelliJ.  This is done by editing a config file.  The process follows:

Open the contents of IntelliJ.app by right clicking it in Finder and selecting Show Package Contents:

Ss1

Now navigate to the folder Contents/bin/, locate the file idea.vmoptions and edit the value -Xmms

Ss2

Here you can see I’ve configured it to use 2GB of memory.  You need to set it to at least a GB.

Ss4

Now let’s install the Plugin.  If you haven’t already load IntelliJ.

Now select IntelliJ -> Preferences

Ss5

Now select Plugins->Browse Repositorties

Ss6

Now enter RoboVM in the search box, then click install plugin

Ss7

Wait a minute or two…

Ss8

Once done, click OK, then Apply.  You will be prompted to restart:

Ss9

Do so.

If you get an error at this point ( Major Minor version 51.0 ), you are running the wrong VM.  See the link earlier.  By the way, if an error does occur, you will need to go into plugins and enable the RoboVM plugin to continue.

Now create a new Run configuration.  Add a new config and select RoboVM iOS.

Ss10

The defaults should be sufficient:

Ss11

Click Run and wait a few minutes, the first compile takes some time.  It took about 10 minutes on my 2013 MBA running on battery power.

Now full disclosure… for some reason when I tried to run this the first time, I got an error about OpenGL 2.  I then tried on a real device and same result, from IntelliJ and gradlew from the terminal.  When I then switched back to the simulator it worked.   /shrug  I have no idea what the problem was, nor the solution.  One of the things I hate about magic black boxes.

Regardless, it is now possible and fairly easy to deploy to iOS from IntelliJ.  


Scroll to Top