Tag Archives: Android Gradle Plugin

More frequent, focused updates for Android Studio

Posted by Adarsh Fernando, Senior Product Manager, Android Studio

Three years ago, we changed how we named and versioned Android Studio to make it easier to follow updates – we changed how we numbered the versions of the IDE to more closely map to versioning of the IntelliJ IDEA platform, on which Android Studio is built. We also introduced animal codenames to signify each major release, starting with Arctic Fox. Our most recent release, Koala (2024.1.1), will soon be available in the Beta channel and is built on top of IntelliJ IDEA 2024.1. All Studio releases use a version number that maps to the following schema:

<Year of IntelliJ Version>.<IntelliJ major version>.<Studio major version>

Soon, we are launching the Koala Feature Drop to the Canary channel as version 2024.1.2 — our second release based on IntelliJ IDEA 2024.1. This signals the start of an improved release cycle, where each animal codename includes two major Studio releases: a platform update followed by a feature drop.

The initial animal releases will have the ‘.1’ Android Studio major version and introduce the updated IntelliJ platform version, while subsequent Feature Drops will increase the Android major version to ‘.2’ and focus on introducing Android-specific features that help you be more productive for Android app development.

Versioning system

Year of IntelliJ Version

IntelliJ major version

Studio major version

Jellyfish

2023

.3

.1

Koala

2024

.1

.1

Koala Feature Drop

2024

.1

.2


Leading with IDE platform updates

Going forward, each new “animal” of Android Studio will prioritize updates to the underlying IntelliJ platform. This focus on foundational elements lets developers benefit from usability, performance, and stability improvements to the underlying IntelliJ IDEA platform.

The base version of Android Studio Koala, numbered 2024.1.1 and launched to Canary in March, focuses on adopting updates from IntelliJ IDEA 2024.1. Some benefits of this platform update include:

    • Sticky lines in the editor to simplify working with large files and exploring new codebases
    • Overhauled terminal featuring both visual and functional enhancements
    • Basic IDE functionalities available for Java and Kotlin during indexing
    • Language injections in string templates
    • (Alpha) K2 Kotlin mode for enhanced Kotlin code analysis
    • Inline breakpoints for multiple statements
    • New inspections and quick-fixes
    • And much much more…

See What’s New in IntelliJ IDEA 2024.1 for more details on all the platform updates included in this release.

By focusing a whole release cycle on updating to the latest IntelliJ IDEA platform version, we’re able to get those changes into the Stable channel faster than with the previous release process — ensuring developers have access to the latest upstream features and improvements.

Android-specific functionality with Feature Drops

architecture of Feature Drops in Android Studio
Feature Drops are built on top of the IntelliJ platform updates, and follow soon after each new animal release.

Android Studio is a tailored environment for Android developers. You will continue to receive new and updated features specifically designed for Android development. These will arrive through Feature Drops that share the same animal codename as the base release, and will follow soon after the base animal release hits the Stable channel. Our first such release is Android Studio Koala Feature Drop, and numbered 2024.1.2.

When the Android Studio Koala Feature Drop is available, you can benefit from these new features:

    • A new sign-in flow that makes onboarding with multiple Google services, such as Firebase and Gemini in Android Studio, much easier
    • Device UI Setting Shortcuts in the Running Device Window to quickly test your app against different device UI settings
    • A new Gemini API template to help build Generative AI into your app
    • And more

Feature Drops will leverage the stabilized IDE platform from the previous Android Studio update and focus on new features geared towards Android development. By doing so, we hope to bring these features to the stable channel faster and with higher quality. To learn about even more new features coming to Koala Feature Drop, make sure to tune in to Google I/O 2024.

To sum it up: 2X more frequent updates

timeline of the expected release schedule in the Android Studio Stable channel
Expected release schedule in the Android Studio Stable channel.

Our primary goal with these changes is to ensure that important updates to the IntelliJ IDEA platform reach the Android Studio Stable channel more frequently, and new Android-specific features ship with higher quality and polish. Expect the first animal release to introduce a number of updates from the latest IntelliJ IDEA platform, with a Feature Drop update to follow soon after with more Android-specific features and tools.

By separating IDE platform updates from Feature Drops, we can deliver both types of enhancements in a more streamlined manner, resulting in much more frequent updates to the stable channel that are each focused on improving your productivity.

Similarly, versions of the Android Gradle plugin will also see updates to the stable channel more frequently. Each new animal version and Feature Drop of Android Studio will be accompanied by a new version of the Android Gradle plugin. For example, Android Studio Koala was released alongside AGP 8.5 and Android Studio Koala Feature Drop will be released alongside AGP 8.6.

As always, if you want to be on the cutting edge, we encourage you to join the Canary channel by downloading and installing Android Studio Koala Feature Drop for early access to the latest and greatest. Also you can be part of our vibrant Android developer community on LinkedIn, Medium, YouTube, or X.

Prepare your Android Project for Android Gradle plugin 8.0 API changes

Posted by Wojtek Kaliciński, Boris Farber, Android Developer Relations Engineers, and Xavier Ducrohet, Android Studio Tech Lead

To improve build speed and provide stable APIs, the Transform APIs will be removed in Android Gradle plugin (AGP) version 8.0. Most use cases have replacement APIs which are available starting from AGP version 7.2. Read on for more details.

The Android developer community's top request has been to improve build speed while making sure Android Gradle plugin (AGP) has a solid, stable, and well supported API.

To improve build speed starting from AGP 7.2, we have stabilized the Artifacts API and updated the Instrumentation API. For common use cases, these APIs replace the Transform APIs, which cause longer build times and are gone in AGP 8.0.

This article walks you through transitioning off the Transform APIs, whether you're working on a Gradle plugin or an application.

Guidance for Gradle plugins

To improve build times, we split Transform's functionality into the following APIs that are optimized for common use cases:

  • The Instrumentation API lets you transform and analyze compiled app classes using ASM callbacks. For example use this API to add custom traces to methods or classes for additional or custom logging.
  • The Artifacts API gives access to files or directories, whether temporary or final, that are produced by AGP during the build. Use this API to:
    • Add additional generated classes to the app, such as glue code for dependency injection.
    • Implement transformations based on whole program analysis, when all classes can be transformed together in a single task. This is only available starting from AGP 7.4.0-alpha06. The build.gradle.kts file in the “modifyProjectClasses'' Gradle recipe shows how to do it.

For examples of how to use the replacement APIs see the Transform API update note, and our Gradle recipes.

Guidance for apps

Make sure that you update your plugins to be AGP 8.0 compliant before updating your app to AGP 8.0. If the relevant plugins are not compliant, please create a bug that includes a link to this post and send it to the plugin authors.

Several commonly used plugins have already migrated to use these new APIs, including the Hilt Gradle plugin.

Share your feedback

If your use case is not covered by any of the new APIs, please file a bug.

We encourage you to get started with making your plugins compatible with the new AGP APIs. Getting started now means that you have enough time to familiarize yourself with the APIs, share your feedback and then upgrade your dependencies and plugins.

Preparing your Gradle build for package visibility in Android 11


Posted by David Winer, Product Manager

illustration of mobile device with lock
One of the central themes for Android 11 has been protecting user privacy. On Android 10 and earlier, you could query the full set of installed apps using methods like queryIntentActivities(). Often, however, this approach provides much more access than most apps need to implement their functionality. To better protect user privacy, we updated how apps view and interact with other installed apps on Android 11.
To provide better accountability for access to installed apps, apps targeting Android 11 (API level 30) will see a filtered list of installed apps by default. The new <queries> element in your app or library’s Android manifest allows you to describe which other apps you might need to interact with. For more information about this change, check out our Medium post on package visibility in Android 11.

Android Studio and Gradle support

If you are using Android Gradle plugin 4.1+, your tools should work with the new <queries> declaration. However, older versions of the Android Gradle plugin are not aware of this new element. If you add the <queries> element or if you start relying on a library or SDK that supports targeting Android 11, you may encounter manifest merging errors. For example, when building your app you may see the following error in the Build Output Window:
Android resource linking failed /Users/sample/AndroidStudioProjects/MyApp/app/build/intermediates/merged_manifests/debug/AndroidManifest.xml:18: error: unexpected element <queries> found in <manifest>
Alternatively, you may see an error in the Build Output Window that directs you to the Manifest merger logs:
Manifest merger failed with multiple errors, see logs
Upon expanding the Merged Manifest view you would then see an additional error:
Error: Missing 'package' key attribute on element package

Android Gradle plugin fixes

The best solution to deal with these errors is to upgrade to Android Gradle plugin 4.1 Beta.
We know that not everyone is ready to upgrade to the latest version, though, and you may be relying on old versions of Gradle or libraries that aren’t compatible with 4.1.
So, today we issued a set of dot releases for the Android Gradle plugin that are compatible with <queries>:
For example, if you are currently using Android Gradle plugin version 4.0.0, you can upgrade the version in your project-level build.gradle file:
 buildscript {

    repositories {
        google()
        jcenter()
    }

    dependencies {
        // classpath 'com.android.tools.build:gradle:4.0.0'
        classpath 'com.android.tools.build:gradle:4.0.1'
    }
}

For more information on this new feature in Android 11, check out the package visibility documentation and the Android Gradle plugin release notes.

Preparing your Gradle build for package visibility in Android 11


Posted by David Winer, Product Manager

illustration of mobile device with lock
One of the central themes for Android 11 has been protecting user privacy. On Android 10 and earlier, you could query the full set of installed apps using methods like queryIntentActivities(). Often, however, this approach provides much more access than most apps need to implement their functionality. To better protect user privacy, we updated how apps view and interact with other installed apps on Android 11.
To provide better accountability for access to installed apps, apps targeting Android 11 (API level 30) will see a filtered list of installed apps by default. The new <queries> element in your app or library’s Android manifest allows you to describe which other apps you might need to interact with. For more information about this change, check out our Medium post on package visibility in Android 11.

Android Studio and Gradle support

If you are using Android Gradle plugin 4.1+, your tools should work with the new <queries> declaration. However, older versions of the Android Gradle plugin are not aware of this new element. If you add the <queries> element or if you start relying on a library or SDK that supports targeting Android 11, you may encounter manifest merging errors. For example, when building your app you may see the following error in the Build Output Window:
Android resource linking failed /Users/sample/AndroidStudioProjects/MyApp/app/build/intermediates/merged_manifests/debug/AndroidManifest.xml:18: error: unexpected element <queries> found in <manifest>
Alternatively, you may see an error in the Build Output Window that directs you to the Manifest merger logs:
Manifest merger failed with multiple errors, see logs
Upon expanding the Merged Manifest view you would then see an additional error:
Error: Missing 'package' key attribute on element package

Android Gradle plugin fixes

The best solution to deal with these errors is to upgrade to Android Gradle plugin 4.1 Beta.
We know that not everyone is ready to upgrade to the latest version, though, and you may be relying on old versions of Gradle or libraries that aren’t compatible with 4.1.
So, today we issued a set of dot releases for the Android Gradle plugin that are compatible with <queries>:
For example, if you are currently using Android Gradle plugin version 4.0.0, you can upgrade the version in your project-level build.gradle file:
 buildscript {

    repositories {
        google()
        jcenter()
    }

    dependencies {
        // classpath 'com.android.tools.build:gradle:4.0.0'
        classpath 'com.android.tools.build:gradle:4.0.1'
    }
}

For more information on this new feature in Android 11, check out the package visibility documentation and the Android Gradle plugin release notes.

Preparing your Gradle build for package visibility in Android 11


Posted by David Winer, Product Manager

illustration of mobile device with lock
One of the central themes for Android 11 has been protecting user privacy. On Android 10 and earlier, you could query the full set of installed apps using methods like queryIntentActivities(). Often, however, this approach provides much more access than most apps need to implement their functionality. To better protect user privacy, we updated how apps view and interact with other installed apps on Android 11.
To provide better accountability for access to installed apps, apps targeting Android 11 (API level 30) will see a filtered list of installed apps by default. The new <queries> element in your app or library’s Android manifest allows you to describe which other apps you might need to interact with. For more information about this change, check out our Medium post on package visibility in Android 11.

Android Studio and Gradle support

If you are using Android Gradle plugin 4.1+, your tools should work with the new <queries> declaration. However, older versions of the Android Gradle plugin are not aware of this new element. If you add the <queries> element or if you start relying on a library or SDK that supports targeting Android 11, you may encounter manifest merging errors. For example, when building your app you may see the following error in the Build Output Window:
Android resource linking failed /Users/sample/AndroidStudioProjects/MyApp/app/build/intermediates/merged_manifests/debug/AndroidManifest.xml:18: error: unexpected element <queries> found in <manifest>
Alternatively, you may see an error in the Build Output Window that directs you to the Manifest merger logs:
Manifest merger failed with multiple errors, see logs
Upon expanding the Merged Manifest view you would then see an additional error:
Error: Missing 'package' key attribute on element package

Android Gradle plugin fixes

The best solution to deal with these errors is to upgrade to Android Gradle plugin 4.1 Beta.
We know that not everyone is ready to upgrade to the latest version, though, and you may be relying on old versions of Gradle or libraries that aren’t compatible with 4.1.
So, today we issued a set of dot releases for the Android Gradle plugin that are compatible with <queries>:
For example, if you are currently using Android Gradle plugin version 4.0.0, you can upgrade the version in your project-level build.gradle file:
 buildscript {

    repositories {
        google()
        jcenter()
    }

    dependencies {
        // classpath 'com.android.tools.build:gradle:4.0.0'
        classpath 'com.android.tools.build:gradle:4.0.1'
    }
}

For more information on this new feature in Android 11, check out the package visibility documentation and the Android Gradle plugin release notes.