I set up my build.gradle.kts file in the shared module of my KMM project like the following snippets shows:
android {
namespace = "com.my.project"
compileSdk = 33
sourceSets["main"].manifest.srcFile("src/androidMain/AndroidManifest.xml")
defaultConfig {
minSdk = 24
targetSdk = 33
}
}
For the targetSDK I get the following warning:
targetSdk: Int?' is deprecated. Will be removed from library DSL in v9.0
How can I migrate this part and set the targetSdk version appropriately in my KMM project for the Android project?
targetSdk property from Android library gradle plugin ("com.android.library") was depricated. It is only advisory property, you could safely delete it. minSdk is enough. See LibraryBaseFlavor reference deprecation message.
Note: Don't mix it up with Android application gradle plugin ("com.android.application"). targetSdk property is very important and hasn't been deprecated there.
Related
I developed a networking module for my company. The initial defaultConfigs we set defined minSdk as 29 and it was with these settings that version 1.0.0 of this module was published. Now the need arose to reduce this value to 26 or even less, if possible. I already changed the minSdkVersion to 26 in the module and published a new version, but I always get the same error:
Manifest merger failed : uses-sdk:minSdkVersion 26 cannot be smaller than version 29 declared in library [nearsea-technologies:android.network:1.0.1] (...)/.gradle/caches/transforms-3/c729ae7e60a0cde9500d48b107ed3b46/transformed/android.network-1.0.1/AndroidManifest.xml as the library might be using APIs not available in 26
Suggestion: use a compatible library with a minSdk of at most 26,
or increase this project's minSdk version to at least 29,
or use tools:overrideLibrary="nst.android.network" to force usage (may lead to runtime failures)
This is the defaultConfig of my module and my current project is the same.
defaultConfig {
minSdk = 26
targetSdk = 33
(...)
}
How can I resolve this? What do I need to do? What am I missing?
If you need more code, I can make it available.
In AndroidManifext.xml for your module just add line:
<uses-sdk tools:overrideLibrary="nst.android.network" />
I am getting some issue while updating compilesdk and targetsdk to 33.
And if I set compilesdk or targetsdk to 32, 31 or less, I get another library support issue during compilation, as described below...
1. Dependency 'androidx.lifecycle:lifecycle-livedata-ktx:2.6.0-alpha02' requires libraries and applications that
depend on it to compile against version 33 or later of the
Android APIs.
:app is currently compiled against android-32.
Also, the maximum recommended compile SDK version for Android Gradle
plugin 7.2.1 is 32.
Recommended action: Update this project's version of the Android Gradle
plugin to one that supports 33, then update this project to use
compileSdkVerion of at least 33.
Note that updating a library or application's compileSdkVersion (which
allows newer APIs to be used) can be done separately from updating
targetSdkVersion (which opts the app in to new runtime behavior) and
minSdkVersion (which determines which devices the app can be installed
on).
and getting this same issue with all newly added library to the gradle
I'm not sure if this is a sdk 33 or library issue.
I already tried this--->https://stackoverflow.com/questions/30684613/android-studio-xml-editor-autocomplete-not-working-with-support-libraries/54007742#54007742
Please Refer this link. There is issue in Android Studio Chipmunk Version. Google Team fixed in Android Studio Dolphin. Check Issue Tracker as well
Replace
def lifecycle_version = "2.6.0-alpha02"
with
def lifecycle_version = "2.4.0-rc01"
in build.gradle(app) file.
Please refer to this link for screenshot.
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
...
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.