Skip to main content

phrase/phrase-android

phrase/android-sdk-example

The Phrase Android SDK fetches OTA translation releases at runtime and caches them on-device. If the OTA service is unreachable, the SDK falls back to the last cached translations or to the strings bundled in your app binary. For more information on requirements and supported platforms, see the repository README.

Installation

Add the Phrase Maven repository to your root build.gradle, then add the SDK dependency:

Setup

Initialize in your Application class and trigger the initial fetch. Both values are available in the Phrase Strings dashboard after creating a distribution, or via the Distributions API:
To react to the result:

Using translations

Jetpack Compose:
Android Views — base activity pattern:
Layouts can then reference @string/your_key as normal; the SDK intercepts the resource lookup. Programmatic access:

Configuration options

setAppVersion is useful if your versionName does not follow <major>.<minor>.<patch> format, which is required for semantic version targeting.