I have created a new flutter app using the following SDK:
Flutter 3.3.10 • channel stable
Dart 2.18.6 • DevTools 2.15.0
My current config:
defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "xxxx"
minSdkVersion 32
targetSdkVersion 32
compileSdkVersion 32
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
}
Everything works fine, but I have now realized that Flutter 3 has a minSdkVersion of 31 or maybe 32. I still want to support older Android phones running Android 11, but the packages I am using are sometimes even complain that the minsdkversion should be 33...
I am not if it's realistic to achieve this kind of backward compatiblity. I might need to:
Carefully specify lower versions of the pub packages that still target a lower sdk version
Dowgrade Flutter 3 to 2 (is this possible? would my code likely still work?)
I was searching the web to find guides that describe some steps to make Flutter apps as backward compatible as possible, but I haven't found anything useful. One stackoverflow anwser mentioned somethign that I should dowgrade my build gradle, but I am not sure how that would work.
Related
i am new to Android development and i want to upgrade my android sdk version from 32.1.0-rc1 to 33.0.0-rc2.
And i have another question what is the difference between compileSdkVersion and targetSdkVersion on the file build.gradle on flutter ?
For update sdk by command LINE, see this gist:
https://gist.github.com/srayhunter/4bce340b62109b5bae43
sdkmanager "build-tools;30.0.2" "platforms;
About the difference ...
The compileSdkVersion is the version of the API the app is compiled against. This means you can use Android API features included in that version of the API.
And the targetSdkVersion indicate that you have tested your app on the version you specify.
I have faced a problem in making an android build was working perfectly since the last 5 months but my Bitrise workflow is failing when I update compileSDKVersion and targetSDKVersion can you please help me are how to solve this issue
Previous
compileSdkVersion : 30
targetSdkVersion : 30
Work perfectly
Currently
compileSdkVersion : 31
targetSdkVersion : 31
Can’t work perfectly
Screen-short
[1]: https://i.stack.imgur.com/80ewD.png
Note:- My project is built in React Native framework, On my local system this project works perfectly and successfully created android build
System Specification:-
OS:- Monterey
RAM:- 16 GB
JDK Version:- 11.0.15
React native version:- 0.65.1
Updating just the SDK versions like that will cause problems because other pieces of React Native might be tied to it. You have to upgrade React Native to the latest version (or whichever version that supports SDK 31).
Undo your changes and upgrade using React Native CLI's upgrade command.
npx react-native upgrade
You can read more about it here.
I have a 2 year old react native project created based on version 61.5 having API level version 28. Now I am trying to upgrade it. I have upgraded the gradle version to latest, react native is also upgraded, solved the issues that came in. My target version change are as follow
buildToolsVersion = "30.0.3"
minSdkVersion = 21
compileSdkVersion = 31
targetSdkVersion = 31
supportLibVersion = "31.0.0"
when I run react-native run-android app builds successfully, installs it in emulator, but I am getting the error as shown in the screenshot, because it doesn't suggest where the error is to be able to figure out the root cause. And if I run "yarn start" the app loads and works properly.
Does anyone have experienced this kind of issue? Can any one please suggest how to get more insight into the error message to find which file is causing it.
Here is a snippet of my build.gradle (Module: app) file:
defaultConfig {
applicationId "com.shikhar_mainalee.iownallbitcoin"
minSdkVersion 14
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
If you have the latest version of Android installed on your computer, the build.gradle file automatically seems to set the targetSdkVersion to the latest for you. Currently, Android version 28 (Android P) is the latest version of Android OS. Right now, the Google Play store requires that your Android version is at least Android version 26 (Android O). When Android version 29 (possibly Android Q) comes out, what will happen? Will the build.gradle plugin automatically update the targetSdkVersion minimum be incremented to 27 (will I need to revisit this application when version 31 is released years from now)? Will the build.gradle plugin automatically change the targetSdkVersion to version 29 or is that something I will need to reconfigure again myself manually?
targetSdkVersion does not automatically update in build.gradle. However when a new version of Android comes out, targetSdkVersion will turn yellow and get flagged with a warning that you are not targeting the latest version of Android. You can then choose to update when you're ready. You will never be forced to update, except when Google Play increases the minimum targetSdkVersion, which is currently 26. When this happens, you won't be able to publish new updates on Google Play until you bump targetSdkVersion to be high enough. But your existing app will not be removed from the store.
Everyone!!
I try to launch my first program in Android Studio. I have got error, something like this:
Failed to refresh Gradle project 'Hello World'
Cause: failed to find Build Tools revision 16.0.2
Please install the missing Build Tools from the Android SDK Manager.
Open Android SDK Manager
I installed Android SDK :
Honestly i don't see in my installations Android SDK Build-tools revision 16.0.2
I have googled to download this revision, but i couldn't find any refs... ??
Can you help me with this problem?
Looks like you have a very old version of Android Studio. Have a look at the android section in the build.gradle file in your project. Your screenshot shows that you have build-tools 19.0.3 installed, so change the appropriate line to
buildToolsVersion "19.0.3"
And update your Android Studio so it won't produce outdated build.gradle files in the first place!
Find the root build.gradle file. It will look something like this:
android {
compileSdkVersion 19
buildToolsVersion "19.0.3"
defaultConfig {
minSdkVersion 15
targetSdkVersion 19
versionCode 4
versionName "0.9.4"
}
buildTypes {
release {
runProguard false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
}
Change the buildToolsVersion to 19.0.3 and be sure you installed this build tools version. The latest version of Android Studio should give a notification if you use an outdated version of buldToolsVersion.
Small side note: Please be aware that Android Studio is still in beta. Not everything works perfectly at the moment. Nevertheless, I think it works already a lot better than Eclipse.