targetSdkVersion setting
I just found where the problem was.
Do not use API Level of 20 and Platform 4.4W, as Android Virtual Device.
With Level 19 and Platform 4.2.2 set on ADV everything runs as it should.
Implications of setting a lower targetSdkVersion for the app
The scenario you are mentioning is know as forward compatibility in Android. You can think it in other way as well, you app is already in Google Play Store and user updated his device software. In such case, Android/Google strongly focus on that existing apps built against prior SDKs should not break when the user updates to a new version of Android.
If any API of API level 25 you are using in your app is not deprecated in API level 27, there is no issue. It is completely fine to set targetSdkVersion : 25
.
But it is always recommended to compile your app with latest available SDK so that you can minimize the risk of crash/warnings of your code with respect to latest SDK.
So basically what you should follow is:
minSdkVersion <= targetSdkVersion <= compileSdkVersion
Hope this will help you.
Android Studio What is the difference between minSdkVersion, targetSdkVersion and minSdk, targetSdk?
There is no such thing named minSdk , targetSdk and compileSdk in build.gradle.
you should config your app compatibility like this :
android {
compileSdkVersion 30
buildToolsVersion "30.0.3"
defaultConfig {
applicationId "com.app.test"
minSdkVersion 21
targetSdkVersion 30
versionCode 1
versionName "1.0.0"
}
}
How to change Android minSdkVersion in flutter project
It is indeed possible to increase minSdkVersion, but it took me way too much time to find it out because google searches mostly yields as result discussions about the absolute minimum Sdk version flutter should be able to support, not how to increase it in your own project.
Like in an Android Studio project, you have to edit the build.gradle
file. In a flutter project, it is found at the path ./android/app/build.gradle
.
The parameter that needs to be changed is, of course, minSdkVersion 16
, bumping it up to what you need (in this case 19).
defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "com.example.projectname"
minSdkVersion 19 //*** This is the part that needs to be changed, previously was 16
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
Seems obvious now, but took me long enough to figure it out on my own.
what is the propose of targetSdkVersion in android?
android:targetSdkVersion
This attribute informs the system that you have tested against the target version and the system should not enable any compatibility behaviors to maintain your app's forward-compatibility with the target version.
As Android evolves with each new version, some behaviors and even appearances might change. However, if the API level of the platform is higher than the version declared by your app's targetSdkVersion, the system may enable compatibility behaviors to ensure that your app continues to work the way you expect. You can disable such compatibility behaviors by specifying targetSdkVersion to match the API level of the platform on which it's running. For example, setting this value to "11" or higher allows the system to apply a new default theme (Holo) to your app when running on Android 3.0 or higher and also disables screen compatibility mode when running on larger screens (because support for API level 11 implicitly supports larger screens).
Relationship between minSDK - targetSdk - compileSdk
minSdkVersion (lowest possible) <=
targetSdkVersion == compileSdkVersion (latest SDK)
What if you don't provide targetSdkVersion
?
Your minSdkVersion & compileSdkVersion is < API 23
(6.0 - MarshMallow - Have RunTime Permission) & you haven't added targetSdkVersion
.
Your application will get all the permission you have provided in your manifest by default as you haven't compiled with API 23 or provided targetSdkVersion.
In those cases defaults to the minSdkVersion
. If you haven't provided minSdkVersion
then it defaults to API 1.
Xamarin: Issue when TargetSdkVersion set to API 31 in manifest
According to the error message, the PackageUpdatedReceiver in your project doesn't set a value for the android:exported. So you can try to set a value by the two following ways.
- Set it in the attribute of the BroadCastReceiver:
[BroadcastReceiver(Exported = true)]
- Set it into the
application
label in the AndroidManifest.xml:
Edit: For android 12, all the Services, BroadCastReceivers, Activity classes need to declare the value for the android:exported
. So update the three part sdk to the last version.
Related Topics
React-Native: Command Not Found
Android - Multiple Screen Support Issue
Transparent Actionbar: Custom Tabcolor
Phonegap - Add a Splash Screen for Android App
Enable and Disable a Broadcast Receiver
End Call in Android Programmatically
Listview Scroll to the End of the List After Updating the List
Get Altitude by Longitude and Latitude in Android
How to Capture Soft Keyboard Input in a View
How to Cancel This Repeating Alarm
Adb Not Responding - Wait More or Kill Adb or Restart (Ubuntu 13) 64-Bit
Tools: Replace Not Replacing in Android Manifest
The APK File Does Not Exist on Disk
How to Measure the Tilt of the Phone in Xy Plane Using Accelerometer in Android
Android App Specific Soft Keyboard