最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

android studio - org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed - Stack Overflow

programmeradmin6浏览0评论

I encountered the following error while building my Android project in Android Studio: org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed

This error appeared suddenly when I tried to sync Gradle or build my project.

I tried the following to fix the issue:

  • Invalidating caches and restarting Android Studio (File → Invalidate Caches & Restart).
  • Syncing Gradle manually (File → Sync Project with Gradle Files).
  • Checking build.gradle files for syntax errors.
  • Upgrading Gradle and Android Gradle Plugin to the latest version.
  • Running Gradle commands from the terminal: ./gradlew clean, ./gradlew build --stacktrace

Despite these attempts, the error persisted, and I wasn’t sure what was causing it. I expected these steps to resolve any Groovy or Gradle-related issues, but none of them worked.

I encountered the following error while building my Android project in Android Studio: org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed

This error appeared suddenly when I tried to sync Gradle or build my project.

I tried the following to fix the issue:

  • Invalidating caches and restarting Android Studio (File → Invalidate Caches & Restart).
  • Syncing Gradle manually (File → Sync Project with Gradle Files).
  • Checking build.gradle files for syntax errors.
  • Upgrading Gradle and Android Gradle Plugin to the latest version.
  • Running Gradle commands from the terminal: ./gradlew clean, ./gradlew build --stacktrace

Despite these attempts, the error persisted, and I wasn’t sure what was causing it. I expected these steps to resolve any Groovy or Gradle-related issues, but none of them worked.

Share Improve this question edited Feb 5 at 13:34 Juan Cruz Soler 8,2545 gold badges43 silver badges47 bronze badges asked Feb 5 at 12:23 Amit PardeshiAmit Pardeshi 112 bronze badges 1
  • I find it hard to believe, that this one-liner was the only useful error output. Especially since CLI was supposedly used to diagnose. – cfrick Commented Feb 5 at 15:02
Add a comment  | 

1 Answer 1

Reset to default 1

"org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed" in Android Studio The error "org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed" usually occurs due to Groovy/Gradle script issues or JDK incompatibility.

In my case, the problem was caused by Android Studio’s default JDK.

Solution:

Change JDK to a Locally Installed Version Open Android Studio.
Go to File → Settings → Build, Execution, Deployment → Build Tools → Gradle.
Under Gradle JDK, change the selection from the default Embedded JDK to your locally installed JDK.
Click Apply and OK, then restart Android Studio.
Sync Gradle again: File → Sync Project with Gradle Files.

Why Does This Happen?
The default JDK bundled with Android Studio might not be fully compatible with the Gradle version. Some third-party libraries require a specific JDK version to compile successfully. Gradle might be referencing an older or incompatible JDK, causing Groovy compilation issues.

Alternative Fixes

If changing the JDK doesn't work, try the following:
  1. Upgrade Gradle Open gradle-wrapper.properties and update to a newer Gradle version.
  2. Delete .gradle and .idea Folders Close Android Studio. Navigate to your project folder and delete: .gradle/ .idea/ Restart Android Studio and sync Gradle again.
  3. Run Gradle from the Command Line This provides more details about the error:

./gradlew clean
./gradlew build --stacktrace

Gradle Setting Image

发布评论

评论列表(0)

  1. 暂无评论