Can't run project from Android Studio but can run it in Terminal

Viewed 289

Have recently upgraded Android Studio and plugins. After that I have the following problem.

Using the "auto generated code" (code that is generated when you start a new Flutter project) without any changes made, I get the following error when pressing the run button:

Launching lib\main.dart on AOSP on IA Emulator in debug mode... Running Gradle task 'assembleDebug'... 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 'C:\src\flutter\packages\flutter_tools\gradle\flutter.gradle' line: 840

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

Process 'command 'C:\src\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

BUILD FAILED in 2s Exception: Gradle task assembleDebug failed with exit code 1

However, I can run the program successfully in the Terminal using the "flutter run" command.

Flutter doctor output is as follows:

[√] Flutter (Channel master, v1.16.3-pre.56, on Microsoft Windows [Version 10.0.18363.900], locale en-US) • Flutter version 1.16.3-pre.56 at C:\src\flutter • Framework revision 8857c4cec8 (3 months ago), 2020-03-25 21:21:01 -0400 • Engine revision b235233e9d • Dart version 2.8.0 (build 2.8.0-dev.17.0 2323087237)

[√] Android toolchain - develop for Android devices (Android SDK version 29.0.3) • Android SDK at C:\Users\Pierre\AppData\Local\Android\sdk • Android NDK location not configured (optional; useful for native profiling support) • Platform android-29, build-tools 29.0.3 • Java binary at: C:\Program Files\Android\Android Studio1\jre\bin\java • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b01) • All Android licenses accepted.

[√] Android Studio (version 4.0) • Android Studio at C:\Program Files\Android\Android Studio1 • Flutter plugin version 47.1.2 • Dart plugin version 193.7361 • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b01)

[√] Connected device (1 available) • AOSP on IA Emulator • emulator-5554 • android-x86 • Android 9 (API 28) (emulator)

• No issues found! Process finished with exit code 0

Can you please help me resolving this problem?

Thanks!

1 Answers

My problem was that i accidentaly leave "--" in run options and didnt noticed it first.

Image

1

Related