Home > Enterprise >  I need to higher the android compileSdk but there is nothing to edit in the build.gradle file , I tr
I need to higher the android compileSdk but there is nothing to edit in the build.gradle file , I tr

Time:08-17

Here is the error that asks to update the compileSdk, I tried to add it but it does not work

error : 
Warning: The plugin geolocator_android requires Android SDK version 33.
For more information about build configuration, see https://docs.flutter.dev/deployment/android#reviewing-the-build-configuration.
One or more plugins require a higher Android SDK version.
Fix this issue by adding the following to C:\Users\msi\StudioProjects\Clima-Flutter\android\app\build.gradle:
android {
  compileSdkVersion 33
  ...
}

Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/repository2/02 to old ns http://schemas.android.com/sdk/android/repo/repository2/01

Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/sys-img2/02 to old ns http://schemas.android.com/sdk/android/repo/sys-img2/01
Warning: unexpected element (uri:"", local:"extension-level"). Expected elements are <{}codename>,<{}layoutlib>,<{}api-level>
Warning: unexpected element (uri:"", local:"base-extension"). Expected elements are <{}codename>,<{}layoutlib>,<{}api-level>

and here is how build.gradle looks like

buildscript {
    repositories {
        google()
        jcenter()
    }

    dependencies {
        classpath 'com.android.tools.build:gradle:3.5.3'
        classpath 'com.google.gms:google-services:4.2.0'
    }

}

allprojects {
    repositories {
        google()
        jcenter()
    }
}


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

task clean(type: Delete) {
    delete rootProject.buildDir
}

enter image description here

CodePudding user response:

You are looking in the wrong folder android/build.gradle. You need to go inside android/app/build.gradle.

android {
compileSdkVersion 32

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

We have two build.gradle files top-level(inside android folder) and module-level(inside android/app folder).

CodePudding user response:

The build.gradle (Project: Clima-Flutter) file is in the root folder of the project and its configuration settings apply to every module in the project. A module is an isolated piece of the bigger project. In a multi-module project, these modules have their own jobs but work together to form the whole project. Most Android projects only have one module, the app module.

The build.gradle (Module: app) file here is in the app folder. Its build settings apply only to the app module.

Go to your build.gradle here : C:\Users\msi\StudioProjects\Clima-Flutter\android\app\build.gradle

and change compileSdkVersion under android :

android {
    compileSdkVersion 33
    ...
}
  • Related