[Deprecated] Gradle Plugin 1.X (Android)
Emerge provides a fully-featured Gradle plugin to automate common tasks.
Deprecated
Versions 1.X of the Emerge gradle plugin are no longer officially supported. Please use 2.0 - Gradle Plugin 2.0 (Android).
The Emerge Gradle plugin is the recommended way to integrate with Emerge on Android. Its main features are:
- Uploading builds to Emerge for size and performance analysis.
- Creating and maintaining a performance subproject for custom performance analysis.
- Generating a baseline profile using Emerge's Launch Booster service.
Quick Setup
Add the Gradle plugin portal to your plugin repositories
The Emerge Gradle plugin is hosted by the Gradle plugin portal. In new projects it should already be part of the plugin repositories. If not, you'll need to add it in settings.gradle(.kts)
:
pluginManagement {
repositories {
gradlePluginPortal()
// …
}
}
pluginManagement {
repositories {
gradlePluginPortal()
// …
}
}
Apply the Emerge Gradle plugin to your top-level project
In your root project's build.gradle(.kts)
:
plugins {
// …
id("com.emergetools.android") version "1.4.3"
}
// …
emerge {
appProjectPath.set(":app") // Your application module
apiToken.set(System.getenv("EMERGE_API_TOKEN"))
}
plugins {
// …
id "com.emergetools.android" version "1.3.0"
}
// …
emerge {
appProjectPath = ":app" // Your application module
apiToken = System.getenv("EMERGE_API_TOKEN")
}
Gradle plugins are often applied and configured in the
build.gradle(.kts)
file of subprojects. Emerge must instead be applied to the root project, ie. the top-levelbuild.gradle(.kts)
. This facilitates cross-project features like performance analysis.
appProjectPath
and apiToken
are required. Other configuration properties are documented in Gradle Tasks & Configuration.
Obtain an API key
Follow our guide on obtaining an API key.
We recommend storing this token in a secrets store, an environment variable, or a Gradle property file. The example in this guide uses the EMERGE_API_TOKEN
environment variable.
All done!
You're ready to start using the Emerge Gradle plugin. Read on for some commonly used tasks.
Common Tasks
The Emerge Gradle plugin creates new tasks for your projects to help with build uploads, performance analysis, baseline profile generation, and more. See Gradle Tasks & Configuration for details of all available Gradle tasks.
Uploading a build
./gradlew emergeUploadReleaseAab
Release
can be replaced with any existing variant, for example if there is an alpha variant:
./gradlew emergeUploadAlphaAab
Aab
can be replaced by Apk
to upload an APK instead of an AAB (not recommended):
./gradlew emergeUploadReleaseApk
Careful when uploading builds directly
Build uploads are grouped by build type (release by default). If you have automatic pipelines set up to upload builds to Emerge, uploading some separately using the same build type could interfere with alerts and results shown in the dashboard. The build type can be configured through the plugin.
emerge {
// …
buildType.set("test")
}
emerge {
// …
buildType = "test"
}
Updated about 2 months ago