Skip to content

[Android] How to build project

Aleksandr Zatsepin edited this page Sep 11, 2020 · 20 revisions

The project may be built without problems only on Mac or Linux platform. Windows OS is no longer supported.

First of all, you have to install these required components:

Android SDK, NDK (now, it's r21d (ndkVersion = "21.3.6528147") version, but the new one should work as well), CMake (only from android sdk manager, because android uses its own/custom Cmake implementation), LLDB (if you want to be able to debug native code).

After all required components are installed do these steps:

  1. Clone or download MapsMe code from the current repo.
  2. Execute the script omim/tools/android/set_up_android.py . This script creates the local.properties file for you where sdk/ndk paths are specified. But, you can provide the mentioned paths manually through Android Studio: File->Project Structure->SDK Location or put their in the local.properties file directly. An example of local properties file:
    ndk.dir=/Users/<username>/Library/Android/sdk/ndk/21.3.6528147
    sdk.dir=/Users/<username>/Library/Android/sdk
  3. Execute the script omim/configure.sh and follow the prompts.
  4. Execute two commands:
    git submodule init
    git submodule update
  5. To build project you have to use gradle wrapper. Wrapper downloads all needed dependencies for you. Project has a lot of configurations which you can see in build.gradle file. For example to buil Web Debug version of app you should do following command staying in omim/android folder:
    ./gradlew assembleWebDebug (or ./gradlew aWD - is the short form). Also you can provide optional parameters: -Parm32(build only for ARM32(armeabi-v7a) arch), -Parm64(build only for ARM64(arm64-v8a) arch), -Px86(build only for x86 arch) and -Px86_64(build only for x86_64).
  6. If building is completed without errors the apk file will be found in omim/android/build/outputs/apk folder, if errors are encountered please let me know!
Clone this wiki locally