Solved: Execution failed for task ‘:flutter_shieldfraud:compileDebugKotlin’

When you encounter a build failure related to Kotlin compilation in a Flutter project, it usually indicates a problem with the Kotlin code in one of your dependencies or plugins.Here’s a step-by-step approach to resolve this issue:

Check the Logs
Run the build command with additional options to get more details in the terminal of Vscode or Android Studio:

flutter build apk –verbose


Or, if you’re using Gradle directly:

 ./gradlew assembleDebug --info

Update Kotlin and Gradle Versions

Look for specific error messages or issues in the logs. This might give you hints about what’s going wrong.

Kotlin Version

Open your android/build.gradle file and update the Kotlin version: [https://kotlinlang.org/docs/releases.html#release-details] this link shows kotlin latest version use that one based on flutter version here i m using 2.0.20

ext.kotlin_version = '2.0.20'  // Use the latest compatible version

Gradle Wrapper:

Open android/gradle/wrapper/gradle-wrapper.properties and update the Gradle distribution UR

distributionUrl=https\://services.gradle.org/distributions/gradle-8.0.2-all.zip

Gradle Plugin:

Go to android/build.gradle and update the Gradle plugin version:
classpath 'com.android.tools.build:gradle:8.0.2'

Clean and Rebuild

After update then run following commands one by one in terminal

flutter clean
flutter pub get
flutter build apk

Check for Plugin Updates

flutter pub upgrade

Verify Compatibility

Ensure that all your plugins and dependencies are compatible with your Flutter and Kotlin versions. Incompatibilities can cause unexpected build issues.

If any package create issue in pubspec yaml file remove version so that it will work like this:

#old
http: 2.00

#new
http: #2.00

Review Kotlin Code

If the issue seems related to a particular plugin (e.g., flutter_shieldfraud), check if there’s a known problem or recent bug report with that plugin. You can:

  • Look at the Plugin’s Issue Tracker: Search for similar issues.
  • Contact Plugin Maintainers: If there’s no solution, consider opening a new issue or reaching out to the maintainers.

Stop the Gradle Daemon

Sometimes, issues arise from the Gradle Daemon process. Try stopping it and then rebuilding:

./gradlew --stop
flutter build apk

Use the --stacktrace Option

If you still need more detailed information, use the stack trace option:

./gradlew assembleDebug --stacktrace


After following these steps, the flutter_shieldfraud:compileDebugKotlin issue should be resolved. If you still face any problems, feel free to reach out to us or share the issue in the comments, and we’ll suggest alternative solutions.

Leave a Reply

Your email address will not be published. Required fields are marked *

web_horizontal
About Us Disclaimer Privacy Policy Terms & Conditions Contact Us

Copyright © 2023 ResearchThinker.com. All rights reserved.