# Annotation Type Android

@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.

- ## Optional Element Summary

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

- ## Element Details

  - ### activityLaunchMode

    String activityLaunchMode
    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.
    Default:
      `""`

  - ### appBundle

    Toggle appBundle
    Produces an Android App Bundle (.aab) rather than an APK. Required for new Play Store submissions.
    Default:
      `DEFAULT`

  - ### buildToolsVersion

    String buildToolsVersion
    Android build-tools version. It also selects the compile SDK, so there is no separate compile-SDK hint.
    Default:
      `""`

  - ### captureRecord

    String captureRecord
    Indicates whether the `RECORD_AUDIO` permission should be requested. Can be `enabled` or any other value to disable this option
    Default:
      `""`

  - ### debug

    Toggle debug

    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.

    Default:
      `DEFAULT`

  - ### disableR8

    Toggle disableR8
    Turns off R8, falling back to the older shrinker. Note that hardening requires R8, so this conflicts with harden.level.
    Default:
      `DEFAULT`

  - ### enableProguard

    Toggle enableProguard
    Boolean true/false defaults to true. Allows disabling the proguard obfuscation even on release builds, notice that this isn't recommended
    Default:
      `DEFAULT`

  - ### gradleDep

    String[] gradleDep
    Gradle dependency statements to add to the app module, such as implementation 'com.example:lib:1.0'.
    Default:
      `{}`

  - ### hideStatusBar

    Toggle hideStatusBar
    Hides the Android status bar.
    Default:
      `DEFAULT`

  - ### installLocation

    InstallLocation installLocation
    Maps to android:installLocation manifest entry defaults to auto. Can also be set to internalOnly or preferExternal.
    Default:
      `DEFAULT`

  - ### licenseKey

    String licenseKey
    The license key for the Android app, this is required if you use in-app purchase on Android
    Default:
      `""`

  - ### minSdkVersion

    AndroidMinSdk minSdkVersion
    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`.
    Default:
      `DEFAULT`

  - ### multidex

    Toggle multidex

    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.

    Default:
      `DEFAULT`

  - ### newFirebaseMessaging

    Toggle newFirebaseMessaging
    Uses the current Firebase Cloud Messaging integration. Requires AndroidX and Gradle 8.13 or newer.
    Default:
      `DEFAULT`

  - ### proguardKeep

    String[] proguardKeep
    Arguments for the keep option in proguard allowing you to keep a pattern of files for example, `-keep class com.mypackage.ProblemClass { *; }`
    Default:
      `{}`

  - ### release

    Toggle release
    true/false defaults to true - indicates whether to include the release version in the build
    Default:
      `DEFAULT`

  - ### repositories

    String[] repositories
    Extra Gradle repositories to resolve dependencies from.
    Default:
      `{}`

  - ### targetSDKVersion

    int targetSDKVersion
    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.
    Default:
      `0`

  - ### themeMode

    ThemeMode themeMode
    `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.
    Default:
      `DEFAULT`

  - ### topDependency

    String[] topDependency
    Statements added to the top-level Gradle build file rather than the app module.
    Default:
      `{}`

  - ### useAndroidX

    Toggle useAndroidX
    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.
    Default:
      `DEFAULT`

  - ### xapplication

    String xapplication
    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.
    Default:
      `""`

  - ### xgradle

    String[] xgradle
    Arbitrary text spliced into the generated app-module Gradle file.
    Default:
      `{}`

  - ### xpermissions

    String xpermissions
    more permissions for the Android manifest
    Default:
      `""`