Android development

From Navit's Wiki
Jump to: navigation, search


Developing for Android


For Navit

  • Ensure that your system has the correct dependencies installed to build Navit.
  • Checkout the latest copy of Navit from svn. The instructions on this page assume you have checked-out a copy to ~/src/navit-svn/

cd ~/src
svn co  svn:// navit-svn

For Android

  • On Ubuntu you can accomplish this using the following command (assuming the SDK and NDK have been unzipped to ~/src):

export ANDROID_NDK=~/src/android-ndk-r8
export ANDROID_SDK=~/src/android-sdk-linux
export PATH=$PATH:$ANDROID_NDK/toolchains/arm-linux-androideabi-4.4.3/prebuilt/linux-x86/bin:$ANDROID_SDK/tools:$ANDROID_SDK/platform-tools

Double-check the version numbers in the paths and adapt if required. If you are running a 64-bit version of the NDK, replace linux-x86 with linux-x86_64.

  • Prepare Android SDK:
    • run android in command line - this will show a GUI for preparing Android SDK
    • select Android 2.2 (API 8) and click 'Install N packages...' button - this will download SDK packages that support API 8


Assuming you've followed the previous steps, you're probably setup to start compiling. Using CMake is the recommended way of compiling Navit for Android. Ensure that:

  • You have a java-jdk installed on your system. On Ubuntu:
sudo apt-get install openjdk-6-jdk

When multiple version of java are installed

update-java-alternatives -s java-1.6.0-openjdk-i386
  • On Ubuntu, ensure that ant1.8 is installed:
sudo apt-get install ant1.8
  • Make sure that you have saxonb-xslt installed:
sudo apt-get install libsaxonb-java

With cmake

  • Ensure that you have CMake 2.8 installed.
  • Create a build directory - this will be the directory into which the Android version of Navit will be built. Assume we've made one in ~/src as follows:
cd ~/src
mkdir android-build
  • Optional: Add a SOURCE_PATH environment variable to your system, pointing to the directory in which you checked out a copy of Navit. You can leave out this step, but make sure you change $SOURCE_PATH in the next steps to the actual path of the directory.
export SOURCE_PATH=~/src/navit-svn
  • Step into the build directory:
cd ~/src/android-build
  • Run CMake (ensure that you're in the build directory when you do this!):


  • Build the apk package:
make apkg
  • The previous commands have now created a package called Navit-debug.apk in the following directory:
  • Copy the package to your device (i.e. sd-card) and run it from there (through a file-manager, for example), or
  • If debug bridge (adb) is enabled run:
adb install navit/android/bin/Navit-debug.apk
  • Later, to reinstall already installed Navit app run:
adb install -r navit/android/bin/Navit-debug.apk

With cmake on Windows

  • install CMake 2.8 if you haven't already, add folder with exe to PATH
  • install MinGW or use MinGW included in the git windows folder (e.g. C:\msysgit\mingw\), add folder with exe to PATH
  • install saxon .NET version from,
  • rename transform.exe to saxon.exe, add folder with exe to PATH
  • create a build dir (i.e. "mkdir android-build")
  • run from build dir ( replace $SOURCE_PATH):


  • run MinGW32-make
  • run MinGW32-make apkg
  • install Navit-debug.apk (in <build path>/navit/android/bin) to your device
    • copy navit/android/bin/Navit-debug.apk to your device (i.e. sd-card) and run it from there or
    • if debug bridge (adb) is enabled run adb install navit/android/bin/Navit-debug.apk

Testing an alternative build

If you want to try an alternative build (e.g. Jan's builds with alternative routing) you can do it by :

  • enable unsigned apk installation ( example guide )
  • installing an alternative apk ( e.g. an APK from CircleCI )
  • you will probably need an alternative map to match the application requirements ( such as this one )
Personal tools