Android Studio断电崩溃重启后Clean Project等选项禁用求解决方案
Hey, I’ve dealt with this exact headache after a sudden power cut—nothing’s more annoying than having Android Studio’s core features locked up like that. Let’s walk through the tried-and-tested fixes that got my setup back to normal:
1. Invalidate Caches & Restart (First Go-To Fix)
This is the most common fix for weird AS glitches caused by corrupted cache files from the crash:
- Open Android Studio, go to File > Invalidate Caches...
- Check the box next to "Invalidate and Restart"
- Let AS fully restart and rebuild its cache files. This might take a minute, but it fixes most minor corruption issues.
2. Delete Corrupted Project Configuration Folders
Power outages often mess up the hidden config folders in your project. Here’s how to reset them:
- Close Android Studio completely
- Navigate to your project’s root directory
- Delete the
.ideafolder and all.gradlefolders (both the one in the project root and any inside module folders) - Reopen Android Studio—it’ll automatically regenerate these config files from scratch.
3. Force a Gradle Sync
Sometimes the sync state gets stuck, which disables run/clean features:
- Open your project in AS
- Look for the "Sync Project with Gradle Files" button (it looks like a refresh icon in the top-right toolbar)
- Click it and wait for the sync to finish. If there are errors (like missing dependencies), check the Build tab for details and fix them first.
4. Check for Corrupted Build Files
If the power cut happened while AS was writing to build.gradle files, they might be incomplete:
- Open your project’s root
build.gradlefile and each module’sbuild.gradlefile - Look for syntax errors, unclosed brackets, or truncated lines (like a dependency that cuts off mid-string)
- Fix any issues you find, then re-run the Gradle sync.
5. Re-Import the Project
If all else fails, a fresh import can reset broken project bindings:
- Close Android Studio
- Make a backup copy of your project folder (just to be safe)
- Open AS and select "Import Project" from the welcome screen
- Navigate to your project’s root folder and follow the import wizard to set it up again.
Quick Note
If none of these work, it’s possible the Android Studio installation itself got corrupted. In that case, uninstall AS, delete any leftover config folders (like ~/.AndroidStudioX.X on Linux/macOS or C:\Users\YourName\.AndroidStudioX.X on Windows), then reinstall the latest version.
内容的提问来源于stack exchange,提问作者Mohammed Nishar

