Installation error: INSTALL_FAILED_OLDER_SDK
Solution 1:
It is due to android:targetSdkVersion="@string/app_name"
in your manifiest file.
Change it to:
<uses-sdk android:minSdkVersion="15" android:targetSdkVersion="15"/>
The targetSdkVersion
should be an integer, but @string/app_name
would be a string. I think this causing the error.
EDIT:
You have to add a default intent-filter
in your manifiest
file for the activity. Then only android can launch the activity. otherwise you will get the below error in your console window.
[2012-02-02 09:17:39 - Test] No Launcher activity found!
[2012-02-02 09:17:39 - Test] The launch will only sync the application package on the device!
Add the following to your <activity>
tag.
<activity android:name="HelloAndroid" android:launchMode="standard" android:enabled="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
Solution 2:
This means the version of android of your avd is older than the version being used to compile the code
Solution 3:
This error occurs when the sdk-version installed on your device (real or virtual device) is smaller than android:minSdkVersion
in your android manifest.
You either have to decrease your android:minSdkVersion
or you have to specify a higher api-version for your AVD.
Keep in mind, that it is not always trivial to decrease android:minSdkVersion
as you have to make sure, your app cares about the actual installed API and uses the correct methods:
AsyncTask<String, Object, String> task = new AsyncTask<String, Object, String>() {
@Override
protected Boolean doInBackground(String... params) {
if (params == null) return "";
StringBuilder b = new StringBuilder();
for (String p : params) {
b.append(p);
}
return b.toString();
}
};
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
task.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR,"Hello", " ", "world!");
} else {
task.execute("Hello", " ", "world!");
}
Using the android-support-library and/or libraries like actionbar-sherlock will help you dealing especially with widgets of older versions.
Solution 4:
I am using Android Studio 0.8.1. I have a project's gradle file like below:
android {
compileSdkVersion 19
buildToolsVersion "20.0.0"
defaultConfig {
applicationId "com.omersonmez.widgets.hotspot"
minSdkVersion 15
targetSdkVersion 19
versionCode 1
versionName "1.0"
}
buildTypes {
release {
runProguard false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
My emulator was android 4.0. So i modified my emulator and made api level 4.0.3(apilevel 15). It worked.