# UnconditionallyKeep

Artifact: [androidx.annotation.keep:keep](https://developer.android.com/jetpack/androidx/releases/annotation-keep) [View Source](https://cs.android.com/search?q=file:androidx/annotation/keep/UnconditionallyKeep.kt+class:androidx.annotation.keep.UnconditionallyKeep) Added in [1.0.0-alpha01](https://developer.android.com/jetpack/androidx/releases/annotation-keep#1.0.0-alpha01)

*** ** * ** ***

Common/All
- Cmn

  ```
  @Retention(value = AnnotationRetention.BINARY)
  @Target(allowedTargets = [AnnotationTarget.CLASS, AnnotationTarget.FIELD, AnnotationTarget.FUNCTION, AnnotationTarget.CONSTRUCTOR])
  annotation UnconditionallyKeep
  ```

*** ** * ** ***

Indicates code which is accessed by references from outside of the application code directly, such as via JNI, reflection, or instantiation from platform framework code.

NOTE: This keep rule is unconditional, meaning that the annotated class, method, or field will always be preserved in the final application even if, for example, the surrounding code is never used.

If reflection or JNI access occurs inside the application, instead prefer the `@UsesReflection***` annotations, as they will keep conditionally, rather than unconditionally as this annotation does.

| See also |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/annotation/keep/UsesReflectionToConstruct` |   |
| `https://developer.android.com/reference/kotlin/androidx/annotation/keep/UsesReflectionToAccessMethod` |   |
| `https://developer.android.com/reference/kotlin/androidx/annotation/keep/UsesReflectionToAccessField` |   |

## Summary

| ### Public constructors |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/annotation/keep/UnconditionallyKeep#UnconditionallyKeep(kotlin.Boolean)(shouldPreserveName: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html)` | Cmn |

| ### Public properties |
|---|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/annotation/keep/UnconditionallyKeep#shouldPreserveName()` Should the name be preserved. | Cmn |

## Public constructors

### UnconditionallyKeep

Cmn Added in [1.0.0-alpha01](https://developer.android.com/jetpack/androidx/releases/annotation-keep#1.0.0-alpha01)

```
UnconditionallyKeep(shouldPreserveName: Boolean = true)
```

## Public properties

### shouldPreserveName

Cmn

```
val shouldPreserveName: Boolean
```

Should the name be preserved.

Generally this is true if the reference is external, but this can be disabled if the name isn't important.