Android / How-To / IOIO OTG

Compiling the IOIO OTG “HelloIOIO” project in IntelliJ IDEA

I recently ordered an IOIO OTG board for an Android project I am working on, and had a difficult time getting the simple HelloIOIO project to compile in IntelliJ IDEA.  This post will document the problems I had, and explain how to fix them.

The instructions in this post are specific to IntelliJ 12.1.3 and IOIO OTG library 3.30.  Prerequisites are that you must have already downloaded Java SDK 1.6, the android SDK, and installed it all.

In my first IOIO OTG attempt, I started off by going to and downloading the most recent stable version of the IOIO OTG code, 3.30. I unpacked the zip file where I wanted the project to be, and then used IntelliJ’s “Import Project” feature to import it.

This resulted in a pretty broken project, as you can see below:

HelloIOIO project not working

There are two reasons for this. One is the directory structure of the IOIO code, specifically the IOIOLib library. Take a look at the screenshot below…


Note that there are two /lib directories, one under /src/ioio/lib, and one under /target/android/src/ioio/lib.  This really confuses IntelliJ, and despite multiple attempts, I could not find a configuration of dependencies that enabled IntelliJ to find everything it needed.

Being unable to import it as-is, I did the next best thing, and cut the Gordian knot. I restructured the library to be more like IntelliJ expects.  In Windows Explorer, I selected the /target/android/src/ioio/lib folder, did a ctrl+x to cut it, and then pasted it in /src/ioio, on top of the existing /lib folder, so they were combined.  Do a cut, not a copy. Having the copied files still hanging around causes problems.

I did not bother with the /target/pc/src/ioio/lib folder, as I don’t need that functionality, but I suppose you could do the same thing with that one. The only problem is that you’ll then have conflicting copies of /lib/spi/

Once the IOIOLib library is reorganized, go ahead and import the project.



Once you have selected the HelloIOIO folder, hit OK, and then choose:

  • Create Project From Existing Sources
  • Name and folder location should already be filled in…
  • On “Source files have been found for your project”, it should list the /HelloIOIO and /HelloIOIO/src folders.
  • Review Libraries (there will be none)
  • Review selected module structure, and take the default
  • Pick the project SDK.  This MUST be the Java SDK 1.6, coupled with the android version of your choice. I am developing on 4.x, so I chose the 4.1.2 with SDK 1.6, which I had already set up beforehand.
  • It may say “There are several frameworks detected in the project”, and show you manifest.xml. This is ok, just accept it and click “Finish”

IntelliJ will start to load, and then you will get a few popups. First, agree to import Android Dependencies. Then, choose “always for these modules”.


You may also get a popup about importing source roots… just agree to this.


Your project will now open in the IDE.   There will still be problems with some methods not being found. It’s time to configure the dependencies.

Go to File >> Project Structure


Then go to Modules. Select HelloIOIO, and click the + sign to add a dependency.


Choose “Module Dependency”.

Pick IOIOLib from the IOIO files, and click OK. Accept the defaults.

Hit + again, and import module IOIOLibAccessory, if it isn’t already a dependency.

Do it again for IOIOLibBT, if you need Bluetooth, and if it isn’t already a dependency.

Now select IOIOLibAccessory, and add module IOIOLib as a dependency.

If you are using IOIOLibBT, select it and again add module IOIOLib as a dependency.

That should do it, you should now be able to compile. IntelliJ doesn’t always pick up on changes, so you may want to clear IntelliJ’s caches by going to File >> Invalidate Caches. This will close IntelliJ, clear the caches, and restart IntelliJ.

Bring up /src/ … the red should be gone, and you should be able to compile.



2 thoughts on “Compiling the IOIO OTG “HelloIOIO” project in IntelliJ IDEA

  1. I have tried the ADK boards like the Arduino Mega, and they work fine. But for my application, I was going to have my accessory connected to an Android via USB at all times. It seemed redundant to have Java code on the Android, and then a separate codebase uploaded to the Arduino. With the IOIO, the code to control the board runs in the Android, so there is only one codebase. Also, for my application, the compactness of IOIO was a bonus. But it’s purely a matter of preference.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s