Running an app

build/scarletnx-android APP.apk runs an app in a window, with the left mouse button as a finger and the keyboard as a hardware keyboard. APP can also be a bundle of a base APK and its splits (an XAPK or an APKS), which is installed first, as Android's package manager installs one: its APKs into android/app/<package>/ of the data folder (base.apk, split_<name>.apk), with the native libraries of arm64-v8a in its lib/arm64/, or those of armeabi-v7a or armeabi in its lib/arm/ when the app has no 64-bit ones (Native bridge). The app's data folder has a lib link to them, as Android's has. A stamp keeps the bundle's path and size, so the next run starts at once. The app's own data is in android/data/<package>/. The build and an install put the framework's jar and the font beside the program. -J OPTION gives the JVM an option, as these system properties:

PropertyMeaning
snx.android.width, snx.android.height, snx.android.dpiThe display: 600 by 1066 pixels at 240 dpi when not given
snx.android.nighttrue for the dark theme
snx.android.dataThe app's data folder: android/data/<package> in ScarletNX's data folder when not given

These options of scarletnx-android run an app without a user, as the Switch runtime's --script and --shot do. --headless (-H) and --shot are common options, which take a value as --shot PATH or --shot=PATH; so are -O, the level of the native code its JIT compiles (as --jit-opt), and --jit-only, what it does anyway:

OptionMeaning
-H, --headlessNo window: the renderer draws into an image of its own (--trace-frames logs each frame)
--shot FILE.ppmSave frames as binary PPM. %ld in the name is the frame's number. An app that draws with Vulkan has its own presents saved: the image of each listed vkQueuePresentKHR, read back after the copy that waits for the present's semaphores
--shot-frame=60,120The frames (or the Vulkan presents, the first 1) to save, 60 when not given
--taps="60:300,672 90:..."A finger down at frame 60 at (300, 672) in pixels, and up 3 frames later
--type='120:2+3\n|300:x'Text typed from frame 120 on, as key presses of a US keyboard (\n is Enter). An older version named it --keys, which the other drivers use for a key file: --keys now stops with a message that names --type
--key-frames=4The frames between scripted keys. An app gets a frame or more to take each key, as from a person

These find what an app does when it stops or runs slowly:

OptionMeaning
--log-level=LThe least android.util.Log level printed: V, D (the default), I, W, E or A. It is also the least level Log.isLoggable is true for, as Android's log.tag property sets it; without it, I, as on Android
--sampleEvery 5 seconds, each guest thread's pc, x30 and HLE call, and the count of Vulkan presents
--log-signalsEach guest signal action, send and delivery
--jit-verboseEach unit the JIT compiles, before and after, with its time
--linker-verboseEach native library and its load address
--framework=JAR, --java-home=DIRThe framework's jar and the JDK, in place of the ones beside the program and that the build found

The diagnostics, the JIT's level and the JVM's options are settings too, the launcher's Settings > Android, which it passes to a run (--android-log-level=W, Settings): the last given counts.

Without a display, the renderer draws into an image of its own, so the shots work on a machine with only a software Vulkan driver (lavapipe).

--translate=DIR APP.apk writes every class of the app as a JVM class file into DIR, which javap reads.


Made from docs/platforms/android-apps/README.md at 69237645142c. GPL-3.0-or-later.