Building Apps Locally with the Smartface CLI

You can generate Smartface iOS and Android binaries in your local environment. For the Android builds, you can use Linux or macOS. For iOS builds, macOS is required.

You can export native iOS and Android projects using the Smartface Command Line Tool(CLI) from your Smartface Cloud IDE workspace.

Before installing the Smartface Command Line Tool, please check the requirements on npm.

Installing the Smartface Command Line Tool

You can use the following shell commands to install the Smartface CLI:

// install the latest stable Smartface cli version
yarn global add smartface
// install the latest beta Smartface cli version
yarn global add smartface@beta
// install a specific Smartface cli version
yarn add global smartface@6.15.1
// check Smartface cli version
smfc -v

Selecting a player to use with the Smartface CLI

You can use the following shell commands to select a player to be used in builds:

// select a specific ios player version
smfc use 6.15.1-beta.1 --os iOS
// use the latest beta iOS player
smfc use beta --os iOS
// use the latest stable android player
smfc use latest --os Android
// use latest stable player for both platforms
smfc use latest

Generating platform-based native projects from the Smartface Cloud IDE

You can use the following shell commands to export your Smartface project as Xcode and Android Studio projects.

// Generate Android Studio Project
smfc --task=export:Android --projectRoot=$WORKSPACE_FOLDER --tempFolder=$TEMP_FOLDER
// Generate Xcode Project
smfc --task=export:iOS --projectRoot=$WORKSPACE_FOLDER --outputZip=$OUTPUT_ZIP_FILE

Requirements for iOS Builds

The build be run in a compatible Xcode version due to framework dependencies. Please check the xcodeversion file under the output folder to find out the Xcode version compatible with your project.

Requirements for Android Builds

Prerequisites:

Please make sure that the environment variables are set correctly:

javac -v
echo $ANDROID_HOME
echo $ANDROID_NDK_HOME

After the completion of the prerequisites and the installation of the Smartface CLI, you can generate APK files in your local environment or in your Smartface Cloud workspace.

// Generate Android Studio project
smfc --task=export:Android --projectRoot=$WORKSPACE_FOLDER --tempFolder=$TEMP_FOLDER
// Navigate to gradlew folder
cd $TEMP_FOLDER/SmartfacePlayer
// Build APK file
// module: app
// variant: playerProdRelease
./gradlew app:assemblePlayerProdRelease