skip to Main Content

Launching libmain.dart on Android SDK built for x86 in debug mode…

FAILURE: Build failed with an exception.

  • What went wrong:
    Execution failed for task ‘:package_info_plus:compileDebugJavaWithJavac’.

error: invalid source release: 17

  • 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.

BUILD FAILED in 1m 23s
Running Gradle task ‘assembleDebug’… 86.6s
Error: Gradle task assembleDebug failed with exit code 1

I have tried and changed the jdk version but nothing happens

name: grihum
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 is used as CFBundleVersion.
# Read more about iOS versioning at
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
# In Windows, build-name is used as the major, minor, and patch parts
# of the product and file versions while build-number is used as the build suffix.
version: 1.0.0+1

environment:
  sdk: '>=3.2.0 <4.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

  cupertino_icons: ^1.0.2
  get: ^4.6.6
  animated_splash_screen: ^1.3.0
  http: ^1.2.0
  shared_preferences: ^2.2.2
  flutter_secure_storage: ^9.0.0
  image: ^4.1.7
  cached_network_image: ^3.3.1
  path_provider: ^2.1.2
  screenshot: ^2.1.0
  flutter_image: ^4.1.11
  flutter_file_dialog: ^3.0.2
  dio: ^5.4.1
  share_plus: ^8.0.2
  image_picker: ^1.0.7
  file_picker: ^6.2.0
  dotenv: ^4.2.0
  crypto: ^3.0.3
  image_gallery_saver: ^2.0.3
  video_player: ^2.8.3
  chewie: ^1.7.5
  shimmer: ^3.0.0
  permission_handler: ^11.3.0
  connectivity_plus: ^5.0.2
  native_video_player: ^1.3.1
  flutter_pdfview: ^1.3.2
  pdf: ^3.10.8
  get_storage: ^2.1.1
  flutter_launcher_icons: ^0.13.1
  flutter_local_notifications: ^17.0.0
  flutter_dotenv: ^5.1.0
  dotted_border: ^2.1.0
  loading_animation_widget: ^1.2.1
  package_info_plus: ^5.0.1
  
flutter_icons:
  android: "launcher_icon"
  ios: true
  image_path_android: "assets/logo.jpeg"
  image_path_ios: "assets/logo.jpeg"
  remove_alpha_ios: true

dev_dependencies:
  flutter_test:
    sdk: flutter
  flutter_lints: ^3.0.1
  flutter_launcher_icons: ^0.13.1

# 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 packages.
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:     
         - assets/
         - .env

  # 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: Times
      fonts:
        - asset: fonts/times-ro.ttf
        # - asset: fonts/Schyler-Italic.ttf
          # style: Regular
    - family: serif
      fonts:
        - asset: fonts/serif/AbhayaLibre-Bold.ttf
        - asset: fonts/serif/AbhayaLibre-ExtraBold.ttf
  #       - asset: fonts/TrajanPro_Bold.ttf
  #         weight: 700
  #
  # For details regarding fonts from package dependencies,
  # see https://flutter.dev/custom-fonts/#from-packages

plugins {
    id "com.android.application"
    id "kotlin-android"
    id "dev.flutter.flutter-gradle-plugin"
}

def localProperties = new Properties()
def localPropertiesFile = rootProject.file('local.properties')
if (localPropertiesFile.exists()) {
    localPropertiesFile.withReader('UTF-8') { reader ->
        localProperties.load(reader)
    }
}

def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
if (flutterVersionCode == null) {
    flutterVersionCode = '1'
}

def flutterVersionName = localProperties.getProperty('flutter.versionName')
if (flutterVersionName == null) {
    flutterVersionName = '1.0'
}

android {
    namespace "com.example.grihum"
    compileSdkVersion 34
    ndkVersion flutter.ndkVersion
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }

    kotlinOptions {
        jvmTarget = '1.8'
    }

    sourceSets {
        main.java.srcDirs += 'src/main/kotlin'
    }

    defaultConfig {
        applicationId "com.example.grihum"
        minSdkVersion 26
        targetSdkVersion flutter.targetSdkVersion
        versionCode flutterVersionCode.toInteger()
        versionName flutterVersionName
    }

    buildTypes {
        release {
            signingConfig signingConfigs.debug
        }
    }
}

flutter {
    source '../..'
}

dependencies {
}

2

Answers


  1. Hello there are few packages which are incompatible with the latest version of flutter there may be n number of reasons one of the main reason is the packages which you are using are not up to date with the latest flutter version i found the same issue with wake lock plugin in flutter try to use lower version of packages and run this should fix the issues

    Happy coding

    Login or Signup to reply.
  2. try these steps which I already mentioned in another solution : link

    if you have faced error after completing all steps in my solution then please re-mention me.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search