Getting Started With Mixare on Eclipse

…or how I finally got the thing to compile and am now starting to augment my reality.

Mixare is an open source (GPLv3)  augmented reality platform. I’ll write more blogs about it in the future, but you can read about it here: http://www.mixare.org/

While a lot can be done with the Android application as-is, you may want to tinker with the code or create your own custom plugin (more on that in a future blog post). I found the instructions for getting the environment set up to be overly confusing. After a lot of work, I finally got the project to compile and run. I hope this tutorial helps people in a similar situation.

Step 1: Get Your Android Development Environment Ready

1. Go to http://developer.android.com/sdk/index.html to download Eclipse w/ the Android SDK

2. If you don’t already have the Java Development Kit, get it from: http://www.oracle.com/technetwork/java/javase/downloads/index.html

Step 2: Get a Copy of the Mixare Source

1. Download from  https://github.com/mixare/mixare.  Just click on the ‘Zip’ button.

Downloading Mixare from GitHub

Downloading Mixare from GitHub

Step 3: Get Mixare Set Up in Eclipse

1. Find the Eclipse.exe under the adt-bundle-windows\eclipse folder and start Eclipse.

2. Set the workspace you will use. I chose to create a workspace just for Mixare.
Workspace

3. Select to import projects to your workspace.

4. Go to File > Import… and then under General, select to import existing projects into workspace. I selected the checkbox to make a copy of the project and place that in the workspace, but that is optional.

Import Project

5. You may see an error like this appear in the console: [2012-12-01 14:56:49 – mixare] Unable to resolve target ‘Google Inc.:Google APIs:10’. This error stems from not having the target SDK version installed.

Google API Version

If you just downloaded the ADT, you need to download the appropriate version of the SDK. IMPORTANT: Mixare requires not only the SDK but the Google API to be downloaded. To get the SDK and API, go to Window > Android SDK Manager

Getting to the SDK Manager Menu

SDK Manager

6. Then associate the Google API with the mixare project by right-clicking on the project, selecting Properties and selecting the API under the Android section:

Set Android API

7. You may see a console error concerning the compliance level. As requested, right-click on the project and select Android Tools > Fix Project Properties.

Compiler Properties

8. Both the plugins located in the plugins folder and the main mixare code have a dependency on the mixarelib, therefore, you’ll need to import the mixarelib as an additional project in the workspace. You can find the mixarelib project under mixare\plugins\mixare-library

Mixare Library

Import Mixarelib

Project Structure

9. In the console, Eclipse will complain that there is no res (or resource) folder defined for the mixarelib. I created a new folder under the mixarelib with name of res.

Console With Res Folder

Creating the res folder

10. Just like you did for the main mixare project, you will want to fix the compliance level issue and set the Android Build Target to the SDK (you can select Google API, but just the basic SDK is needed). Additionally, you will want to check the ‘Is Library’ checkbox on the Android screen.

MixareLib

11. Next, you’ll want to run the Ant Build to generate the mixarelib’s jar file. Right-click on the Build.xml file in the mixarelib project and select to Run As > Ant Build. You should then see a message in the console once this is complete, and a mixarelib.jar file in the bin folder.

Running the Ant

12. Go to the main mixare project, right-click and select Properties. Under the Android section, remove the reference to the mixarelib under the plugins folder and replace it with a reference to the new mixarelib project just created.

Mixare Lib Reference

Setting correct project reference

13. Next, select the Java Build Path option and add the mixarelib jar to the build path via the Order and Export tab.

Build Path

14. Also add the jar under the Libraries tab.

Build Path

Step 4: Test the Build

1. At this point there should be no errors in the console and you should be able to build the project. You can test that the build succeeds and the apk is generated by right-clicking on the main mixare project and selecting to Run As > Android Application.

Run As Android Application

2. If you haven’t created an emulator yet you will be prompted to create one. If you have never dealt with Android emulators before I warn you that they are slooowwww.

emulator

3. Eventually the emulator will appear and under the applications screen you should see the same mixare icon that you would see on a normal phone.

mixareicon

4. I haven’t been successful using mixare in the emulator enviornment — it complains that there is no internet connection. Since mixare is meant to run in landscape mode, you may want to orient your emulator in that direction. On Windows 7 use left-ctrl + F11. You should be able to debug on a real phone using the instructions here: http://developer.android.com/tools/device.html

References:

http://code.google.com/p/mixare/issues/detail?id=140

http://code.google.com/p/mixare/wiki/GettingStarted

http://code.google.com/p/mixare/issues/detail?id=112

21 thoughts on “Getting Started With Mixare on Eclipse

  1. Hi! Really nice writeup! 🙂

    I think you should try the development branch, though, since it contains a lot of goodies!

    Unfortunately testing augmented reality apps in emulator is near to impossible, due to the lack of camera/GPS/compass etc.

    If you find something that may be made better in the code, please feel free to submit a patch on github!

    • I’m a .NET developer used to using Team Foundation Server, so I’m a little bit out of my element. However, I’m in the process of figuring out github and I will checkout the development branch plus figure out how the plugins work. Thanks.

    • Hi
      This guide is just what I need to get started making my own specialized AR app.
      Great.
      But I want to make sure that I use the latest Mixare source code. I see that the development branch has changes until august last year but no later. Is that correct?
      At the same time there is a mixare-iphone project on Github with changes to the source code much more recently. Does anybody know if this branch is useful for something?

  2. Nice tutorial. Because of my app uses only my local datasources if i want to remove everything which have relation with online data will i have to delete the classes from the library too?

    • If you want to remove the default list of datasources from the app (ex. wikipedia, twitter, etc) you can do so quite easily. If you are getting the code from the development branch, you can comment out the datasources under res/raw/defaultdatasources.xml . If you are getting the code from the master branch, you can comment out the datasources under res/values/arrays.xml.

  3. Hello, thanks for the tutorial, i got it with no errors, just few warnings, but cannot run it. It says your project contains errors:
    [2013-02-14 16:12:08 – Dex Loader] Unable to execute dex: Multiple dex files define Lorg/mixare/lib/HtmlUnescape;
    [2013-02-14 16:12:08 – mixare-master] Conversion to Dalvik format failed: Unable to execute dex: Multiple dex files define Lorg/mixare/lib/HtmlUnescape;

    Can you help?

      • Vishnu, someone has the same problem. I’m not familiar with the ‘Multiple dex files’ issue, can you respond? My guess Derrick, is that since you are dealing with the mixare lib, is that you may have two references to the lib, one to the mixare-lib under plugins and one to the mixare-lib you imported as a separate project. How does your ‘Properties of Mixare’, Library section look like?

  4. i fixed the error “Unable to execute dex: Multiple dex files define Lorg/mixare/lib/HtmlUnescape;”

    by adding library of “mixarelib.jar” from the bin folder.
    i accidentally added the mixarelib.jar from the root of mixarelib folder and causes these errors.

  5. Very nice tutorial but I can’t do the 12 step. I can’t change to the new reference and, in the next step, doesn’t appear the mixarelib.jar on the list.

    What can I do? I really want to develop AR app’s.

    Thank you

  6. thanks your help was fundamental for my accumulation of knowledge,

    Mine show some last error on main.xml but when i go to clean option on
    eclipse everiting works fine.

  7. Hi,
    I used your guide to download and start with Mixare zip from repo, but as you said I don’t have only two projects in there but have 6, arena splash screen, barcode activity and two plugins and mixare library. which one should I use to run the application?

Leave a reply to Nilesh Goswami Cancel reply