# Exporter

The **Exporter** **Module** allows the user to export a **Project** to a chosen location. In addition to exporting the **Project**, the **Exporter** can create a copy of **Incari Player** in the same folder (this is not the case for exporting to *Android*). This makes it possible to save and run a **Project** without the need of **Incari Studio**.

There are two tabs in the **Exporter** **Module**: [**Settings**](#settings) and [**Deploy**](#deploy).

Furthermore, find below an easy guide on [**Exporting a Project**](#exporting-a-project) with the **Exporter** **Module**, divided between the two possible cases of *Target Platforms*:

* [**Host Target**](#host-target)
* [**Different Target**](#different-target)

## Settings

![](https://4263346935-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLnh3x8s9fddWeG8TaAug%2Fuploads%2Fgit-blob-d937f1d49b8a852a75b9a76ba89ac83996eaf0c7%2Fexporterimage1update.png?alt=media)

### General

* `Target`: *Operating System* where the exported **Project** will be played in the corresponding version of **Incari Player**.

### Options

* `Only Project`: Whether only the **Project** will be exported or the **Project** alongside a copy of **Incari Player**. This does not apply to *Android* **Projects**, as the **Project** is always exported.
* `Only Used Assets`: A user may import more **Assets** than they end up using. When toggled on, this **Attribute** makes sure only the essential **Assets**, which appear in the **Asset Database**, are packaged up for export.

## Deploy

![](https://4263346935-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLnh3x8s9fddWeG8TaAug%2Fuploads%2Fgit-blob-ed78d6f638dc77bb31303b8f54632f29d9feb284%2Fexporter-deploy.png?alt=media)

* `Export Folder`: The location in the local machine to which the **Project** will be exported.

## Exporting a Project

There are two slightly different procedures for exporting a **Project** depending on the `Target` chosen:

* [**Host Target**](#host-target)
* [**Different Target**](#different-target)
  * [**Linux**](#linux)
  * [**Android**](#android)

### Host Target

Exporting a **Project** for the *Host* `Target` is very straightforward as this `Target` is already available and selected by default. To export the **Project**, simply click on the `Export` button on the top menu.

![](https://4263346935-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLnh3x8s9fddWeG8TaAug%2Fuploads%2Fgit-blob-a07139bb3696201b6988f010342f49210617786d%2Fexporterimage3update.png?alt=media)

A pop-up message indicating that the export was successful will appear.

![](https://4263346935-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLnh3x8s9fddWeG8TaAug%2Fuploads%2Fgit-blob-cb21fbce7451fa63fe6539eafcd6932329347901%2Fexporter-success.png?alt=media)

After exporting a **Project**, the export folder will have:

* A folder with the exported **Project**.
* A `run.bat` file.
* A folder with a copy of **Incari Player** (only if `Only Project` was set to *false*).

The **Project** can then be started by launching `run.bat`.

It is also possible to export a **Project** from the command line. There are two cases, which are equivalent to whether the `Only Project` option is set to *true* or *false* in [**Settings**](#settings), when exporting from **Incari Studio**.

For exporting the **Project** alongside a copy of **Incari Player**, run the command:

* `IncariCLI.exe /p="<project-path>" /export /output="<export-folder-path>"`.

For exporting just the **Project**, without a copy of **Incari Player**, run the command:

* `IncariCLI.exe /p="<project-path>" /export /output="<export-folder-path>" /no-player`.

### Different Target

Currently, this is *Linux* and *Android*. Both require setting up *WSL*, which will be explained shortly. Exporting, however, differs between the two `Target` types and have their own corresponding sections:

* [**Exporting to Linux**](#linux)
* [**Exporting to Android**](#android)

Exporting a **Project** for a different *Target* than the *Host* requires a few preparatory steps that will be explained in detail:

**Setting up WSL**

*WSL* stands for *Windows Subsystem for Linux* and is a tool that allows users to run a *Linux* environment directly on *Windows*. It is needed for building the **Project** for the desired *Target Platform*.

Find more information about *WSL* on the links provided in the **External Links** section below.

To set up *WSL*, follow these steps:

1. Either on *Windows PowerShell* or *Command Prompt*, run the following *command*: `wsl --install`. This will install *WSL* and the latest *Ubuntu* version.
2. Restart *Windows*.
3. Go to the *Microsoft Store* and install *Ubuntu 22.04* or run on the *PowerShell* or *Command Prompt* the following command: `wsl --install -d Ubuntu-22.04`.
4. Enter your credentials in the pop-up window that appears. If it does not appear, run the command `wsl` on the *PowerShell* or *Command Prompt* and enter your credentials.
5. Set-up *Ubuntu 22.04* as the default *distribution* by running the command `wsl --set-default Ubuntu-22.04` on the *PowerShell* or *Command Prompt*.

**Preparing Incari Studio**

For exporting to a different *Target Platform* than the *Host*, a *cross-compiled* version of **Incari Player** for the desired *Target* is necessary.

* Download **Incari Player** for the desired `Target` *platform* in the [*Applications*](https://docs.incari.com/incari-studio/2024.1/getting-started/first-steps/incari-hub#incari-player) section of [**Incari Hub**](https://docs.incari.com/incari-studio/2024.1/getting-started/first-steps/incari-hub).

#### Linux

**Exporting the Project**

After following all the previous steps, everything is ready for exporting a **Project** to the desired *Target* *Platform*. For this:

1. Open the **Project** to be exported in **Incari Studio** and go to the **Exporter Module**.
2. Add the desired `Target` by using the plus icon on the top left.

![Adding the Linux Target.](https://4263346935-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLnh3x8s9fddWeG8TaAug%2Fuploads%2Fgit-blob-cdabef463c37d05d08b750b8d01d076ecab6e1f4%2Fadd-target-update1.png?alt=media)

![Exporter with Linux x86-64 Target added.](https://4263346935-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLnh3x8s9fddWeG8TaAug%2Fuploads%2Fgit-blob-2c55c5728bcacb1c178e1f6f10fe894a79432c1f%2Fexporter-wlinux_update.png?alt=media)

3. Choose the desired `Export Folder` on the [**Deploy**](#deploy) tab.
4. Click on the `Export` button on the top menu.

![](https://4263346935-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLnh3x8s9fddWeG8TaAug%2Fuploads%2Fgit-blob-507de1a617add56878954943c37bbd9b16d83837%2Fexporter-exportlinux_update.png?alt=media)

A pop-up message indicating that the export was successful will appear.

![](https://4263346935-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLnh3x8s9fddWeG8TaAug%2Fuploads%2Fgit-blob-cb21fbce7451fa63fe6539eafcd6932329347901%2Fexporter-success.png?alt=media)

After exporting a **Project**, the export folder will have:

* A folder with the exported **Project**.
* A `run.sh` file.
* A folder with a copy of **Incari Player** for the desired `Target` (only if `Only Project` was set to *false*).

The **Project** can then be started on the *Target Platform* by launching `run.sh`.

It is also possible to export a **Project** from the command line. There are two cases, which are equivalent to whether the `Only Project` option is set to *true* or *false* in [**Settings**](#settings), when exporting from **Incari Studio**.

For exporting the **Project** alongside a copy of **Incari Player**, run the command:

* `IncariCLI.exe /p="<project-path>" /export /output="<export-folder-path>" /target=<target-triple>`.

For exporting just the **Project**, without a copy of **Incari Player**, run the command:

* `IncariCLI.exe /p="<project-path>" /export /output="<export-folder-path>" /no-player /target=<target-triple>`.

Where `<target-triple>` specifies the *Target Platform*:

* Use `x86_64-linux-gnu` for *Linux x86-64*.
* Use `aarch64-linux-gnu` for *Linux arm64*.

#### Android

**Setting up Android SDK and NDK**

To deploy the application on an *Android* device, [*AndroidStudio*](https://developer.android.com/studio/install) must be installed.

During the *AndroidStudio* installation, a prompt will appear requiring that *Android SDK* be installed as well. This will also install *platform-tools*, which will be required to use [*Android Debug Bridge*](https://developer.android.com/tools/adb) to build and run an app from **IncariStudio**. Please make sure `Android SDK` and `Android API 34` are selected.

Next, *Android NDK* must be installed. This will allow one to compile **Incari Projects** for *Android* and compile *Android* projects later on. Simply open *Android Studio* and click `Tools->SDKManager->AndroidSDK->SDKTools`. In the *NDK* section, select `25.1.8937393`.

![Android NDK.](https://4263346935-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLnh3x8s9fddWeG8TaAug%2Fuploads%2Fgit-blob-1ef2cdacc8a3b34a857410910b6d5d8fddd186f3%2Fandroidimage3.png?alt=media)

*Android NDK* can also be downloaded [here](https://github.com/android/ndk/wiki/Unsupported-Downloads#r25c).

**Exporting Project**

After following all the previous steps, everything is ready for exporting a **Project** to the desired *Target* *Platform*. For this:

1. Open the **Project** to be exported in **Incari Studio** and go to the **Exporter Module**.
2. Add the desired `Target` by using the plus icon on the top left.

![Adding the Android Target.](https://4263346935-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLnh3x8s9fddWeG8TaAug%2Fuploads%2Fgit-blob-f56738df67f322304313a28eb0bfeaf37460e934%2Faddandroidtarget.png?alt=media)

![Exporter with Android Target added.](https://4263346935-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLnh3x8s9fddWeG8TaAug%2Fuploads%2Fgit-blob-4f666521dddfc255fae14d119d37cad2d04f6f11%2Fandroidafteradding.png?alt=media)

3. Choose the desired `Export Folder` on the [**Deploy**](#deploy) tab. Additionally, when exporting a **Project** for *Android*, it is necessary to specify the *Android Toolchain Path*, besides the target platform and project. *Toolchain* can be found in the installed or downloaded *NDK*. For example:

   * `/home/user_name/Android/Sdk/ndk/25.1.8937393/toolchains/llvm/prebuilt/linux-x86_64`

   or

   * `Downloads/android-ndk-r25c/toolchains/llvm/prebuilt/linux-x86_64/`

   The toolchain path should be inputted here under `Tools`. Alternatively, it can be provided to the `IncariCLI` as an argument, alongside the **Project** name and desired output directory.
4. Click on the `Export` button on the top menu.

![](https://4263346935-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLnh3x8s9fddWeG8TaAug%2Fuploads%2Fgit-blob-cd8fc66a6bf7426339737de1307eaacf02f2b17a%2Fandroidexport.png?alt=media)

A pop-up message indicating that the export was successful will appear.

![](https://4263346935-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLnh3x8s9fddWeG8TaAug%2Fuploads%2Fgit-blob-cb21fbce7451fa63fe6539eafcd6932329347901%2Fexporter-success.png?alt=media)

After exporting the **Project**, a folder with the exported **Project** labeled `IncariAndroidApp` will appear in the deployed location. The user can then open this folder in *AndroidStudio* and use it as an *Android* project.

**Build and Run**

Beyond what has been previously discussed, it is also possible to directly install the **Project** onto a specified device. This can be done by toggling on `Build and Run` under `Deploy > Remote`.

Before continuing, it is necessary to make sure *adb* is installed. If the chosen `Android Toolchain` in `Settings > Tools` is from the *NDK* installed by *AndroidStudio*, **Incari Studio** will find the associated *platform-tools* and *adb*. *Java 17* is also required (for [*Gradle*](https://gradle.org/)) and also comes installed by *AndroidStudio*. To double-check, this can usually be located with `C:\Program Files\Android\Android Studio\jbr` on *Windows*, or `/usr/local/android-studio/jbr` on *Linux*.

After that, refreshing allows the user to check for connected *Android* devices, appearing in the `Device` dropdown.

![Build and Run Example.](https://4263346935-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLnh3x8s9fddWeG8TaAug%2Fuploads%2Fgit-blob-3ce119d4c0ad2f387d6a2e4adf058add4c4039f1%2Fbuildandrunexample.png?alt=media)

Then the user must simply click `Export` and it will export, build, and install the app on the chosen device. This may take some time, but should eventually result in a success message:

![Successful Build and Run for Android.](https://4263346935-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLnh3x8s9fddWeG8TaAug%2Fuploads%2Fgit-blob-eeb7d706a1373de84764d9e9732af03f4574bf39%2Fandroidsuccess.png?alt=media)

However there are a few instances where an error will occur. These are if there was an installation failure, if the *Java* path was invalid, or if no device has been selected.

## External Links

* [*WSL Documentation*](https://learn.microsoft.com/en-gb/windows/wsl/).
