'.gradle file is not processing properly

  • What went wrong: A problem occurred evaluating project ':app'.

Could not set unknown property 'targetSdk' for DefaultConfig_Decorated{name=main, dimension=null, minSdkVersion=null, targetSdkVersion=DefaultApiVersion{mApiLevel=32, mCodename='null'}, renderscriptTargetApi=null, renderscriptSupportModeEnabled=null, renderscriptSupportModeBlasEnabled=null, renderscriptNdkModeEnabled=null, versionCode=1, versionName=1.0.0, applicationId=com.example.ECommerceApp, testApplicationId=null, testInstrumentationRunner=null, testInstrumentationRunnerArguments={}, testHandleProfiling=null, testFunctionalTest=null, signingConfig=null, resConfig=null, mBuildConfigFields={}, mResValues={}, mProguardFiles=[], mConsumerProguardFiles=[], mManifestPlaceholders={applicationName=android.app.Application}, mWearAppUnbundled=null} of type com.android.build.gradle.internal.dsl.DefaultConfig.

my build.gradle file has the following code

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 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 32

sourceSets {
    main.java.srcDirs += 'src/main/kotlin'
}

lintOptions {
    disable 'InvalidPackage'
}

defaultConfig {
    // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
    applicationId "com.example.ECommerceApp"

// minSdkVersion 19 targetSdkVersion 32 versionCode flutterVersionCode.toInteger() versionName flutterVersionName

    multiDexEnabled true
}

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 { // def multidex_version = "2.0.1" // implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" // implementation platform('com.google.firebase:firebase-bom:28.0.1') //} android { defaultConfig {

// minSdk = 15 targetSdk = 32 multiDexEnabled = true }

}

dependencies {

implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation("androidx.multidex:multidex:2.0.1")
implementation platform('com.google.firebase:firebase-bom:28.0.1')

} //

allprojects { repositories { google() //commit this: maven //maven() // add this mavenCentral() } } apply plugin : 'com.google.gms.google-services' apply plugin : 'com.android.application'

and this file is not buliding properly , also my gc.properties files are empty though i haven't removed the code from there



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source