'Getting error "Execution failed for task ':app:compileFlutterBuildDebug'"

I'm trying to build a flutter application which has already been developed in other system but I'm getting the gradle error as given below :

Launching lib/main.dart on sdk gphone64 arm64 in debug mode... Running Gradle task 'assembleDebug'... Warning: Mapping new ns http://schemas.android.com/repository/android/common/02 to old ns http://schemas.android.com/repository/android/common/01 Warning: Mapping new ns http://schemas.android.com/repository/android/generic/02 to old ns http://schemas.android.com/repository/android/generic/01 Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/addon2/02 to old ns http://schemas.android.com/sdk/android/repo/addon2/01 Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/repository2/02 to old ns http://schemas.android.com/sdk/android/repo/repository2/01 Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/sys-img2/02 to old ns http://schemas.android.com/sdk/android/repo/sys-img2/01 Error: Cannot run with sound null safety, because the following dependencies don't support null safety:

  • package:flutter_webview_plugin

For solutions, see https://dart.dev/go/unsound-null-safety

FAILURE: Build failed with an exception.

  • Where: Script '/Users/karanmehta/Flutter_SDK/flutter/packages/flutter_tools/gradle/flutter.gradle' line: 1102

  • What went wrong: Execution failed for task ':app:compileFlutterBuildDebug'.

Process 'command '/Users/karanmehta/Flutter_SDK/flutter/bin/flutter'' finished with non-zero exit value 1

  • Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

  • Get more help at https://help.gradle.org

BUILD FAILED in 23s ********************************************************* WARNING: This version of flutter_webview_plugin will break your Android build if it or its dependencies aren't compatible with AndroidX. See link for more information on the problem and how to fix it. This warning prints for all Android build failures. The real root cause of the error may be unrelated. ********************************************************* Exception: Gradle task assembleDebug failed with exit code 1

Can someone please help?



Solution 1:[1]

flutter app upgrade:-

change your kotlin version available in yourprojectname/android/build.gradle

ext.kotlin_version = '1.6.10'

same below in build.gradle add this

dependencies {
    classpath 'com.android.tools.build:gradle:4.1.0'
    classpath "org.jetbrains.kotlin:kotlin-gradle- 
     plugin:$kotlin_version"
}

now go to gradle\wrapper\gradle-wrapper.properties and add this

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

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1