PC パソコン

How to Fix “The Configuration.setVisible(boolean) method has been deprecated” in Android Studio

Android Studio may show The Configuration.setVisible(boolean) method has been deprecated during Gradle Sync or a build. Gradle’s Configuration visibility API is a legacy property that does not affect dependency resolution and is scheduled for removal. A known case where Android Gradle Plugin itself emitted this warning was fixed in AGP 9.5.0-alpha06.

Representative warning

The Configuration.setVisible(boolean) method has been deprecated.
This is scheduled to be removed in Gradle 11.
Consult the upgrading guide for further information.

The removal version printed in the message can vary with the Gradle release. The important part is the reference to Configuration.setVisible(boolean) or the corresponding visible property. It is normally a warning rather than an immediate build error, but CI configured with --warning-mode=fail can turn it into a failed build.

Cause

Gradle’s official API documentation describes Configuration visibility as a legacy value that does not control dependency resolution or cross-project access, so there is no need to set it. Google tracked an AGP call that produced this warning in Issue #560282299 and lists it as fixed in AGP 9.5.0-alpha06, released alongside Android Studio Rabbit 2 Canary 1.

The same warning can also come from a custom Gradle plugin or a third-party plugin. In that case, updating only AGP may not remove it.

Conditions and affected versions

  • An Android project is synced or built with a Gradle 9 release that reports the deprecation.
  • AGP or another Gradle plugin calls Configuration.setVisible(boolean).
  • Warnings are expanded with --warning-mode=all, or CI treats deprecations strictly.

Android Studio Rabbit 2 Canary 1 was released on September 17, 2026 together with AGP 9.5.0-alpha06. Google’s fixed-issues list identifies that combination as containing the fix, but it does not specify the exact first AGP version that began emitting the warning.

Recommended solution

  1. First obtain a detailed warning and stack trace to determine whether the caller is AGP or another plugin.
./gradlew help --warning-mode=all --stacktrace
  1. If AGP is the caller and preview tooling is acceptable, update to AGP 9.5.0-alpha06 or newer.
  2. Update Android Studio to Rabbit 2 Canary 1 or newer and use compatible Gradle and JDK versions.
  3. Stop the Gradle daemon and rerun the build to confirm the warning is gone.
./gradlew --stop
./gradlew clean
./gradlew assembleDebug --warning-mode=all

For a version catalog, the update can look like this:

[versions]
agp = "9.5.0-alpha06"

Fixing a custom Gradle plugin

If your own plugin or build logic is responsible, remove calls such as configuration.isVisible = false or configuration.setVisible(false). According to Gradle’s documentation, the value has no effect on dependency resolution.

// Remove this legacy configuration
configurations.configureEach {
    isVisible = false
}

If the original intent was to describe the role of a Configuration, define canBeResolved, canBeConsumed, and canBeDeclared as appropriate. These are not mechanical replacements for visibility; choose them according to whether the configuration is resolved, published, or used to declare dependencies.

Alternatives when you cannot update

  • If the stack trace points only to AGP and normal builds succeed, document the known warning until the fix reaches a version suitable for your project.
  • If CI uses --warning-mode=fail, temporarily returning to --warning-mode=all may keep CI running after a risk review. This does not fix the deprecated call.
  • If a third-party plugin is responsible, check for an updated release and report the stack trace and Gradle version to its maintainer.

Avoid globally hiding warnings with org.gradle.warning.mode=none, because that also conceals unrelated compatibility warnings. Even when you cannot upgrade immediately, capture the caller with --warning-mode=all.

How to verify the fix

  1. Run ./gradlew help --warning-mode=all and confirm that the setVisible warning is absent.
  2. Run assembleDebug and the normal CI tasks again.
  3. If the build defines custom configurations, verify that dependency resolution, publication, and declaration behavior is unchanged.
  4. When practical, run a separate CI check that treats warnings as failures to test future Gradle compatibility.

Cautions

This warning usually does not break the current build, but it can become a compatibility problem after the deprecated API is removed. Identical text does not prove that AGP is the caller. If the warning remains after updating AGP, follow the stack trace through custom plugins, third-party plugins, buildSrc, and included builds.

Summary

The Configuration.setVisible(boolean) method has been deprecated means that build logic called a Gradle Configuration visibility API whose value is no longer meaningful. The known AGP-originated warning is fixed in AGP 9.5.0-alpha06. Use --warning-mode=all --stacktrace to identify the caller, update AGP when it is responsible, or remove the visibility assignment from custom build logic and model the configuration’s real role explicitly.

Official references