Unexpected character: '?' @ line 1, column 1. ?pluginManagement {

52 views Asked by At

After flutter I'm facing this issues how I can resolve this issues.

Launching lib\main.dart on sdk gphone64 x86 64 in debug mode...
Running Gradle task 'assembleDebug'...

FAILURE: Build failed with an exception.

* Where:
Settings file 'E:\Completed\Hiredge\jobkar_pro\android\settings.gradle' line: 1

* What went wrong:
Could not compile settings file 'E:\Completed\Hiredge\jobkar_pro\android\settings.gradle'.
> startup failed:
  settings file 'E:\Completed\Hiredge\jobkar_pro\android\settings.gradle': 1: Unexpected character: '?' @ line 1, column 1.
     ?pluginManagement {
     ^

  1 error


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

**Okay, When i update flutter in latest version 3.19+, it something print on console look likes your previous gradle... deprecated. after that when i update my gradle 8.5 that time this message shows**


**Console Error**
Launching lib\main.dart on sdk gphone64 x86 64 in debug mode...
Running Gradle task 'assembleDebug'...

FAILURE: Build failed with an exception.

* Where:
Settings file 'E:\Completed\Hiredge\jobkar_pro\android\settings.gradle' line: 1

* What went wrong:
Could not compile settings file 'E:\Completed\Hiredge\jobkar_pro\android\settings.gradle'.
> startup failed:
  settings file 'E:\Completed\Hiredge\jobkar_pro\android\settings.gradle': 1: Unexpected character: '?' @ line 1, column 1.
     ?pluginManagement {
     ^

  1 error


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

**-----------------------------------------------------------**
**See why it says settings.gradle in which view code (console error indicated ? in setting.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
    }
    settings.ext.flutterSdkPath = flutterSdkPath()

    includeBuild("${settings.ext.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 "7.3.0" apply false
    id "org.jetbrains.kotlin.android" version "1.7.10" apply false
}

include ":app"

**android/build.gradle codes**

    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
}

**app/build.gradle codes**

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



def keystoreProperties = new Properties()
def keystorePropertiesFile = rootProject.file('key.properties')
if (keystorePropertiesFile.exists()) {
    keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
}


android {
    namespace "com.jobkar.hiredge"
    compileSdk flutter.compileSdkVersion
    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.jobkar.hiredge"
        minSdkVersion 21
        targetSdkVersion flutter.targetSdkVersion
        versionCode flutterVersionCode.toInteger()
        versionName flutterVersionName
    }

    signingConfigs {
        release {
            keyAlias keystoreProperties['keyAlias']
            keyPassword keystoreProperties['keyPassword']
            storeFile keystoreProperties['storeFile'] ? file(keystoreProperties['storeFile']) : null
            storePassword keystoreProperties['storePassword']
        }
    }
    buildTypes {
        release {
            signingConfig signingConfigs.release
        }
    }

}

flutter {
    source '../..'
}

dependencies {}


**gradle.wrapper.properties codes list**

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

There are 1 answers

2
Damian Wardach On

It's obvious that You accidentally placed a question mark ? in the first line of the settings.gradle file.

Go to E:\Completed\Hiredge\jobkar_pro\android\settings.gradle and delete from the first line this -> ?