I just started seeing the following warning when building my Flutter project:
Warning: The plugin permission_handler_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\roger\Source\choon\player\android\app\build.gradle:
android {
compileSdkVersion 33
...
}
My build.gradle contains the following:
android {
compileSdkVersion flutter.compileSdkVersion
...
What caused this, and how can I fix it?
This was caused by a recent change to the permission_handler plugin; see the Changelog:
BREAKING CHANGE: Updated Android compileSdkVersion to 33 to handle the new POST_NOTIFICATIONS permission.
The official Build Numbers only go up to API Level 32 (Android 12L), but apilevels.com shows that API Level 33 is Android 13 Beta.
You have two options:
Change compileSdkVersion flutter.compileSdkVersion to compileSdkVersion 33, which targets Android SDK 33. You can also do this by writing flutter.compileSdkVersion = 33 after the existing apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" line. At the time of this answer (Flutter 3.0.2), flutter.compileSdkVersion is 31.
Roll back to permission_handler 9.x, by editing pubspec.yaml as follows:
dependencies:
...
permission_handler: ^9.2.0
...
Related
Is it possible to configure a Flutter app with a minimum Android SDK Version such that pub wont try and install dependency that require a higher android sdk version?
I've cloned a few repositories such as https://github.com/stonega/tsacdop and https://github.com/Teifun2/nextcloud-cookbook-flutter.
These have dependencies in pubspec.yaml like
dependencies:
flutter:
sdk: flutter
#for app key
url_launcher: ^6.0.3
When I execute flutter run I end up with error messages like:
Warning: The plugin path_provider_android requires Android SDK version 31.
Warning: The plugin url_launcher_android requires Android SDK version 31.
One or more plugins require a higher Android SDK version.
Fix this issue by adding the following to /projects/sandbox/tsacdop/android/app/build.gradle:
android {
compileSdkVersion 31
...
}
In my case I want to use the app on Android 11 (SDK Version 30), so updating the minimum version isn't the solution I'm looking for. Though I did follow How to change Android minSdkVersion in flutter project, but configuring android/app/src/build.gradle as suggested did not work:
defaultConfig {
// setting these did NOT fix the compile errors
minSdkVersion flutter.minSdkVersion
targetSdkVersion flutter.targetSdkVersion
}
I've tried setting dependency to an explicit version in the pubspec.yaml file, which fixes some of the dependencies as a one-off, but it would be nice to find a universal solution.
Just assign your required SDK versions Like below. this will solve your compile error.
defaultConfig {
minSdkVersion 31
targetSdkVersion 31
}
or you can change flutter.minSdkVersion and flutter.targetSdkVersion directly from flutter>packages>Flutter_tools>gradle>flutter.gradle
https://stackoverflow.com/a/71440248/10936691
this is my build.gradle setting and this is my system info
I'm trying to run the react native app on android 11 but it is keep crashing on launch without giving any error I have tries almost every solution including setting in build.gradle
buildToolsVersion = "30.0.0"
minSdkVersion = 21
compileSdkVersion = 30
targetSdkVersion = 30
supportLibVersion = "30.0.0"
ndkVersion = "20.1.5948944"
multiDexEnabled = true
setting ** target API to"30" ** in AndroidManifest.xml
the Gradle version I'm using is
Gradle plugin version is 4.1.3
Gradle version is 6.7**
please help me find the solution in this regard thanks
I got an error like this when setting targetSdk version to 30 it's happening because of okhttp version and fixed it by using the latest version
implementation("com.squareup.okhttp3:okhttp:4.9.1")
implementation("com.squareup.okhttp3:okhttp-urlconnection:4.9.1")
add this in your android/app/build.gradle
This answer has been provided by manohar-octifi (github discussion):
If you are using #sentry/react-native and the version is lower than 2.0.0, then update the version to 2.0.0 or higher (I updated to 2.2.0). This should fix the problem.
As per the new Google Play policy, all apps must target at least Android 10 (API 29) before November 2, 2020.
More info: https://developer.android.com/distribute/play-policies
React Native is targeting API 28 as of today(v0.63), are there any plans to update the target SDK version?
Open android/build.gradle in your React Native project and change compileSdkVersion and targetSdkVersion values to 29.
android/build.gradle
buildscript {
ext {
buildToolsVersion = "29.0.5"
minSdkVersion = 16
compileSdkVersion = 29
targetSdkVersion = 29
}
}
Then go Android Studio and Run "Sync Project with File System" (File > Sync Project with Gradle Files).
It's necessary to upgrade your React Native version. You can see the instructions here.
A simple cli upgrade did the trick for me:
npx react-native upgrade
I'm trying to implement newer android SDK in my app with below configurations,
android {
compileSdkVersion 'android-R'
buildToolsVersion "30.0.0-rc4"
defaultConfig {
minSdkVersion 14
targetSdkVersion 'R'
}
...
}
I need some clarification,
We have faced the SDK version 29 was not modified after migrated the developer preview android-R. I think the SDK version is 30 right?
I have compared both android 29 & android R build.prop files & SDK version is the same as 29. But in android-R build.prop file release or codename parameter is 'R'. Please confirm for us.
I am trying to add React-Native-Admob 2.0.0-beta.5 into React-Native v0.55.4 for Android.
compileSdkVersion =26
buildToolsVersion ="27.0.3"
targetSdkVersion = 26
supportLibVersion = "26.1.0"
minSdkVersion = 18
And React-Native-Admob has
compileSdkVersion 23
buildToolsVersion "23.0.1"
defaultConfig {
minSdkVersion 16
targetSdkVersion 22
}
And when i Compile the error Exception occur
The SDK Build Tools revision (23.0.1) is too low for project ':react-native-admob'. Minimum required is 25.0.0
I can't downgrade my project's SDK, other package uses that SDK.
You don't need to downgrade, you need to upgrade. Dependencies were probably added in the SDK that admob relies on. You can download the specified version packages for the SDK through Android studio and then set your SDK version in the file to the appropriate version necessary for admob.
Edit
I see that you are saying that admob is using version 23. You may need to submit an issue with them on GitHub for this.
you can change the buildToolVersion of the library you are using, just go to -> node_modules/{your-library}/android/build.gradle, change buildToolsVersion from 23.0.1 to 25.0.0.
if the studio asks for any updates regarding build, just update it, and it might work.
another solution:
although I haven't tried it, it has a lot of emoji love on GitHub,
https://github.com/oblador/react-native-keychain/issues/68#issuecomment-304836725
Goto
"node-module/react-native-admob/android/build.gradle" file, then change the compileSdkVersion and buildToolsVersion to following values
compileSdkVersion 27
buildToolsVersion "27.0.3"