bumping the compileSdkVersion - flutter

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
}

Related

Where is flutter.compileSdkVersion?

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.

error while installing google maps package

i tried to install google maps package but it doesn't work when i run the app
here is the pubspec.yamlenter image description here
and the error is :
enter image description here
i already tried aloder versions like google-maps:1-0-0 but it doesn't work and also updating the sdk will effect all the project
The minimum sdk must be greater that 20 for the plugin to use.
Go to android -> app -> build.grade and update the values as following
compileSdkVersion 31
minSdkVersion 21
targetSdkVersion 31
stop the emulator and run the app again

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'

Build APK stuck at Task :app:checkReleaseAarMetadata

i am new in flutter.
When i run:
flutter apk build -v
it always stuck at
[+29946 ms] > Task :app:checkReleaseAarMetadata
I left it for almost an hour and nothing,
same happen when i run it on release or debug on my own device via usb debugging, but run perfectly on emulator on debug mode
any help would be appreciated, thanks
add the following line to android/build.gradle.try it and update is it fixed!
buildscript {
ext {
androidXCore = "1.7.0" // <-- Add this line
buildToolsVersion = "29.0.3"
minSdkVersion = 21
compileSdkVersion = 30
targetSdkVersion = 29
ndkVersion = "20.1.5948944"
}
Thanks, I found the solution.
In the end tried to clean install Android Studio including sdk, gradle, etc by deleting android studio related stuff on %APPDATA%, %USERPROFILE%, %LOCALAPPDATA%.
After that i build the apk again from vscode console and it work.
I think the error occurred because of missing stuff in gradle or error during sdk installation.

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
}