This page is about the Nop mobile app. The app that does nothing (well, almost nothing).
NOP is the assembly instruction that does nothing; it is the no operation. Actually, it’s close to nothing since the CPU cycles through it, so a tiny amount of time passes. And it also uses one bit of space.
The mobile application is used as a base for other projects to build a mobile application (that’s why it does nothing). But before starting, make share to have read this (opens in new tab) page about setting up your environment.
Java (and other) versions
I use GraalVM 23 with Gluon as JDK with Maven 3.9.9, here’s the output
@dotava-localserver:/pub/javafx/github/nop$ native-image --version
native-image 23 2024-09-17
OpenJDK Runtime Environment GraalVM CE 23-dev+25.1 (build 23+25-jvmci-b01)
OpenJDK 64-Bit Server VM GraalVM CE 23-dev+25.1 (build 23+25-jvmci-b01, mixed mode, sharing)
@dotava-localserver:/pub/javafx/github/nop$ mvn -version
Apache Maven 3.9.9 (...)
Maven home: /pub/software/idea/plugins/maven/lib/maven3
Java version: 23, vendor: GraalVM Community, runtime: /pub/software/graalvm-java23-linux-amd64-gluon-23+25.1-dev
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "6.8.0-58-generic", arch: "amd64", family: "unix"
@dotava-localserver:/pub/javafx/github/nop$ java -version
openjdk version "23" 2024-09-17
OpenJDK Runtime Environment GraalVM CE 23-dev+25.1 (build 23+25-jvmci-b01)
OpenJDK 64-Bit Server VM GraalVM CE 23-dev+25.1 (build 23+25-jvmci-b01, mixed mode, sharing)
Pom versions
To build and run the app that does nothing, the following versions of various artifacts are kept together
<properties>
<android.compileSdkVersion>33</android.compileSdkVersion>
<android.minSdkVersion>26</android.minSdkVersion>
<android.targetSdkVersion>33</android.targetSdkVersion>
<android.buildToolsVersion>33.0.2</android.buildToolsVersion>
<java.version>23</java.version>
<maven.compiler.source>21</maven.compiler.source>
<maven.compiler.target>21</maven.compiler.target>
<maven.compiler.release>21</maven.compiler.release>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<javafx.controls.version>24-headless+0-2024-12-02-101029</javafx.controls.version>
<charm.glisten.version>6.2.3</charm.glisten.version>
<attach.util.version>4.0.21</attach.util.version>
<attach.lifecycle.version>4.0.21</attach.lifecycle.version>
<attach.display.version>4.0.21</attach.display.version>
<attach.storage.version>4.0.21</attach.storage.version>
<attach.statusbar.version>4.0.21</attach.statusbar.version>
<maven.compiler.plugin.version>3.13.0</maven.compiler.plugin.version>
<javafx.maven.plugin.version>0.0.8</javafx.maven.plugin.version>
<gluonfx.maven.plugin.version>1.0.25</gluonfx.maven.plugin.version>
<main.class>nl.dotjava.javafx.nop.NopApplication</main.class>
</properties>
If you decide to use Maven 3.8.8 you have to use version 1.0.23 of the gluonfx maven plugin.
Module info
In the pom I have several components added which are actually not used. I want to keep ‘m there for now. But for clean builds, it is possible to use the used-only information in a module-info.java, so only needed stuff is added during the build of the image. This is actually a useful thing to use when building native images using GraalVM. Here is the module-info
module nl.dotjava.javafx.nop { requires com.gluonhq.charm.glisten; requires com.gluonhq.attach.util; requires com.gluonhq.attach.lifecycle; requires com.gluonhq.attach.display; requires com.gluonhq.attach.storage; exports nl.dotjava.javafx.nop; }
Manifest file
Currently, I only have a version which can be built for and run on an Android phone. I have a Fairphone 4 which is running Android 13 and uses the API level 33. It can be useful to put information for the build in an AndroidManifest.xml file. To do so, create an “android” folder below the “src” folder and put AndroidManifest.xml in it.
<?xml version='1.0'?>
<manifest xmlns:android='http://schemas.android.com/apk/res/android' package='nl.dotjava.javafx.nop' android:versionCode='1' android:versionName='1.0'>
<uses-sdk android:minSdkVersion="26" android:targetSdkVersion="33" />
<supports-screens android:xlargeScreens="true"/>
<application android:label='Nop' android:icon="@mipmap/ic_launcher">
<activity android:name='com.gluonhq.helloandroid.MainActivity' android:exported="true" android:configChanges="orientation|keyboardHidden">
<intent-filter>
<category android:name='android.intent.category.LAUNCHER'/>
<action android:name='android.intent.action.MAIN'/>
</intent-filter>
</activity>
<activity android:name='com.gluonhq.helloandroid.PermissionRequestActivity' android:exported="true"/>
</application>
</manifest>
In the same “android” folder, create a “res” folder with the following structure for the various icon files
mipmap-ldpi/ : 36x36 pixels
mipmap-mdpi/ : 48x48 pixels
mipmap-hdpi/ : 72x72 pixels
mipmap-xhdpi/ : 96x96 pixels
mipmap-xxhdpi/ : 144x144 pixels
mipmap-xxxhdpi/: 192x192 pixels
(todo to add to this page: main java page, listener and testdriving)
Guthub
For the entire project, see github (opens in a new tab).