Exception: Gradle task assembleDebug failed with exit code 1, visual studio code

685

You should update the package 'flutter_svg' from 0.18.1 to 0.19.3 and it should solve your issue, it happens because of the 'nullOk' parameter that was removed in Flutter 2. You can read about it here: https://flutter.dev/docs/release/breaking-changes/eliminating-nullok-parameters

I found this solution and it worked for me

Share:
685
amr magdy
Author by

amr magdy

Updated on December 28, 2022

Comments

  • amr magdy
    amr magdy over 1 year

    my app was running normally , after running flutter upgrade it gives me this error . I didn't change anything in my code. note: I am using visual studio code I tried flutter clean, flutter upgrade but it gives the same error . I checked JAVA_HOME path and it is okay

    ../../flutter/.pub-cache/hosted/pub.dartlang.org/flutter_svg-0.18.1/lib/src/picture_provider.dart:50:59: Error: No named parameter with the name 
    'nullOk'.
            context != null ? Localizations.localeOf(context, nullOk: true) : null,
                                                              ^^^^^^        
    ../../flutter/packages/flutter/lib/src/widgets/localizations.dart:413:17: Context: Found this candidate, but the arguments don't match.
      static Locale localeOf(BuildContext context) {
                    ^^^^^^^^
                                                                            
                                                                            
    FAILURE: Build failed with an exception.
    
    * Where:
    Script 'D:\mobileapps\flutter\packages\flutter_tools\gradle\flutter.gradle' line: 991
                                                                            
    * What went wrong:
    Execution failed for task ':app:compileFlutterBuildDebug'.
    > Process 'command 'D:\mobileapps\flutter\bin\flutter.bat'' finished with non-zero exit value 1
    
    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 49s
    Running Gradle task 'assembleDebug'...
    Running Gradle task 'assembleDebug'... Done                        50.5s
    Exception: Gradle task assembleDebug failed with exit code 1
    

    this is the result of run doctor -v

    [√] Flutter (Channel stable, 2.0.1, on Microsoft Windows [Version 10.0.18362.30], locale en-US)
        • Flutter version 2.0.1 at D:\mobileapps\flutter
        • Framework revision c5a4b4029c (7 days ago), 2021-03-04 09:47:48 -0800
        • Engine revision 40441def69
        • Dart version 2.12.0
    
    [√] Android toolchain - develop for Android devices (Android SDK version 30.0.1)
        • Android SDK at C:\Users\hit-ham\AppData\Local\Android\sdk
        • Platform android-29, build-tools 30.0.1
        • Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java
        • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b01)
        • All Android licenses accepted.
    
    [√] Chrome - develop for the web
        • Chrome at C:\Program Files (x86)\Google\Chrome\Application\chrome.exe
    
    [√] Android Studio (version 4.0)
        • Android Studio at C:\Program Files\Android\Android Studio
        • Flutter plugin version 47.1.2
        • Dart plugin version 193.7361
        • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b01)
    rosoft VS Code
        • Flutter extension version 3.20.0
    
    [√] Connected device (2 available)
        • GM1910 (mobile) • bb671501 • android-arm64  • Android 10 (API 29)
        • Chrome (web)    • chrome   • web-javascript • Google Chrome 88.0.4324.190
    
    • No issues found!
    
  • S.M.Fazle Rabbi
    S.M.Fazle Rabbi over 2 years
    Thank you so much. Your answer save my life. It was very silly problem but shown very big error. Thanks ones again