Build a Virtual Device

In order to build the Virtual Device of an Application, the SDK provides the Gradle buildVirtualDevice task. Refer to the Virtual Device page for more information about the Virtual Device.

The prerequisites to use the buildVirtualDevice task are:

  • The property applicationMainClass must be defined in the microej configuration block of the Gradle build file of the project. It must be set to the fully qualified name of the Application main class, for example:

    microej {
      applicationMainClass = "com.mycompany.Main"
    }
    
  • A target VEE Port that uses an Architecture version 7.17 minimum must be defined. Refer to the Select a VEE Port page to know the different ways to provide a VEE Port for a module project.

Once these prerequisites are fulfilled, the Virtual Device can be built:

By double-clicking on the buildVirtualDevice task in the Gradle tasks view:

../_images/intellij-buildVirtualDevice-gradle-project.png

When the build is completed, the Virtual Device is available in the build/virtualDevice folder of the project. It can then be used to run an Application on the Simulator for example.

Add a Pre-Installed Application in a Virtual Device

When building a Virtual Device for a Kernel, Applications can be pre-installed inside. These Applications can be loaded and started when the Kernel starts for example.

To install an Application in a Virtual Device for a Kernel, you must declare the Application as a dependency of the project in the build file, with the microejApplication configuration:

dependencies {
   microejApplication("com.mycompany:myapp:1.0.0")
}

Warning

  • Only modules with the Application Module Nature can be declared this way (modules built with the com.microej.gradle.application plugin). Declaring a module with another Module Nature would make the build fail.
  • The VEE Port used to create the Virtual Device has to be a Multi-Sandbox VEE Port to support the load of these pre-installed Applications.

Add a Kernel API in a Virtual Device

When building a Virtual Device for a Kernel, the Kernel must define the set of classes, methods and static fields all applications are allowed to use. This can be done by declaring Kernel APIs as a dependency in the build file:

dependencies {
   implementation("com.microej.kernelapi:edc:1.2.0")
}