Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Compile]: Execution failed for task ':connectivity_plus:compileDebugJavaWithJavac'. #3373

Open
8 tasks done
YawarOsman opened this issue Nov 27, 2024 · 7 comments
Open
8 tasks done
Labels
compile Compilation error triage

Comments

@YawarOsman
Copy link

YawarOsman commented Nov 27, 2024

Operating System

Android

Plugin

connectivity_plus

Version

6.1.0

Flutter SDK

3.24.5

Compilation command

flutter run

Dart Dependencies

name: id_app
description: "A unique ID for all your needs"
publish_to: 'none' # Remove this line if you wish to publish to pub.dev

version: 1.0.0+1

environment:
  sdk: '>=3.4.4 <4.0.0'

dependencies:
  flutter:
    sdk: flutter
  flutter_localizations:
    sdk: flutter


  cupertino_icons: any
  go_router: any
  intl: any
  logger: any
  flutter_secure_storage: any
  dio: any
  cached_network_image: any
  google_fonts: any
  shared_preferences: any
  permission_handler: any
  json_annotation: ^4.9.0
  freezed_annotation: any
  freezed: any
  flutter_svg: any
  firebase_core: any
  firebase_messaging: any
  firebase_analytics: ^11.3.4
  firebase_crashlytics: any
  firebase_performance: any
  path_provider: any
  get_it: any
  # url_launcher: any
  # uni_links: any
  flutter_bloc: any
  bloc: any
  package_info_plus: ^8.1.1
  device_info_plus: any
  connectivity_plus: ^6.1.0
  flutter_native_splash: any
  pinput: any
  image_picker: any
  syncfusion_flutter_datepicker: ^27.1.53
  flutter_dotenv: ^5.2.1
  phone_numbers_parser: ^9.0.1
  flutter_contacts: any
  lottie: ^3.1.3




dev_dependencies:
  flutter_test:
    sdk: flutter


  flutter_lints: any
  build_runner: any
  json_serializable: any


flutter:

  uses-material-design: true
  generate: true

  # To add assets to your application, add an assets section, like this:
  assets:
    - assets/
    - assets/images/
    - assets/svg/
    - assets/animations/
    - assets/svg/illustrations/
    - assets/animations/lottie/
    - assets/animations/lottie/loading/
    - .env

Native dependencies

java --version:

openjdk version "17.0.10" 2024-01-16
OpenJDK Runtime Environment Temurin-17.0.10+7 (build 17.0.10+7)
OpenJDK 64-Bit Server VM Temurin-17.0.10+7 (build 17.0.10+7, mixed mode)

Compilation Error

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':connectivity_plus:compileDebugJavaWithJavac'.
> Could not resolve all files for configuration ':connectivity_plus:androidJdkImage'.
   > Failed to transform core-for-system-modules.jar to match attributes {artifactType=_internal_android_jdk_image, org.gradle.libraryelements=jar, org.gradle.usage=java-runtime}.
      > Execution failed for JdkImageTransform: /Users/yara/Library/Android/sdk/platforms/android-34/core-for-system-modules.jar.
         > Error while executing process /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/jlink with arguments {--module-path /Users/yara/.gradle/caches/transforms-3/415f75d5af352efb92f325a6641688f2/transformed/output/temp/jmod --add-modules java.base --output /Users/yara/.gradle/caches/transforms-3/415f75d5af352efb92f325a6641688f2/transformed/output/jdkImage --disable-plugin system-modules}

* 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 1m 1s
Error: Gradle task assembleDebug failed with exit code 1

Flutter Doctor

Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 3.24.5, on macOS 15.1.1 24B91 darwin-x64, locale en-IQ)
[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
[✓] Xcode - develop for iOS and macOS (Xcode 16.1)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2024.2)
[✓] VS Code (version 1.94.2)
[✓] Connected device (4 available)
[✓] Network resources

• No issues found!

Checklist before submitting a bug

  • I searched issues in this repository and couldn't find such bug/problem
  • I Google'd a solution and I couldn't find it
  • I searched on StackOverflow for a solution and I couldn't find it
  • I read the README.md file of the plugin
  • I'm using the latest version of the plugin
  • All dependencies are up to date with flutter pub upgrade
  • I did a flutter clean
  • I tried running the example project
@YawarOsman YawarOsman added compile Compilation error triage labels Nov 27, 2024
@miquelbeltran
Copy link
Member

There is a pinned issue with a fix: #3303 have you tried that?

@YawarOsman
Copy link
Author

YawarOsman commented Nov 28, 2024

Yes i have tried that, too but the result haven't changed, And then i have updated the gradle version to '8.9' and gradle plugin to 8.7.3 and now shows this error:

warning: [options] source value 8 is obsolete and will be removed in a future release
warning: [options] target value 8 is obsolete and will be removed in a future release
warning: [options] To suppress warnings about obsolete options, use -Xlint:-options.
3 warnings
warning: [options] source value 8 is obsolete and will be removed in a future release
warning: [options] target value 8 is obsolete and will be removed in a future release
warning: [options] To suppress warnings about obsolete options, use -Xlint:-options.
3 warnings
warning: [options] source value 8 is obsolete and will be removed in a future release
warning: [options] target value 8 is obsolete and will be removed in a future release
warning: [options] To suppress warnings about obsolete options, use -Xlint:-options.
3 warnings
warning: [options] source value 8 is obsolete and will be removed in a future release
warning: [options] target value 8 is obsolete and will be removed in a future release
warning: [options] To suppress warnings about obsolete options, use -Xlint:-options.
3 warnings
warning: [options] source value 8 is obsolete and will be removed in a future release
warning: [options] target value 8 is obsolete and will be removed in a future release
warning: [options] To suppress warnings about obsolete options, use -Xlint:-options.
3 warnings
warning: [options] source value 8 is obsolete and will be removed in a future release
warning: [options] target value 8 is obsolete and will be removed in a future release
warning: [options] To suppress warnings about obsolete options, use -Xlint:-options.
3 warnings
warning: [options] source value 8 is obsolete and will be removed in a future release
warning: [options] target value 8 is obsolete and will be removed in a future release
warning: [options] To suppress warnings about obsolete options, use -Xlint:-options.
3 warnings
warning: [options] source value 8 is obsolete and will be removed in a future release
warning: [options] target value 8 is obsolete and will be removed in a future release
warning: [options] To suppress warnings about obsolete options, use -Xlint:-options.
3 warnings
Error: Gradle build failed to produce an .apk file. It's likely that this file was generated under /Users/**/Documents/mine/**/**/id_app/build, but the tool couldn't find it.

And for sure i id flutter clean, but there is a catch, when i try to run the app on 'Android Studio' it works perfectly, but on VS code shows that error above.

Here are the regarding gradle files:

android/build.gradle:

allprojects {
    repositories {
        google()
        mavenCentral()
    }
}


rootProject.layout.buildDirectory = "../build"
subprojects {
    project.layout.buildDirectory = "${rootProject.layout.buildDirectory}/${project.name}"
}
subprojects {
    project.evaluationDependsOn(":app")
}

tasks.register("clean", Delete) {
    delete rootProject.layout.buildDirectory
}

'android/app/build.gradle:`

plugins {
    id "com.android.application"
    id "kotlin-android"
    // The Flutter Gradle Plugin must be applied after the Android and Kotlin Gradle plugins.
    id "dev.flutter.flutter-gradle-plugin"
    id "com.google.gms.google-services"
    id 'com.google.firebase.firebase-perf'
    id 'com.google.firebase.crashlytics'

}

android {
    namespace = "com.**.**_id"
    compileSdk 34
    ndkVersion = "27.0.12077973"


    compileOptions {
        sourceCompatibility = JavaVersion.VERSION_17
        targetCompatibility = JavaVersion.VERSION_17
    }

    kotlinOptions {
        jvmTarget = JavaVersion.VERSION_17
    }

    defaultConfig {
        applicationId = "com.**.**_id"
        // You can update the following values to match your application needs.
        // For more information, see: https://flutter.dev/to/review-gradle-config.
        minSdk = flutter.minSdkVersion
        targetSdk = flutter.targetSdkVersion
        versionCode = flutter.versionCode
        versionName = flutter.versionName
    }

    buildTypes {
        release {
            // TODO: Add your own signing config for the release build.
            // Signing with the debug keys for now, so `flutter run --release` works.
            signingConfig = signingConfigs.debug
        }
    }
}

flutter {
    source = "../.."
}

settings.gradle::

pluginManagement {
    def flutterSdkPath = {
        def properties = new Properties()
        file("local.properties").withInputStream { properties.load(it) }
        def flutterSdkPath = properties.getProperty("flutter.sdk")
        assert flutterSdkPath != null, "flutter.sdk not set in local.properties"
        return flutterSdkPath
    }()

    includeBuild("$flutterSdkPath/packages/flutter_tools/gradle")

    repositories {
        google()
        mavenCentral()
        gradlePluginPortal()
    }
}

plugins {
    id "dev.flutter.flutter-plugin-loader" version "1.0.0"
    id "com.android.application" version '8.7.2' apply false
    id "org.jetbrains.kotlin.android" version "1.9.24" apply false
    id "com.google.gms.google-services" version "4.4.2" apply false
    id "com.google.firebase.firebase-perf" version "1.4.2" apply false
    id "com.google.firebase.crashlytics" version "3.0.2" apply false

}

include ":app"

gradle-wrapper.properties:

distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.9-all.zip

@vbuberen
Copy link
Collaborator

> warning: [options] source value 8 is obsolete and will be removed in a future release
warning: [options] target value 8 is obsolete and will be removed in a future release
warning: [options] To suppress warnings about obsolete options, use -Xlint:-options.
3 warnings
warning: [options] source value 8 is obsolete and will be removed in a future release
warning: [options] target value 8 is obsolete and will be removed in a future release
warning: [options] To suppress warnings about obsolete options, use -Xlint:-options.
3 warnings

This has nothing to do with the connectivity_plus plugin.

Do you specify compatibility compileOptions in your build.gradle file as it is mentioned in #3303?

@YawarOsman
Copy link
Author

Yes for sure i have specified that as it shows in the previous comment

@sachin96Boy
Copy link

Yes, I'm having the same issue on my project.

@miquelbeltran
Copy link
Member

There is a ticket on flutter/flutter for this issue as well: flutter/flutter#156111

You can check their replies for possible solutions.

@sachin96Boy
Copy link

sachin96Boy commented Nov 30, 2024

Yes i have tried that, too but the result haven't changed, And then i have updated the gradle version to '8.9' and gradle plugin to 8.7.3 and now shows this error:

warning: [options] source value 8 is obsolete and will be removed in a future release
warning: [options] target value 8 is obsolete and will be removed in a future release
warning: [options] To suppress warnings about obsolete options, use -Xlint:-options.
3 warnings
warning: [options] source value 8 is obsolete and will be removed in a future release
warning: [options] target value 8 is obsolete and will be removed in a future release
warning: [options] To suppress warnings about obsolete options, use -Xlint:-options.
3 warnings
warning: [options] source value 8 is obsolete and will be removed in a future release
warning: [options] target value 8 is obsolete and will be removed in a future release
warning: [options] To suppress warnings about obsolete options, use -Xlint:-options.
3 warnings
warning: [options] source value 8 is obsolete and will be removed in a future release
warning: [options] target value 8 is obsolete and will be removed in a future release
warning: [options] To suppress warnings about obsolete options, use -Xlint:-options.
3 warnings
warning: [options] source value 8 is obsolete and will be removed in a future release
warning: [options] target value 8 is obsolete and will be removed in a future release
warning: [options] To suppress warnings about obsolete options, use -Xlint:-options.
3 warnings
warning: [options] source value 8 is obsolete and will be removed in a future release
warning: [options] target value 8 is obsolete and will be removed in a future release
warning: [options] To suppress warnings about obsolete options, use -Xlint:-options.
3 warnings
warning: [options] source value 8 is obsolete and will be removed in a future release
warning: [options] target value 8 is obsolete and will be removed in a future release
warning: [options] To suppress warnings about obsolete options, use -Xlint:-options.
3 warnings
warning: [options] source value 8 is obsolete and will be removed in a future release
warning: [options] target value 8 is obsolete and will be removed in a future release
warning: [options] To suppress warnings about obsolete options, use -Xlint:-options.
3 warnings
Error: Gradle build failed to produce an .apk file. It's likely that this file was generated under /Users/**/Documents/mine/**/**/id_app/build, but the tool couldn't find it.

And for sure i id flutter clean, but there is a catch, when i try to run the app on 'Android Studio' it works perfectly, but on VS code shows that error above.

Here are the regarding gradle files:

android/build.gradle:

allprojects {
    repositories {
        google()
        mavenCentral()
    }
}


rootProject.layout.buildDirectory = "../build"
subprojects {
    project.layout.buildDirectory = "${rootProject.layout.buildDirectory}/${project.name}"
}
subprojects {
    project.evaluationDependsOn(":app")
}

tasks.register("clean", Delete) {
    delete rootProject.layout.buildDirectory
}

'android/app/build.gradle:`

plugins {
    id "com.android.application"
    id "kotlin-android"
    // The Flutter Gradle Plugin must be applied after the Android and Kotlin Gradle plugins.
    id "dev.flutter.flutter-gradle-plugin"
    id "com.google.gms.google-services"
    id 'com.google.firebase.firebase-perf'
    id 'com.google.firebase.crashlytics'

}

android {
    namespace = "com.**.**_id"
    compileSdk 34
    ndkVersion = "27.0.12077973"


    compileOptions {
        sourceCompatibility = JavaVersion.VERSION_17
        targetCompatibility = JavaVersion.VERSION_17
    }

    kotlinOptions {
        jvmTarget = JavaVersion.VERSION_17
    }

    defaultConfig {
        applicationId = "com.**.**_id"
        // You can update the following values to match your application needs.
        // For more information, see: https://flutter.dev/to/review-gradle-config.
        minSdk = flutter.minSdkVersion
        targetSdk = flutter.targetSdkVersion
        versionCode = flutter.versionCode
        versionName = flutter.versionName
    }

    buildTypes {
        release {
            // TODO: Add your own signing config for the release build.
            // Signing with the debug keys for now, so `flutter run --release` works.
            signingConfig = signingConfigs.debug
        }
    }
}

flutter {
    source = "../.."
}

settings.gradle::

pluginManagement {
    def flutterSdkPath = {
        def properties = new Properties()
        file("local.properties").withInputStream { properties.load(it) }
        def flutterSdkPath = properties.getProperty("flutter.sdk")
        assert flutterSdkPath != null, "flutter.sdk not set in local.properties"
        return flutterSdkPath
    }()

    includeBuild("$flutterSdkPath/packages/flutter_tools/gradle")

    repositories {
        google()
        mavenCentral()
        gradlePluginPortal()
    }
}

plugins {
    id "dev.flutter.flutter-plugin-loader" version "1.0.0"
    id "com.android.application" version '8.7.2' apply false
    id "org.jetbrains.kotlin.android" version "1.9.24" apply false
    id "com.google.gms.google-services" version "4.4.2" apply false
    id "com.google.firebase.firebase-perf" version "1.4.2" apply false
    id "com.google.firebase.crashlytics" version "3.0.2" apply false

}

include ":app"

gradle-wrapper.properties:

distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.9-all.zip

Try changing gradle wrapper version to 8.5,
distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-all.zip

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
compile Compilation error triage
Projects
None yet
Development

No branches or pull requests

4 participants