Search code examples
androidandroid-studioandroid-2.2-froyo

Targeting API 8 (Android 2.2) using Android Studio causes merger failed error


I am attempting to create a simple app for a very old phone:

HTC Aria, Android 2.2, API level 8

In Android Studio, when I install the SDK version 8 and set minSdkVersion/targetSdkVersion in build.gradle, but it refuses to build.

Changing the API level in File > Project Structure also does not work. The error is as follows:

Error:Execution failed for task ':app:processDebugManifest'. Manifest merger failed : uses-sdk:minSdkVersion 8 cannot be smaller than version 14 declared in library [com.android.support:appcompat-v7:26.1.0] /home/oliver/.gradle/caches/transforms-1/files-1.1/appcompat-v7-26.1.0.aar/ccbf7c84a168d3e32184f6d6f1423c07/AndroidManifest.xml as the library might be using APIs not available in 8
Suggestion: use a compatible library with a minSdk of at most 8,
    or increase this project's minSdk version to at least 14,
    or use tools:overrideLibrary="android.support.v7.appcompat" to force usage (may lead to runtime failures)

Adding the overrideLibrary does not help, the error just switches to complaining about a different library. Is it even still possible to create Android 2.2/API 8 apps in Android Studio? If so, how can I do so?


Solution

  • You cannot use the latest Android Support Library with an API lower than 14.

    Caution: Starting with Support Library release 26.0.0 (July 2017), the minimum supported API level across most support libraries has increased to Android 4.0 (API level 14) for most library packages. For more information, see Version Support and Package Names in this document.


    Is it even still possible to create Android 2.2/API 8 apps in Android Studio?

    Yes

    If so, how can I do so?

    Use the older support Library (anything under 26.0.0) or don't use the support library at all. Limit yourself to classes and methods available from API 8 and lower.