Where is flutter.compileSdkVersion? - flutter

While building flutter app, I am getting this error.
One or more plugins require a higher Android SDK version.
Fix this issue by adding the following to C:\flutter\projects\my_app\android\app\build.gradle:
android {
compileSdkVersion 33
...
}
However, in my build.gradle I have :
android {
compileSdkVersion flutter.compileSdkVersion
...
}
But I am unable to find the location where flutter.compileSdkVersion is defined. Any idea where is this defined? I have already run flutter upgrade and flutter --version returns Flutter 3.0.5.

To strictly answer your question, the setting comes from the flutter installation directory here:
<flutter-installation>\packages\flutter_tools\gradle\flutter.gradle
Some options to change the setting:
If you want to have the settings gathered in one place, then you could set it in the file local.properties as:
flutter.compileSdkVersion=33
And you change in your build.gradle in the following way:
android {
compileSdkVersion localProperties.getProperty('flutter.compileSdkVersion').toInteger()
...
}
or (obviously) just set the version direct as:
android {
compileSdkVersion 33
...
}

Every flutter version has a compiledSdkVersion property along with others. As of Flutter 3.3.8, it is 31.
You can access the code here
https://chromium.googlesource.com/external/github.com/flutter/flutter/+/refs/heads/dev/packages/flutter_tools/gradle/flutter.gradle#33
In future it might be more than 33. In case you hardcode value as 33, flutter might stop building with errors.
So the solution should be
compileSdkVersion Math.max(flutter.compileSdkVersion, 33)
now, in future if flutter changes the property to say 35, your code won't break.

Open the android folder.
open the App folder.
open the build.gradle from app folder.

flutter.compileSdkVersion is the default version that defaults to installed flutter version configs.
You can replace flutter.compileSdkVersion to your own custom version.

yes, and there you need to change it.
replace:
android {
compileSdkVersion flutter.compileSdkVersion
...
}
with this:
android {
compileSdkVersion 33
...
}
flutter.compileSdkVersion just the default one got from the flutter sdk.

Related

bumping the compileSdkVersion

enter image description here
Just running my program
I want my program to run normally
follow the path which is mentioned and change the settings as follows
android {
compileSdkVersion 33
}

How to find what Flutter packages requre SDK version #33?

When trying to deploy my Flutter app, I'm getting an error that says that the deployment requires SDK version #33.
How can I find what packages in the app require SDK #33?
R
unning Gradle task 'assembleDebug'...
Warning: The plugin url_launcher_android requires Android SDK version 33.
For more information about build configuration, see https://docs.flutter.dev/deployment/android#reviewing-the-gradle-build-configuration.
One or more plugins require a higher Android SDK version.
Fix this issue by adding the following to D:\Ian\Documents\github\good_day\android\app\build.gradle:
android {
compileSdkVersion 33
...
}
android>app>build.gradle
compileSdkVersion 33
targetSdkVersion 33

The plugin flutter_inappwebview requires Android SDK version 33

I am using flutter_inappwebview and youtube_player_flutter also in my flutter app.
flutter_inappwebview - 5.4.3+7 and youtube_player_flutter - 8.1.1.
While run the app I am getting like "The plugin flutter_inappwebview requires Android SDK version 33". But after changing the version, Then also its now workin.
I tried changing the version also. It's not working.
I think that try to change the android\app\build.gradle file's:android { compileSdkVersion 33 } and also check that the minSdkVersion, I am not sure about this.

One or more plugins require a higher Android SDK version error occurs when i run the project

One or more plugins require a higher Android SDK version.
Fix this issue by adding the following to C:\Users\Najeeb Khan\Desktop\codecanyon-30196044-single-market-groceryfoodpharmacy-androidiosadmin-panel-full-app-solution-with-web-site\Market_v2.1.2\customerApp\android\app\build.gradle:
android {
compileSdkVersion 31
...
}
It clearly says that the third-party plugin used in your project (pubspec. yaml) works only on complileSdkVersion 31. Go to your android/app/build. Gradle and change it to compileSdkVersion to 31 or 32. It will work.
Change compileSdkVersion to 32 if it is 31 in
android\app\build.gradle
The error I got was like this:
One or more plugins require a higher Android SDK version. Fix this
issue by adding the following to
C:\xxx\xxx\project_name\android\app\build.gradle:
android {
compileSdkVersion 33
...
}
In C:\xxx\xxx\project_name\android\app\build.gradle
android {
compileSdkVersion 33// flutter.compileSdkVersion
...
}
Comment out the old code and type 33
implementation 'com.google.android.material:material:33'

Version Code Error while Uploading Flutter Apk to Play Store

Play console is giving error "Use different Version Code".
I have tried everything. Changing the version code in the pubspec.yaml to 2.0.1+2. And then running pub get
Changing the version code in the local.properties file.
Flutter Clean and then build the release. Even then Play Console is giving error.
I Was also facing the same problem, and later got to know that my version code was defined statically in my build.gradle file.
Go To Android -> App -> build.gradle file
And To Change it from there Please check your build.gradle file, is the version Code coming from flutterVersionCode or is it defined statically?
defaultConfig {
//...
versionCode flutterVersionCode.toInteger() //See this line, is it same as mine or you have any static version Code set there which is causing the issue.
versionName flutterVersionName
}