Building MobileOrg for Android

| android, emacs, geek

If you want to use your Android device to work with your Org-mode files, there’s MobileOrg and there’s MobileOrg NG. MobileOrg seems to have more recent activity and more contributors, but NG has a more tablet-optimized layout and better support for navigating large files, so it would be good to apply some of the ideas from NG to the main MobileOrg project. Might be a useful way for me to learn more about mobile development.

Here’s how to build MobileOrg (the matburt version).

  1. Copy the URI to the Git repository (ex: git://github.com/matburt/mobileorg-android.git).
  2. In Eclipse, click on File – Import – Projects from Git – URI. This may autodetect the URI. If not, paste in the URI. Click Next.
  3. You should now see a list of branches. You can leave them all selected. Click Next.
  4. Check the box for Clone Submodules. This will make sure that the project’s dependencies are also checked out. Click Next.
  5. When you see the dialog called Select a wizard to use for importing projects, click on Cancel.

Because the .project file hasn’t been set up, you’ll need to import the project using a different wizard. However, there’s an Eclipse bug that can make this a bit of a hassle, so this is what you should do to get the projects set up in your system.

  1. Close Eclipse.
  2. Move the mobileorg-android subdirectory from your Eclipse workspace directory to a different directory that is not in your workspace.
  3. Start Eclipse again.
  4. Click on File – Import – Existing Android Code Into Workspace. Click Browse and choose the mobileorg-android folder.
  5. Click on Deselect All.Reselect the following:
    • com.matburt.mobileorg.Gui.OutlineActivity
    • library
    • com.twofortyfouram.locale.MarketActivity
  6. Click on Finish.

Now you should have a bunch of projects in your system. You may need to adjust the libraries and build paths.

  1. Right-click on the com.matburt.mobileorg.Gui.OutlineActivity project and choose Properties.
  2. Click on Android and confirm that both libraries are detected. If not, you may need to remove and re-add them.
  3. Wait for the libraries to be built. If you notice that the compiled JARs don’t have classes, doublecheck that the src folder has loaded the sources. Right-click on the src folder and choose Refresh in order to get the sources recognized by Eclipse.

Re-detect the Git connection by doing the following:

  1. Right-click on the com.matburt.mobileorg.Gui.OutlineActivity project and choose Team – Share Project.
  2. Choose Git.
  3. Check the Use or create repository in parent folder of project.
  4. Check the .git directory you’re using.
  5. Click on Finish.

I also had to remove some code from AndroidManifest.xml because you’re apparently not supposed to have more than one action in an intent-filter:

diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index 01c4f1e..9fc3eb1 100644
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -64,14 +64,11 @@
             android:name=".Gui.OutlineActivity"
             android:label="MobileOrg"
             android:theme="@style/Theme.MobileOrgActionbar" >
             <intent-filter>
                 <action android:name="android.intent.action.MAIN" />
-
                 <category android:name="android.intent.category.LAUNCHER" />
-
-                <action android:name="com.matburt.mobileorg.Synchronizer.action.SYNC_UPDATE" />
             </intent-filter>
         </activity>
         <activity
             android:name=".Gui.NodeViewActivity"
             android:label="Org View"

(StackOverflow)

Hope that helps!

You can view 6 comments or e-mail me at sacha@sachachua.com.

6 comments

This is really awesome..and quite an useful discovery for me...Thank you Sacha.....

have you had any joy building its under Emacs?

Alex: Haven't tried that yet. =) As an Android newbie, I'm probably going to stick with the training wheels of the recommended IDE for a little while, or at least until I miss Emacs too much. I assume MobileOrg's normally developed in Emacs, though, so you could ask the mailing list for tips.

Matthew Jones

2012-08-07T01:24:52Z

Thanks for this info Sacha.

There's a lot of work going on in MobileOrg land right now! We'd definitely like some help in closing out some bugs and adding new features. I do really like MobileOrgNG's tablet UI and that's something we'd love to have included in our project... it's just a matter of finding the time to add it in.

Since I use emacs for all of my development I'm sorry to say that supporting Eclipse users has fallen a little by the wayside. Recently we've been trying to make it easier for Eclipse users to contribute by providing some scripts and info in the wiki and source tree itself. It's important to note that any contributions should still work from the emacs/cli building approach in order to be included in the mainline source tree.

Thanks for working on it! =) I've sent a pull request that also includes some Eclipse-related housekeeping (mainly the .project file), so if those make it into the main branch, then these instructions will be out of date and I'll happily revise them. =)

I recently picked up my first 'smart' phone, a Galaxy S-II, with intent to see what I could learn about programming Android apps. First app I added was MobileOrg.

Interesting hearing Matt's comments that the current dev work is mostly done in Emacs; I had figured the first step would be getting Eclipse installed but maybe not.

Benton 7aug12