skip to Main Content

I am getting this error un multiples projects, looks like gradle or a service is down i dont kwon what is happening, it could be a new update in the gradle or the android sdk if someone can tell me how to run properly i will appreciate

my flutter version is

Flutter 3.10.6 • channel stable • https://github.com/flutter/flutter.git
Framework • revision f468f3366c (11 days ago) • 2023-07-12 15:19:05 -0700
Engine • revision cdbeda788a
Tools • Dart 3.0.6 • DevTools 2.23.1
dependencies:
  flutter:
    sdk: flutter
  cupertino_icons: ^1.0.5
  firebase_core: ^2.1.1
  cloud_firestore: ^4.0.3
  firebase_auth: ^4.1.0
  provider: ^6.0.4
  flutter_secure_storage: ^8.0.0
  dio: ^5.3.0
  dartz: ^0.10.1
  
dev_dependencies:
  flutter_test:
    sdk: flutter
  flutter_lints: ^2.0.1

this is the error when running debug mode in vscode

FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring root project 'android'.
> Could not resolve all files for configuration ':classpath'.
   > Could not resolve com.sun.xml.fastinfoset:FastInfoset:1.2.16.
     Required by:
         project : > com.android.tools.build:gradle:7.1.2 > org.glassfish.jaxb:jaxb-runtime:2.3.2
      > Could not resolve com.sun.xml.fastinfoset:FastInfoset:1.2.16.
         > Could not parse POM https://repo.maven.apache.org/maven2/com/sun/xml/fastinfoset/FastInfoset/1.2.16/FastInfoset-1.2.16.pom
            > Could not find fastinfosat-project-1.2.16.pom (com.sun.xml.fastinfoset:fastinfosat-project:1.2.16).
              Searched in the following locations:
                  https://repo.maven.apache.org/maven2/com/sun/xml/fastinfoset/fastinfosat-project/1.2.16/fastinfosat-project-1.2.16.pom

this is my settings.gradle file

include ':app'

def localPropertiesFile = new File(rootProject.projectDir, "local.properties")
def properties = new Properties()

assert localPropertiesFile.exists()
localPropertiesFile.withReader("UTF-8") { reader -> properties.load(reader) }

def flutterSdkPath = properties.getProperty("flutter.sdk")
assert flutterSdkPath != null, "flutter.sdk not set in local.properties"
apply from: "$flutterSdkPath/packages/flutter_tools/gradle/app_plugin_loader.gradle"

this is my build.gradle in android folder

buildscript {
    ext.kotlin_version = '1.9.0'
    repositories {
        google()
        mavenCentral()
    }

    dependencies {
        classpath 'com.android.tools.build:gradle:7.1.2'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
        classpath 'com.google.gms:google-services:4.3.13'
    }
}

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
}

this is my adroind/app/build.gradle file

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

def flutterRoot = localProperties.getProperty('flutter.sdk')
if (flutterRoot == null) {
    throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
}

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

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

apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'com.google.gms.google-services'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"

android {
    compileSdkVersion 33
    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 {
        // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
        applicationId "com.diferenteweb.spotcafe"
        // You can update the following values to match your application needs.
        // For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-build-configuration.
        minSdkVersion 24
        targetSdkVersion flutter.targetSdkVersion
        versionCode flutterVersionCode.toInteger()
        versionName flutterVersionName
    }

    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 '../..'
}

dependencies {
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
    implementation platform('com.google.firebase:firebase-bom:31.0.2')
    implementation 'com.google.firebase:firebase-analytics-ktx'
}

2

Answers


  1. The dependency com.sun.xml.fastinfoset:FastInfoset:1.2.16 wasn’t found on maven, hence your gradle sync failed.

    I can see the POM file at https://repo.maven.apache.org/maven2/com/sun/xml/fastinfoset/fastinfoset-project/1.2.16/fastinfoset-project-1.2.16.pom.

    https://repo.maven.apache.org/maven2/com/sun/xml/fastinfoset/fastinfosat-project/1.2.16/fastinfosat-project-1.2.16.pom
    

    This line has a typo in the name in your error log.

    I’m not exactly sure what plugin might be using this, can you try updating the classpath 'com.android.tools.build:gradle:7.1.2' to classpath 'com.android.tools.build:gradle:7.2.0'?

    Login or Signup to reply.
  2. Ensure that your physical device is connected properly to your development machine via a USB cable.
    Enable Developer Mode on your device. For Android, go to Settings > About phone > Tap on the Build number multiple times to enable Developer options. For iOS, connect your device to your Mac, open Xcode, and follow the prompts to enable Developer Mode.
    Make sure you have the necessary USB driver installed for your Android device.
    Run flutter devices in the terminal to check if your device is detected. If it’s not listed, try restarting the Flutter daemon by running flutter doctor or flutter pub global run flutter_plugin_tools devices.
    Read More

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