'The application's minSdkVersion is newer than the device API level (android-R)
I have a device with android version 10.
Also, I have an emulator with API 22
this is a part of my build.gradle(:app) file:
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-kapt'
apply plugin: 'kotlin-android-extensions'
android {
dataBinding {
enabled = true
}
compileSdkVersion 'android-R'
defaultConfig {
applicationId "com.example.android.sOnline"
minSdkVersion 17
targetSdkVersion 'R'
versionCode 1
versionName "1.0"
multiDexEnabled true
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
// android.defaultConfig.javaCompileOptions.annotationProcessorOptions.includeCompileClasspath = true
}
}
It just not working on 'android-R'
Thank you for helping me :)
Solution 1:[1]
targetSdkVersion "R" will restrict your app to only running on Android R, by artificially raising your minSdkVersion to R. This has been the case for the past several years: each developer preview only supports running the app on the developer preview itself, not older devices.
Sometime later this year, we will be able to switch to using targetSdkVersion 30, at which point normal behavior returns with respect to minSdkVersion.
Solution 2:[2]
For me it was that the virtual device was corrupted , to fix this follow these steps :
- open the AVD manager from the top right corner.
- delete the device from the actions menu.
- create a new one.
- choose the new device and run your application.
For future safety before exiting the android studio make sure to close the emulator first.
Solution 3:[3]
- Go to build.gradle file
- in defaultConfig: change minSdk to 28 and targetSdk to 30
I use a samsung s9 plus, had the same problem and now it works
defaultConfig {
applicationId "com.example.consigness"
minSdk 28
targetSdk 30
versionCode 1
versionName "1.0"
multiDexEnabled true
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | CommonsWare |
| Solution 2 | amr samy |
| Solution 3 | abbujaansboy |
