# Project structure overview

Create a new project using File > New Scade Project

(Script tags will be stripped)


The typical SCADE mobile projects has the following structure

  • the **root** node is the project name

  • the **products** folder containing the final apps. It's only visible after the first build

  • the **res** folder holding resources such as images, icons etc

  • the **src** folder holding the entire source code

  • the **start.swift** file that starts the entire mobile application

  • the **m1.build** file with settings that influence the build

(Script tags will be stripped)


## General guidelines

If you reference the file directory structure in code, always assume M1 as your home. That means to access an image dog.jpg in the res folder, you would use res/dog.jpg as the path

# The start.swift file

The start.swift file contains the swift code that is executed when the application is started.

# The build file

The build file contains important information that is used during the build process:

  • the private keys to sign the application when building for iOS

  • the location of the icons to be used when building an application See details here [The Build File](🔗)

# Building an app for iOS

To build for iOS, the most important prerequisite is that you provided the necessary keys for iOS code signing. See [Code signing settings](🔗) for setting up the keys.

  1. Choose the target you want to build. For iOS, choose iOS Device.

  2. Press the **run** button to start the compile process

(Script tags will be stripped)

  1. It will take a few seconds before the console output starts. The initial compilation takes about ~ 30 seconds depending on project size, later runs are faster. The entire **.ipa** file is built and during compilation, you see the output in the console. You should finally see:

(Script tags will be stripped)


The M1.ipa is now ready to be uploaded to iOS:

(Script tags will be stripped)


Additionally, the Scroll Lock issue might cause some irritation as the final log output is not shown. See here for more information [Console Scroll Lock](🔗)

## Apple iOS AppId

The AppId that is generated for the app is following the naming structure **com.scade.<projectName>**, so if you have a project named MyMobileProject, the app id is com.scade.MyMobileProject. We don't have the ability to set the AppId manually, but looking into adding this shortly.

# Building an app for Android

To build an Android app, make sure SDK and NDK are configured as described here [Configure Android support](🔗)

  1. Choose the target you want to build. Choose Android **armeabi-v7a**

  2. Press the **run** button to start the compile process

(Script tags will be stripped)

  1. It will take a few seconds before the console output starts. The initial compilation takes about ~ 30 seconds depending on project size, later runs are faster. The entire **.apk** file is built and during compilation, you see the output in the console. You should finally see:

(Script tags will be stripped)

  1. The Android app has been created and is available for upload in the products directory.

(Script tags will be stripped)


# Compiling Android in Release and Debug mode

The binaries in Android can be released in **Debug** or **Release** mode. To upload in Google App store, please use Release mode. To include debugging information, please use Debug mode. The binary compiled in Debug mode will be a couple of MB larger.

Opening build file in SCADE

Use can use right click and Open with ... System Editor to open the build file. Use Command + F to search for text.

The steps to set the release mode are simple

  1. Specify the **buildType** in SCADE project build file

  2. Create a **keystore** file that contains the key

  3. Create a **keystore properties** file that contains the location of the keystore file

  4. Specify the location of the **keystore properties** file in the SCADE project build file

## Specify the buildType

To set the mode, open the build file and change the buildType setting to either Debug or Release. Best to do this for both x86 and Arm processor

(Script tags will be stripped)


## Create keystore file

Next, create the keystore file. The keystore file contains the keys. Use the **keytool** tools to create the file and make sure its location is set correctly in the keystore.properties file.



Here an example

(Script tags will be stripped)


## Create keystore properties file

Create a text file and call it **keystore.properties**. Add the following content. Make sure the storeFile entry points to the keystore file you created.



## Set location of keystore properties file

Set the location of the **keystore.properties** file in the keyStoreProperties field in the build file. Use Command + F to search for keyStoreProperties and set the path to reflect the location of the keystore.properties file you just created:

(Script tags will be stripped)


# Set Android APK version

There are 2 ways to set Android APK version:

  1. Set the version of APK in the **versionName** and **versionCode** fields in the build file.

482

  1. Create **Android Manifest** with correct APK version and set the path to the manifest in the build file.

483


Look at example of **Android Manifest** along this path: <project>/.build/android-x86(armeabi-v7a)/<project>-android/AndroidManifest.xml

307


Or create a text file and call it **AndroidManifest.xml**. Add the following content. Change @ANDROID_VERSION_CODE@ on **version code**, @ANDROID_VERSION_NAME@ on **version name**.



# Console Scroll Lock

Console Scroll Lock

Sometimes your console scroll lock is activated, causing the impression as if the compilation process was stopped. If you see an console output similar to below, please make sure that console scroll lock is deactivated.

<img src="https://s3.amazonaws.com/scade.io/images/UgProject_scrollLock.png" width="100%">

Please see [Eclipse Scroll Lock](🔗) for more details.

# Upload apk file to Android

Hi, we will add this to the IDE shortly, but to upload the apk to your Android, the easiest way currently is to use the adb command

  1. Make sure your Android device is connected via USB cable

  2. Make sure developer mode is enabled

  3. Execute the following command adb install <filename for apk file>

  4. To get the file name and path, click on the apk file and use right click, and Properties

(Script tags will be stripped)

  1. Copy the file and path name and paste it into a console window

(Script tags will be stripped)

  1. The app is now successfully uploaded to Android !!!