@Retention(CLASS) @Target({TYPE})

public @interface Android

Android build hints, checked by the compiler.

Place this on your application’s main class – the class named by codename1.mainName. An attribute you do not set is not written at all, so the build server’s own default applies. The default clause below each attribute names a constant that says nothing – see HintUnset – and this package deliberately does not record what the server would do instead, because that is the server’s to change.

The platform is stated once on the annotation, not on every attribute. An attribute repeats it only to disagree with it.

Methods

public abstract String activityLaunchMode() default ""Allows explicitly setting the android:launchMode attribute of the main activity in android.
public abstract Toggle appBundle() default Toggle.DEFAULTProduces an Android App Bundle (.aab) rather than an APK.
public abstract String buildToolsVersion() default ""Android build-tools version.
public abstract String captureRecord() default ""Indicates whether the RECORD_AUDIO permission should be requested.
public abstract Toggle debug() default Toggle.DEFAULTWhether to include the debug version in the build.
public abstract Toggle disableR8() default Toggle.DEFAULTTurns off R8, falling back to the older shrinker.
public abstract Toggle enableProguard() default Toggle.DEFAULTBoolean true/false defaults to true.
public abstract String[] gradleDep() default {}Gradle dependency statements to add to the app module, such as implementation ‘com.example:lib:1.0’.
public abstract Toggle hideStatusBar() default Toggle.DEFAULTHides the Android status bar.
public abstract InstallLocation installLocation() default InstallLocation.DEFAULTMaps to android:installLocation manifest entry defaults to auto.
public abstract String licenseKey() default ""The license key for the Android app, this is required if you use in-app purchase on Android
public abstract AndroidMinSdk minSdkVersion() default AndroidMinSdk.DEFAULTThe least SDK required to run this app, the default value changes based on functionality but can be as low as 7. This corresponds to the XML attribute android:minSdkVersion.
public abstract Toggle multidex() default Toggle.DEFAULTMultidex lets an Android binary reference more than 65536 methods.
public abstract Toggle newFirebaseMessaging() default Toggle.DEFAULTUses the current Firebase Cloud Messaging integration.
public abstract String[] proguardKeep() default {}Arguments for the keep option in proguard allowing you to keep a pattern of files for example, -keep class com.mypackage.ProblemClass { *; }
public abstract Toggle release() default Toggle.DEFAULTtrue/false defaults to true - indicates whether to include the release version in the build
public abstract String[] repositories() default {}Extra Gradle repositories to resolve dependencies from.
public abstract int targetSDKVersion() default 0The Android SDK the build compiles against.
public abstract ThemeMode themeMode() default ThemeMode.DEFAULTauto, modern / material, hololight (default for existing apps), legacy.
public abstract String[] topDependency() default {}Statements added to the top-level Gradle build file rather than the app module.
public abstract Toggle useAndroidX() default Toggle.DEFAULTUse Android X instead of support libraries.
public abstract String xapplication() default ""defaults to an empty string.
public abstract String[] xgradle() default {}Arbitrary text spliced into the generated app-module Gradle file.
public abstract String xpermissions() default ""more permissions for the Android manifest

Method details

activityLaunchMode

public abstract String activityLaunchMode() default ""
Allows explicitly setting the android:launchMode attribute of the main activity in android. Default is “singleTop,” but for some applications you may need to change this behaviour. In particular, apps that are meant to open a file type will need to set this to “singleTask.” See https://developer.android.com/guide/topics/manifest/activity-element.html[Android docs for the activity element] for more information about the android:launchMode attribute.

appBundle

public abstract Toggle appBundle() default Toggle.DEFAULT
Produces an Android App Bundle (.aab) rather than an APK. Required for new Play Store submissions.

buildToolsVersion

public abstract String buildToolsVersion() default ""
Android build-tools version. It also selects the compile SDK, so there is no separate compile-SDK hint.

captureRecord

public abstract String captureRecord() default ""
Indicates whether the RECORD_AUDIO permission should be requested. Can be enabled or any other value to disable this option

debug

public abstract Toggle debug() default Toggle.DEFAULT

Whether to include the debug version in the build.

Left alone, this follows release rather than a fixed value, so a build that selects neither still produces something installable.

disableR8

public abstract Toggle disableR8() default Toggle.DEFAULT
Turns off R8, falling back to the older shrinker. Note that hardening requires R8, so this conflicts with harden.level.

enableProguard

public abstract Toggle enableProguard() default Toggle.DEFAULT
Boolean true/false defaults to true. Allows disabling the proguard obfuscation even on release builds, notice that this isn’t recommended

gradleDep

public abstract String[] gradleDep() default {}
Gradle dependency statements to add to the app module, such as implementation ‘com.example:lib:1.0’.

hideStatusBar

public abstract Toggle hideStatusBar() default Toggle.DEFAULT
Hides the Android status bar.

installLocation

public abstract InstallLocation installLocation() default InstallLocation.DEFAULT
Maps to android:installLocation manifest entry defaults to auto. Can also be set to internalOnly or preferExternal.

licenseKey

public abstract String licenseKey() default ""
The license key for the Android app, this is required if you use in-app purchase on Android

minSdkVersion

public abstract AndroidMinSdk minSdkVersion() default AndroidMinSdk.DEFAULT
The least SDK required to run this app, the default value changes based on functionality but can be as low as 7. This corresponds to the XML attribute android:minSdkVersion.

multidex

public abstract Toggle multidex() default Toggle.DEFAULT

Multidex lets an Android binary reference more than 65536 methods.

Set Toggle.OFF to opt out, which builds a little faster and reinstates the limit.

newFirebaseMessaging

public abstract Toggle newFirebaseMessaging() default Toggle.DEFAULT
Uses the current Firebase Cloud Messaging integration. Requires AndroidX and Gradle 8.13 or newer.

proguardKeep

public abstract String[] proguardKeep() default {}
Arguments for the keep option in proguard allowing you to keep a pattern of files for example, -keep class com.mypackage.ProblemClass { *; }

release

public abstract Toggle release() default Toggle.DEFAULT
true/false defaults to true - indicates whether to include the release version in the build

repositories

public abstract String[] repositories() default {}
Extra Gradle repositories to resolve dependencies from.

targetSDKVersion

public abstract int targetSDKVersion() default 0
The Android SDK the build compiles against. Unset, the build server uses the highest platform it has installed, so leaving this alone tracks the server rather than pinning a number. Not every target works: the source may have limitations, and not all SDK targets are installed.

themeMode

public abstract ThemeMode themeMode() default ThemeMode.DEFAULT
auto, modern / material, hololight (default for existing apps), legacy. auto and modern / material opt in to the CSS-generated Android Material 3 theme from native-themes/android-material/theme.css. hololight is Android Holo Light (what the framework shipped on API 14+ before this refactor). legacy loads the pre-Holo Android theme. The legacy alias cn1.androidTheme is still accepted, and and.hololight=true still maps to hololight. The default stays on hololight for existing apps until you flip in a future release.

topDependency

public abstract String[] topDependency() default {}
Statements added to the top-level Gradle build file rather than the app module.

useAndroidX

public abstract Toggle useAndroidX() default Toggle.DEFAULT
Use Android X instead of support libraries. This will also run a find/replace on all source files to replace support libraries and artifacts with AndroidX equivalents.

xapplication

public abstract String xapplication() default ""
defaults to an empty string. Allows developers of native Android code to add text within the application block to define things such as widgets, services etc.

xgradle

public abstract String[] xgradle() default {}
Arbitrary text spliced into the generated app-module Gradle file.

xpermissions

public abstract String xpermissions() default ""
more permissions for the Android manifest