1. Anuncie Aqui ! Entre em contato fdantas@4each.com.br

[Flutter] flutter project failed to run after upgrading to the latest android studio IDE...

Discussão em 'Mobile' iniciado por Stack, Novembro 3, 2024 às 13:02.

  1. Stack

    Stack Membro Participativo

    The error occur only with pusher package. I have tried several pusher package but they all seem to have this common error in the my project.

    Below is my app/build.gradle file.

    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"
    }

    android {
    namespace = "com.cartrackernigeria.ctntelematics"
    compileSdk = flutter.compileSdkVersion
    ndkVersion = flutter.ndkVersion

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

    kotlinOptions {
    jvmTarget = JavaVersion.VERSION_1_8
    }

    defaultConfig {
    // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
    applicationId = "com.cartrackernigeria.ctntelematics"
    // You can update the following values to match your application needs.
    // For more information, see: https://flutter.dev/to/review-gradle-config.
    minSdk = 21//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
    proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
    }
    }

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



    Below is setting.gradle file

    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.3.2" apply false
    // id "com.android.application" version "8.1.0" apply false
    id "org.jetbrains.kotlin.android" version "1.8.22" apply false
    }

    include ":app"



    Below is my android/build.gradle

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

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

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



    I get this error below each time when I try to run the flutter project. I have tried everything that I could but I do not understand, while pusher is complaining about namespace. I have tried several pusher package version such as

    • pusher_client
    • pusher_client_fixed
    • pusher_client_x


    FAILURE: Build failed with an exception.

    * What went wrong:
    A problem occurred configuring project ':pusher_client_x'.
    > Could not create an instance of type com.android.build.api.variant.impl.LibraryVariantBuilderImpl.
    > Namespace not specified. Specify a namespace in the module's build file. See https://d.android.com/r/tools/upgrade-assistant/set-namespace for information about setting the namespace.

    If you've specified the package attribute in the source AndroidManifest.xml, you can use the AGP Upgrade Assistant to migrate to the namespace value in the build file. Refer to https://d.android.com/r/tools/upgrade-assistant/agp-upgrade-assistant for general information about using the AGP Upgrade Assistant.

    * 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 3s
    Error: Gradle task assembleDebug failed with exit code 1
    Error executing devicectl: ProcessException: Process exited abnormally with exit code 3:

    User cancelled

    ERROR: Error writing JSON results: The file “core_device_list.json” doesn’t exist. (NSCocoaErrorDomain error 4.)
    NSFilePath = /var/folders/9p/qyg46tks79g_66b7y5bk3f800000gn/T/flutter_tools.Hff1N6/core_devices.dnTZUa/core_device_list.json
    ----------------------------------------
    The operation couldn’t be completed. No such file or directory (NSPOSIXErrorDomain error 2.)
    Command: xcrun devicectl list devices --timeout 5 --json-output /var/folders/9p/qyg46tks79g_66b7y5bk3f800000gn/T/flutter_tools.Hff1N6/core_devices.dnTZUa/core_device_list.json

    Continue reading...

Compartilhe esta Página