Home > OS >  kotlin-reflect-1.6.10.pom:2:1: Content is not allowed in prolog
kotlin-reflect-1.6.10.pom:2:1: Content is not allowed in prolog

Time:07-13

VS code As I am new in Flutter Dart ,When I am trying to build demo flutter app in my Android Phone in Android Studio OR VS code I keep getting this error,

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:compileDebugKotlin'.
> Could not resolve all files for configuration ':app:kotlinCompilerClasspath'.
   > Could not resolve org.jetbrains.kotlin:kotlin-script-runtime:1.6.10.
     Required by:
         project :app > org.jetbrains.kotlin:kotlin-compiler-embeddable:1.6.10
      > Could not resolve org.jetbrains.kotlin:kotlin-script-runtime:1.6.10.
         > Could not parse POM https://repo.maven.apache.org/maven2/org/jetbrains/kotlin/kotlin-script-runtime/1.6.10/kotlin-script-runtime-1.6.10.pom
            > Content is not allowed in prolog.
   > Could not resolve org.jetbrains.kotlin:kotlin-reflect:1.6.10.
     Required by:
         project :app > org.jetbrains.kotlin:kotlin-compiler-embeddable:1.6.10
      > Could not resolve org.jetbrains.kotlin:kotlin-reflect:1.6.10.
         > Could not parse POM https://repo.maven.apache.org/maven2/org/jetbrains/kotlin/kotlin-reflect/1.6.10/kotlin-reflect-1.6.10.pom
            > Content is not allowed in prolog.

As you see My Flutter Doctor is fine 1

gradle.build(app): Below I attached my build.gradle(app),Anyone can help as I say I am new to flutter not know what is Flutter.Thank You in advance

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 from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"

android {
    compileSdkVersion flutter.compileSdkVersion

    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.example.flutter_application_1"
        minSdkVersion flutter.minSdkVersion
        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"
}

CodePudding user response:

Change your kotlin version according you installed and set the gradle plugin match.

  • Related