Feather Feet
Feather Feet

Reputation: 131

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?

Upvotes: 1

Views: 1077

Answers (2)

Elletlar
Elletlar

Reputation: 3234

Creating a Froyo [SDK INT: 8] app in 2019 turned out to be a bit difficult...

To make a long story short, I had to do this to overcome a defect in the GooglePlay console that prevented me from updating my app. [Related to the new SMS permissions policy]

Procedure for creating an Android app with a min SDK INT of 8 in Android Studio 3.2.1:

  • File -> New -> New Project
  • You will have to select a minimum version of 15 for now since that is as low as the drop-down menu currently goes [Note: installing the Froyo SDK will not help either]
  • Select "Add No Activity" to keep the project simple.
  • Once the project is built go into the app-level build.gradle file and change the min SDK to 8
  • Go into the AndroidManifest.xml file and remove any theme related code
  • Go into the values/styles.xml file and remove any theme related code
  • Manually create your own activity [Warning: Do not do "File -> New -> Activity" since it will start inserting support library code in multiple places throughout the project]
    • Create a simple class derived from Activity
    • Create a layout for it in the res/layout directory
    • Add the activity tag to the manifest

That's it. I was able to install a min Froyo [SDK INT: 8] app on my Oreo device.

Upvotes: 0

Sam
Sam

Reputation: 86958

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.

Upvotes: 0

Related Questions