Installation error: INSTALL_FAILED_OLDER_SDK

前端 未结 19 1734
太阳男子
太阳男子 2020-11-28 09:37

I am new to Android development and I want first to get the Hello World application running. I am using Eclipse IDE and the Android 4.0.3 version 15 SDK. I copi

19条回答
  •  没有蜡笔的小新
    2020-11-28 10:08

    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 task = new AsyncTask() {
        @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.

提交回复
热议问题