Page 1 of 1

Author:  mvglasow [ 14 Nov 2015, 19:51 ]
Post subject:  Eclipse

I've managed to import Navit into Eclipse by executing the steps at This works well for C code – I can use Eclipse features such as jumping to the declaration of a variable or function, or display the call hierarchy. I can also build native versions of Navit from Eclipse and run them.

However, none of this works for the Android Java code. Not only do I have to go without features such as finding declarations, showing call hierarchies or basic syntax check – coding becomes a pain because every time I type a dot, I get an error message because the file is not on the build path of a Java project.

Anyone have an idea what I can do to get the usual Eclipse Java features for the Java portion of the code? Preferably in a way that doesn't pollute the source tree? Being able to build the APK from Eclipse isn't necessarily a requirement.

Author:  mvglasow [ 14 Nov 2015, 23:57 ]
Post subject:  Re: Eclipse

I think I've found a way:

In the workspace which already has your project, add a new Android application project.

Choose "Navit" as the app name, give it a project name of your choice (I went for navit-android, as the other project is called navit-linux) and enter "org.navitproject.navit" as the package name. Choose the SDK versions (currently Navit requires at least SDK 7 and targets SDK 19. Build with an SDK of your choice. The theme is "Holo Dark".

On the next page, uncheck the options to create a custom launcher icon and activity. Make sure the project is going to be created in the workspace. Then click Finish. It may take a while for your project to be created.

Now go to your new project and delete its src folder.

Then add a new folder: Select your new project's root folder as its parent folder. Name the new folder src. Click Advanced and choose Linked Folder. Browse to the navit/android/src folder in your source directory.

Et voilà! Be sure to open Java files from your Android project (not the Linux one), and all those nifty syntax features will work again. Note, though, that you'll still have to resort to the good ol' command line to build for Android.

Potential further enhancements to this setup (untested so far) would be to ditch the libs and res folders which Eclipse has created for you and link to the source tree instead, as we did for src. Furthermore, we might replace AndroidManifest.xml with a link to its counterpart in your Android cmake build dir.

Page 1 of 1 All times are UTC
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group