升级Android Studio 3.1.2后遇Configuration on demand问题求助
Hey, I get it—following the official suggestion still didn’t fix the issue, that’s super frustrating. Let’s work through this step by step to get it sorted:
1. Double-check your gradle.properties setup
First, make sure you’re editing the project-level gradle.properties (the one in your root project folder, not inside a module). Double-check the line you added has no typos:
org.gradle.configureondemand=false
After adding it, don’t forget to manually sync your project—click the "Sync Project with Gradle Files" button in the top-right corner, or go to File > Sync Project with Gradle Files. Sometimes Android Studio doesn’t pick up config changes automatically.
2. Match your Android Gradle Plugin and Gradle versions properly
Android Studio 3.1.2 is designed to work best with Gradle 4.4, not 4.6+. Using a mismatched version could be the root cause here. Let’s adjust them to the recommended pair:
- Open your project’s root
build.gradlefile, and confirm the plugin version is set to 3.1.2:dependencies { classpath 'com.android.tools.build:gradle:3.1.2' // Other dependencies go here... } - Then head to
gradle/wrapper/gradle-wrapper.propertiesand update the Gradle distribution URL to:distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-all.zip
Sync the project again after making these changes—this is the most reliable version combo for AS 3.1.2.
3. Wipe Android Studio’s cache and restart
Stale cache can sometimes block config changes from taking effect. Let’s do a full reset:
- Go to
File > Invalidate Caches / Restart..., then select "Invalidate and Restart". This will clear all cached data and restart Studio fresh.
4. Check for conflicting configurations
If you have custom Gradle scripts or CI-related configs in your project, they might be overriding the configureondemand setting. Test if running a build from the terminal with the flag explicitly disabled works:
./gradlew build --no-configure-on-demand
If this command runs successfully, you’ll need to dig through any additional Gradle files in your project to find where the conflicting setting is coming from.
If none of these steps work, try creating a brand new empty project with AS 3.1.2, then compare its config files to your existing project—this can help spot any weird custom settings that might be causing the conflict.
内容的提问来源于stack exchange,提问作者Dick Lucas

