MobileUI LogoMobileUI

Add MobileUI to an Android app

The MobileUI Framework is a set of Java libraries. Therefore, you can simply use it in your Android app projects like any other Java library.

Gradle dependency

MobileUI comes with an installer, that installs the MobileUI libraries into your Maven local repository. To use them within your Android project, make sure that mavenLocal() is set as a repository location. This can be done in the parent build.gradle as shown below:

allprojects {
    repositories {
        mavenLocal()    }

Then, add the following dependency to your app module's build.gradle file:

dependencies {
    implementation "io.nevernull:mobileui-android:<version>"    ...

Note: Replace <version> with 0.5.3

Location of MobileUI Assets

If your are working with a standalone Android project, you can put the MobileUI assets (layout files, CSS files, images) into the folder


Alternatively, you can specify any other folder to contain the assets. To do this, add an additional sourceSet to your app module's build.gradle file as shown below:

android {
    sourceSets {        main.assets.srcDirs += '../app-common/src/main/assets'    }    ...

This is the default approach, if you generate a new MobileUI project with an app-common module containing all assets for Android and iOS.

Init MobileUI in your Application class

In order to use the MobileUI framework, it must be initialized by the application. You can do this by adding a line to your custom Application sub class. It might be necessary to create such a class. An example is shown in the listing below:
public class MyApplication extends {
    public void onCreate() {
        MobileUIAndroid.init(this);    }

If you needed to create the custom Application class, you need to add it to the AndroidManifest.xml as follows:

   android:name=".MyApplication"   android:icon="@drawable/icon" 

Apply MobileUI in your Android app

To use MobileUI layouts in your app, please follow the Applying Layouts guide.