Maaz Zindani

Loading the index…

↑↓ move↵ openesc close4072 pages
Flutter and app store releases

Gradle cannot start the Android application plugin

ErrorCould not create plugin of type 'AppPlugin'

Short answer

The Android Gradle plugin refuses to load when the Gradle or the JDK running the build is older than the plugin supports. Read the 'Caused by' lines under the error, then compare the plugin version in your build file with the minimum Gradle and JDK versions in the Android documentation, and raise whichever is too old.

  • Applies to Android Gradle plugin 7.0 to 9.5, Gradle 7.0 to 9.6, JDK 11 and 17
  • Updated
  • By Maaz Zindani, Senior Software Engineer

Fix it fast

  1. 1Find out which cause you have

    Read the three versions that must fit together. First the Gradle version the wrapper downloads, then the plugin version in the build file, then the Java that runs Gradle.

    ./gradlew --version
    grep -rn "com.android.application" --include=build.gradle --include=build.gradle.kts --include=libs.versions.toml .
    java -version
  2. 2Match what you see, then jump to its fix

    1. 1The error appears right after you raised the plugin version, or opened a project that was upgraded on another machineGradle is older than the plugin's minimum versionFix
    2. 2The versions in the first step match the table, but 'java -version' shows a release older than the plugin needs, for example Java 8 or 11 with a plugin from the 8.x or 9.x seriesGradle runs on a JDK that is older than the plugin requiresFix

What does the error look like?

  • Could not create plugin of type 'AppPlugin'
  • A problem occurred configuring project ':app'

Cause 1 of 2

Gradle is older than the plugin's minimum version

1Check

The Android documentation lists the minimum Gradle for each plugin version: 7.0 needs 7.0, 8.0 needs 8.0, 8.13 needs 8.13, 9.0 needs 9.1.0 and 9.5 needs 9.6.0. Compare it with the distributionUrl in the wrapper file.

grep distributionUrl gradle/wrapper/gradle-wrapper.properties

2Fix

Raise Gradle with the wrapper task. The Gradle manual says to run it twice, because the first run updates only gradle-wrapper.properties. If the wrapper cannot start at all, edit distributionUrl by hand, as the Android documentation shows.

./gradlew :wrapper --gradle-version 8.13
./gradlew :wrapper --gradle-version 8.13

# gradle/wrapper/gradle-wrapper.properties (manual edit)
distributionUrl=https\://services.gradle.org/distributions/gradle-8.13-bin.zip

3Verify

The wrapper now reports a version that meets the plugin's minimum, and the project configures.

./gradlew --version
./gradlew :app:tasks

Confirmed by developer.android.com

Did this fix it?

Cause 2 of 2

Gradle runs on a JDK that is older than the plugin requires

1Check

AGP 7.0 requires JDK 11 to run Gradle. AGP 8.0 requires JDK 17, and AGP 9.5 lists JDK 17 as its minimum too. Check which JDK Gradle really uses: JAVA_HOME, or the Gradle JDK setting in Android Studio.

echo $JAVA_HOME
java -version

2Fix

Point Gradle at a JDK of the required release. Outside Android Studio, set the JAVA_HOME environment variable or pass -Dorg.gradle.java.home with the install directory of the JDK, as the Android documentation describes.

# Linux or macOS shell (example path)
export JAVA_HOME=/usr/lib/jvm/java-17-openjdk-amd64
./gradlew -Dorg.gradle.java.home=$JAVA_HOME :app:tasks

3Verify

Run the build again from a fresh shell, with the JDK set as above.

./gradlew :app:assembleDebug

Confirmed by developer.android.com

Did this fix it?

How do I stop it coming back?

  • Change the plugin version and the Gradle wrapper version in the same commit, using the table in the Android documentation.
  • Pin the plugin version in one place (the version catalog or the root build file) so modules cannot disagree.
  • Set the Gradle JDK in Android Studio and JAVA_HOME on CI to the same release.
  • Commit gradle/wrapper/gradle-wrapper.properties, so every machine and CI runner downloads the same Gradle.

Sources

How was this page made?

I drafted this page with AI assistance from the official documents listed under Sources. Every cause above names the document that confirms it. I have not reproduced this fix on a machine of my own yet, so read it as documented guidance, not a test report. Found a mistake? Tell me.

Which stack is behind this page?

Projects of mine built on the same technologies:

Related fixes

Mobile apps

Android Studio cannot pair the phone over Wi-Fi

The Pair devices over Wi-Fi dialog lists no device

Wireless pairing needs the phone on Android 11 or higher and on the same Wi-Fi network as the computer, with current Platform-Tools.

4 causes, each with a fix

Next step

Want this handled for good?

I look after servers, apps and releases end to end. Tell me what keeps breaking.