I got this Froyo (2.2) device that I am using to make an app. When I try to run the app directly to the device it shows an error saying
pkg:
In android studio: reduce minSDKversion. It will work...
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.1"
defaultConfig {
applicationId "healthcare.acceliant.trianz.com.myapplication"
minSdkVersion 11
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:23.1.1'
}
This is because you mobile has older sdk version than your application..!!! It means your application need sdk version suppose Lollipop but you mobile has version kitkat.
Fix your gradle file the following way
defaultConfig {
applicationId "package.com.app"
minSdkVersion 8 //this should be lower than your device
targetSdkVersion 21
versionCode 1
versionName "1.0"
}
Besides checking the right minSdkVersion
in build.gradle
, make sure you have installed all necessary tools
and correct SDK Platform
for your preferred Android Version in SDK Manager
. In Android Studio klick on Tools -> Android -> SDK Manager. Then install at minimum (for Android 2.2 without emulator):
This is what worked for me.
Make sure you don't have a minSdkVersion
set in your build.gradle
with a value higher than 8. If you don't specify it at all, it's supposed to use the value in your AndroidManfiest.xml
, which seems to already be properly set.
After I changed
defaultConfig {
applicationId "com.example.bocheng.myapplication"
minSdkVersion 15
targetSdkVersion 'L' #change this to 19
versionCode 1
versionName "1.0"
}
in build.gradle
file.
it works