I have tried almost everything I could find but I am not able to resolve this error. This is the first time I'm installing flutter on the computer. The first project I try is giving me this error.
I got flutter from their GitHub repo, master branch and I installed all the SDK tools from the AUR. Installed SDK tools
I basically followed this tutorial. I have installed the flutter and dart extensions in VS Code.
I'm doing all this on a vanilla arch system.
I have not done any changes to any part of the code and according to the information that people have asked for, these are the outputs of the commands
flutter run --debug
Using hardware rendering with device Android SDK built for x86. If you notice graphics artifacts, consider enabling software rendering with
"--enable-software-rendering".
Launching lib/main.dart on Android SDK built for x86 in debug mode...
FAILURE: Build failed with an exception.
* What went wrong:
Could not open settings generic class cache for settings file '/home/somannak/Scripts/flutter/anothertry/android/settings.gradle' (/home/somannak/.gradle/caches/6.7/scripts/f0emg6u6oecmxqzgk5g9nn4ui).
> BUG! exception in phase 'semantic analysis' in source unit '_BuildScript_' Unsupported class file major version 61
* 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 521ms
Running Gradle task 'assembleDebug'... 978ms
Exception: Gradle task assembleDebug failed with exit code 1
flutter run --verbose
[ +47 ms] executing: uname -m
[ +25 ms] Exit code 0 from: uname -m
[ ] x86_64
[ +6 ms] executing: [/home/somannak/applications/flutter/] git -c log.showSignature=false log -n 1 --pretty=format:%H
[ +4 ms] Exit code 0 from: git -c log.showSignature=false log -n 1 --pretty=format:%H
[ ] fb3f123771d35171b08d1a8b41fccac5816f2f69
[ ] executing: [/home/somannak/applications/flutter/] git tag --points-at fb3f123771d35171b08d1a8b41fccac5816f2f69
[ +11 ms] Exit code 0 from: git tag --points-at fb3f123771d35171b08d1a8b41fccac5816f2f69
[ +1 ms] executing: [/home/somannak/applications/flutter/] git describe --match *.*.* --long --tags fb3f123771d35171b08d1a8b41fccac5816f2f69
[ +32 ms] Exit code 0 from: git describe --match *.*.* --long --tags fb3f123771d35171b08d1a8b41fccac5816f2f69
[ ] 2.6.0-11.0.pre-770-gfb3f123771
[ +6 ms] executing: [/home/somannak/applications/flutter/] git rev-parse --abbrev-ref --symbolic @{u}
[ +4 ms] Exit code 0 from: git rev-parse --abbrev-ref --symbolic @{u}
[ ] origin/master
[ ] executing: [/home/somannak/applications/flutter/] git ls-remote --get-url origin
[ +5 ms] Exit code 0 from: git ls-remote --get-url origin
[ ] https://github.com/flutter/flutter.git
[ +65 ms] executing: [/home/somannak/applications/flutter/] git rev-parse --abbrev-ref HEAD
[ +4 ms] Exit code 0 from: git rev-parse --abbrev-ref HEAD
[ ] master
[ +47 ms] Artifact Instance of 'AndroidGenSnapshotArtifacts' is not required, skipping update.
[ ] Artifact Instance of 'AndroidInternalBuildArtifacts' is not required, skipping update.
[ ] Artifact Instance of 'IOSEngineArtifacts' is not required, skipping update.
[ ] Artifact Instance of 'FlutterWebSdk' is not required, skipping update.
[ +2 ms] Artifact Instance of 'WindowsEngineArtifacts' is not required, skipping update.
[ ] Artifact Instance of 'WindowsUwpEngineArtifacts' is not required, skipping update.
[ ] Artifact Instance of 'MacOSEngineArtifacts' is not required, skipping update.
[ ] Artifact Instance of 'LinuxEngineArtifacts' is not required, skipping update.
[ ] Artifact Instance of 'LinuxFuchsiaSDKArtifacts' is not required, skipping update.
[ ] Artifact Instance of 'MacOSFuchsiaSDKArtifacts' is not required, skipping update.
[ ] Artifact Instance of 'FlutterRunnerSDKArtifacts' is not required, skipping update.
[ ] Artifact Instance of 'FlutterRunnerDebugSymbols' is not required, skipping update.
[ +55 ms] executing: /opt/android-sdk/platform-tools/adb devices -l
[ +37 ms] List of devices attached
emulator-5554 device product:sdk_gphone_x86 model:Android_SDK_built_for_x86 device:generic_x86 transport_id:1
[ +6 ms] /opt/android-sdk/platform-tools/adb -s emulator-5554 shell getprop
[ +19 ms] Artifact Instance of 'AndroidInternalBuildArtifacts' is not required, skipping update.
[ ] Artifact Instance of 'IOSEngineArtifacts' is not required, skipping update.
[ +1 ms] Artifact Instance of 'WindowsEngineArtifacts' is not required, skipping update.
[ ] Artifact Instance of 'WindowsUwpEngineArtifacts' is not required, skipping update.
[ ] Artifact Instance of 'MacOSEngineArtifacts' is not required, skipping update.
[ ] Artifact Instance of 'LinuxEngineArtifacts' is not required, skipping update.
[ ] Artifact Instance of 'LinuxFuchsiaSDKArtifacts' is not required, skipping update.
[ ] Artifact Instance of 'MacOSFuchsiaSDKArtifacts' is not required, skipping update.
[ ] Artifact Instance of 'FlutterRunnerSDKArtifacts' is not required, skipping update.
[ ] Artifact Instance of 'FlutterRunnerDebugSymbols' is not required, skipping update.
[ +96 ms] Skipping pub get: version match.
[ +54 ms] Generating /home/somannak/Scripts/flutter/anothertry/android/app/src/main/java/io/flutter/plugins/GeneratedPluginRegistrant.java
[ +45 ms] ro.hardware = ranchu
[ +11 ms] Using hardware rendering with device Android SDK built for x86. If you notice graphics artifacts, consider enabling software rendering with
"--enable-software-rendering".
[ +31 ms] Initializing file store
[ +9 ms] Skipping target: gen_localizations
[ +7 ms] gen_dart_plugin_registrant: Starting due to {InvalidatedReasonKind.inputChanged: The following inputs have updated contents:
/home/somannak/Scripts/flutter/anothertry/.dart_tool/package_config_subset}
[ +23 ms] gen_dart_plugin_registrant: Complete
[ +1 ms] Skipping target: _composite
[ +4 ms] complete
[ +7 ms] Launching lib/main.dart on Android SDK built for x86 in debug mode...
[ +4 ms] /home/somannak/applications/flutter/bin/cache/dart-sdk/bin/dart --disable-dart-dev
/home/somannak/applications/flutter/bin/cache/artifacts/engine/linux-x64/frontend_server.dart.snapshot --sdk-root
/home/somannak/applications/flutter/bin/cache/artifacts/engine/common/flutter_patched_sdk/ --incremental --target=flutter --debugger-module-names
--experimental-emit-debug-metadata -DFLUTTER_WEB_AUTO_DETECT=true --output-dill /tmp/flutter_tools.PTINBM/flutter_tool.UPUFNQ/app.dill --packages
/home/somannak/Scripts/flutter/anothertry/.dart_tool/package_config.json -Ddart.vm.profile=false -Ddart.vm.product=false --enable-asserts
--track-widget-creation --filesystem-scheme org-dartlang-root --initialize-from-dill build/c075001b96339384a97db4862b8ab8db.cache.dill.track.dill
--flutter-widget-cache --enable-experiment=alternative-invalidation-strategy
[ +12 ms] executing: /opt/android-sdk/platform-tools/adb -s emulator-5554 shell -x logcat -v time -t 1
[ +13 ms] <- compile package:anothertry/main.dart
[ +19 ms] --------- beginning of main
11-20 04:09:22.351 I/DeviceStateChecker( 3121): DeviceStateChecker cancelled
[ +10 ms] executing: /opt/android-sdk/platform-tools/adb version
[ +7 ms] Android Debug Bridge version 1.0.41
Version 31.0.3-7562133
Installed as /opt/android-sdk/platform-tools/adb
[ +2 ms] executing: /opt/android-sdk/platform-tools/adb start-server
[ +25 ms] Building APK
[ +15 ms] Running Gradle task 'assembleDebug'...
[ +3 ms] Using gradle from /home/somannak/Scripts/flutter/anothertry/android/gradlew.
[ +16 ms] executing: [/home/somannak/Scripts/flutter/anothertry/android/] /home/somannak/Scripts/flutter/anothertry/android/gradlew -Pverbose=true
-Ptarget-platform=android-x86 -Ptarget=/home/somannak/Scripts/flutter/anothertry/lib/main.dart -Pbase-application-name=android.app.Application
-Pdart-defines=RkxVVFRFUl9XRUJfQVVUT19ERVRFQ1Q9dHJ1ZQ== -Pdart-obfuscation=false -Ptrack-widget-creation=true -Ptree-shake-icons=false
-Pfilesystem-scheme=org-dartlang-root assembleDebug
[ +557 ms] Welcome to Gradle 6.7!
[ ] Here are the highlights of this release:
[ ] - File system watching is ready for production use
[ ] - Declare the version of Java your build requires
[ ] - Java 15 support
[ ] For more details see https://docs.gradle.org/6.7/release-notes.html
[ +96 ms] FAILURE: Build failed with an exception.
[ +1 ms] * What went wrong:
[ ] Could not open settings generic class cache for settings file '/home/somannak/Scripts/flutter/anothertry/android/settings.gradle'
(/home/somannak/.gradle/caches/6.7/scripts/f0emg6u6oecmxqzgk5g9nn4ui).
[ ] > BUG! exception in phase 'semantic analysis' in source unit '_BuildScript_' Unsupported class file major version 61
[ ] * 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 572ms
[ +374 ms] Running Gradle task 'assembleDebug'... (completed in 1,044ms)
[+6301 ms] Exception: Gradle task assembleDebug failed with exit code 1
[ ] "flutter run" took 7,909ms.
[ +4 ms]
#0 throwToolExit (package:flutter_tools/src/base/common.dart:10:3)
#1 RunCommand.runCommand (package:flutter_tools/src/commands/run.dart:684:9)
<asynchronous suspension>
#2 FlutterCommand.run.<anonymous closure> (package:flutter_tools/src/runner/flutter_command.dart:1161:27)
<asynchronous suspension>
#3 AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:150:19)
<asynchronous suspension>
#4 CommandRunner.runCommand (package:args/command_runner.dart:209:13)
<asynchronous suspension>
#5 FlutterCommandRunner.runCommand.<anonymous closure> (package:flutter_tools/src/runner/flutter_command_runner.dart:281:9)
<asynchronous suspension>
#6 AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:150:19)
<asynchronous suspension>
#7 FlutterCommandRunner.runCommand (package:flutter_tools/src/runner/flutter_command_runner.dart:229:5)
<asynchronous suspension>
#8 run.<anonymous closure>.<anonymous closure> (package:flutter_tools/runner.dart:62:9)
<asynchronous suspension>
#9 AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:150:19)
<asynchronous suspension>
#10 main (package:flutter_tools/executable.dart:94:3)
<asynchronous suspension>
[ +63 ms] ensureAnalyticsSent: 61ms
[ ] Running shutdown hooks
[ ] Shutdown hooks complete
[ ] exiting with code 1
flutter doctor -v
[✓] Flutter (Channel master, 2.6.0-12.0.pre.770, on Arch Linux 5.14.16-arch1-1, locale en_IN.UTF-8)
• Flutter version 2.6.0-12.0.pre.770 at /home/somannak/applications/flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision fb3f123771 (82 minutes ago), 2021-11-19 23:18:08 +0200
• Engine revision a3ef1d5351
• Dart version 2.16.0 (build 2.16.0-20.0.dev)
• DevTools version 2.8.0
[✓] Android toolchain - develop for Android devices (Android SDK version 31)
• Android SDK at /opt/android-sdk
• Platform android-31, build-tools 31
• ANDROID_HOME = /opt/android-sdk
• Java binary at: /usr/bin/java
• Java version OpenJDK Runtime Environment (build 17.0.1+12)
• All Android licenses accepted.
[✓] Chrome - develop for the web
• Chrome at google-chrome
[!] Android Studio (not installed)
• Android Studio not found; download from https://developer.android.com/studio/index.html
(or visit https://flutter.dev/docs/get-started/install/linux#android-setup for detailed instructions).
[✓] Connected device (2 available)
• Android SDK built for x86 (mobile) • emulator-5554 • android-x86 • Android 8.1.0 (API 27) (emulator)
• Chrome (web) • chrome • web-javascript • Google Chrome 94.0.4606.71
! Doctor found issues in 1 category.
contents of pubspec.yaml file
name: anothertry
description: A new Flutter project.
# The following line prevents the package from being accidentally published to
# pub.dev using `flutter pub publish`. This is preferred for private packages.
publish_to: 'none' # Remove this line if you wish to publish to pub.dev
# The following defines the version and build number for your application.
# A version number is three numbers separated by dots, like 1.2.43
# followed by an optional build number separated by a +.
# Both the version and the builder number may be overridden in flutter
# build by specifying --build-name and --build-number, respectively.
# In Android, build-name is used as versionName while build-number used as versionCode.
# Read more about Android versioning at https://developer.android.com/studio/publish/versioning
# In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion.
# Read more about iOS versioning at
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
version: 1.0.0+1
environment:
sdk: ">=2.16.0-20.0.dev <3.0.0"
# Dependencies specify other packages that your package needs in order to work.
# To automatically upgrade your package dependencies to the latest versions
# consider running `flutter pub upgrade --major-versions`. Alternatively,
# dependencies can be manually updated by changing the version numbers below to
# the latest version available on pub.dev. To see which dependencies have newer
# versions available, run `flutter pub outdated`.
dependencies:
flutter:
sdk: flutter
# The following adds the Cupertino Icons font to your application.
# Use with the CupertinoIcons class for iOS style icons.
cupertino_icons: ^1.0.2
dev_dependencies:
flutter_test:
sdk: flutter
# The "flutter_lints" package below contains a set of recommended lints to
# encourage good coding practices. The lint set provided by the package is
# activated in the `analysis_options.yaml` file located at the root of your
# package. See that file for information about deactivating specific lint
# rules and activating additional ones.
flutter_lints: ^1.0.0
# For information on the generic Dart part of this file, see the
# following page: https://dart.dev/tools/pub/pubspec
# The following section is specific to Flutter.
flutter:
# The following line ensures that the Material Icons font is
# included with your application, so that you can use the icons in
# the material Icons class.
uses-material-design: true
# To add assets to your application, add an assets section, like this:
# assets:
# - images/a_dot_burr.jpeg
# - images/a_dot_ham.jpeg
# An image asset can refer to one or more resolution-specific "variants", see
# https://flutter.dev/assets-and-images/#resolution-aware.
# For details regarding adding assets from package dependencies, see
# https://flutter.dev/assets-and-images/#from-packages
# To add custom fonts to your application, add a fonts section here,
# in this "flutter" section. Each entry in this list should have a
# "family" key with the font family name, and a "fonts" key with a
# list giving the asset and other descriptors for the font. For
# example:
# fonts:
# - family: Schyler
# fonts:
# - asset: fonts/Schyler-Regular.ttf
# - asset: fonts/Schyler-Italic.ttf
# style: italic
# - family: Trajan Pro
# fonts:
# - asset: fonts/TrajanPro.ttf
# - asset: fonts/TrajanPro_Bold.ttf
# weight: 700
#
# For details regarding fonts from package dependencies,
# see https://flutter.dev/custom-fonts/#from-packages
the main reason for the error looked like the Java version on the system. Uninstalling everything and installing the SDK and the Java from the Android Studio made it work.
So after uninstalling everything
Install again the whole thing in the following order