1

I created a new flutter project and when run it, it gives that error

Target kernel_snapshot failed: Exception: The value of -DDartDefines is not formatted correctly.
The value must be a JSON-encoded list of strings but was:
[flutter.inspector.structuredErrors=true]
build failed.

FAILURE: Build failed with an exception.

* Where:
Script 'D:\flutter\packages\flutter_tools\gradle\flutter.gradle' line: 882

* What went wrong:
Execution failed for task ':app:compileFlutterBuildDebug'.
> Process 'command 'D:\flutter\bin\flutter.bat'' 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
  Exception: Gradle task assembleDebug failed with exit code 1

I have tried flutter clean, and same error

flutter doctor log :

D:\flutter\bin\flutter.bat doctor --verbose
[√] Flutter (Channel master, v1.16.4-pre.69, on Microsoft Windows [Version 10.0.18363.959], locale en-US)
    • Flutter version 1.16.4-pre.69 at D:\flutter
    • Framework revision 19e7db585d (4 months ago), 2020-04-01 11:16:01 -0700
    • Engine revision c9506cb8e9
    • Dart version 2.8.0 (build 2.8.0-dev.18.0 eea9717938)

[!] Android toolchain - develop for Android devices (Android SDK version 29.0.3)
    • Android SDK at C:\Users\user\AppData\Local\Android\sdk
    • Platform android-29, build-tools 29.0.3
    • 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)
    ! Some Android licenses not accepted.  To resolve this, run: flutter doctor --android-licenses

[√] 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)

[!] VS Code (version 1.47.2)
    • VS Code at C:\Users\user\AppData\Local\Programs\Microsoft VS Code
    X Flutter extension not installed; install from
      https://marketplace.visualstudio.com/items?itemName=Dart-Code.flutter

[!] Connected device
    ! No devices available

! Doctor found issues in 3 categories.
Process finished with exit code 0

1 Answer 1

1

According to what flutter doctor is giving you the problem might be related to Android Sdk not installed or not configured really well: Flutter provides a command to update the Android SDK path: Use

flutter config --android-sdk <path-to-your-android-sdk-path>

You can install it directly from Android Studio: To open the SDK Manager from Android Studio, click Tools > SDK Manager or click SDK Manager in the toolbar. You might have to uncheck "hide obsolete packages" and install the packages that were considered obsoletes.

Or you can install it from this link and configure it like I said before: https://www.google.com/url?sa=t&source=web&rct=j&url=https://android-sdk.fr.uptodown.com/windows&ved=2ahUKEwi-itWCkuzqAhXTZTUKHa29CRMQFjACegQIAhAB&usg=AOvVaw1QSSVVMrZzFltXvboDbTeQ

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.