Manifest merger failed SDK 31

Hi,

I have run into the below issue after upgrading to SDK 31. I am able to run the simulator and I am now attempting to generate a signed APK. I was able to do this prior to upgrading.

Manifest merger failed : uses-sdk:minSdkVersion 19 cannot be smaller than version 21 declared in library [host.exp.exponent:expoview:31.0.0] /Users/someuser/.gradle/caches/transforms-1/files-1.1/expoview-31.0.0.aar/9438a2bc51a9d25aa547a3aed586dcb2/AndroidManifest.xml as the library might be using APIs not available in 19
	Suggestion: use a compatible library with a minSdk of at most 19,
		or increase this project's minSdk version to at least 21,
		or use tools:overrideLibrary="host.exp.expoview" to force usage (may lead to runtime failures)

While the suggestion is to update to minsdk version I am hesitant to this as expo notes do state not to do upgrades to android studio (unless I am misinterpreting this)

What is the recommended course of action? Do I need to generate a new keystore after upgrading?

Relevant Config

productFlavors {
    devKernel {
      dimension 'remoteKernel'
    }
    prodKernel {
      dimension 'remoteKernel'
    }
    devMinSdk {
      dimension 'minSdk'
      // dev utilizes minSDKVersion = 21 to allow the Android gradle plugin
      // to pre-dex each module and produce an APK that can be tested on
      // Android Lollipop without time consuming dex merging processes.
      minSdkVersion 21
    }
    prodMinSdk {
      dimension 'minSdk'
      minSdkVersion 19
    }
  }

SDK31 dropped support for Android [4.4, 5) (APIs [19, 20)). To fix the build, change minSdkVersion in prodMinSdk to 21. :slightly_smiling_face:

Gradle is complaining because you’re trying to build an APK that is supposed to support Android 4.4 while including a library that says it supports Android 5+. Bumping minSdkVersion will change the former part of the statement to 5, so everything will work ok.

Bingo that worked! Thank you!

2 Likes

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.