Skip to content

How to build TotalCross VM and SDK for Android

Antônio Alves M Neto edited this page Oct 9, 2021 · 6 revisions

Compiling TotalCross Virtual Machine for Android

First things first, in order to compile a virtual machine for Android, one need to install the following requirements on your machine:

Once you have all requirements installed will be able to build a TotalCross Virtual Machine and test.

Building step

Basically, to start building TotalCross VM and SDK for Android for testing, one just need two key elements: i) the dist/ folder which contains our .apk (by downloading a binary release of TotalCross); and ii) the etc/ folder which contains our certificates. Alternatively, if you wish to build the .apk by yourself, skip this step and continue to follow the instructions.

ANDROID_HOME

You must have the environment variable ANDROID_HOME pointed to the path that has the Android SDK folder with the following structure.

.
├── build-tools  
├── cmake  
├── emulator  
├── licenses  
├── ndk  
├── ndk-bundle  
├── patcher  
├── platforms  
├── platform-tools  
└── sources

As of 2021 the ndk-bundle/ folder is no longer necessary. See more about NDK.

Command-line

You just need to run the following command line inside TotalCrossVM/android/ folder:

./gradlew assembleDebug copyApk -x test

Case you decided to not use a pre-built binary .apk earlier, than do this instead

./gradlew assembleDebug -x test

The result should be something like:

.
├── LitebaseSDK/
│   └── output/
│       └── debug/
│           └── TotalCrossSDK/
├── TotalCrossSDK/
├── TotalCrossVM/ 
├── LICENSE
└── README.md

Copy the content of this folder must be pasted to the root of a valid SDK.