Solved

minSdkVersion error with Expo Build on Android


Badge +1

Struggling a bit with building a dev build for Expo for an Android app.

I get the error:


> Manifest merger failed : uses-sdk:minSdkVersion 23 cannot be smaller than version 24 declared in library [com.revenuecat.purchases:purchases-hybrid-common-ui:10.5.0]

 

Which points to the purchases-hybrid-common-ui library but I haven’t been able to find a solution.

There seems to be a post for this issue but I followed it and could not make it work.. not sure if that solution is exactly correct for all use cases of configuration:

 

I tried adding the implementations as mentioned here:

https://www.revenuecat.com/docs/tools/paywalls#android-installation

 

and looked through various solutions similar to this:
https://stackoverflow.com/questions/67021833/struggling-to-get-android-build-working-due-to-minsdkversion

 


The solution suggestions from the build log itself are:

Suggestion: 
use a compatible library with a minSdk of at most 23,
or increase this project's minSdk version to at least 24,
or use tools:overrideLibrary="com.revenuecat.purchases.hybridcommon.ui" to force usage (may lead to runtime failures)

 

I think I’ve tried all of these and the build still fails :/

 

but nothing works.

My package.json versions:

"react-native-purchases": "^7.27.0",
"react-native-purchases-ui": "^7.27.0",

 

My android/app/src/build.gradle file:

defaultConfig {
minSdkVersion rootProject.ext.minSdkVersion

My android/build.gradle file:

buildscript {
ext {
buildToolsVersion = findProperty('android.buildToolsVersion') ?: '34.0.0'
minSdkVersion = Integer.parseInt(findProperty('android.minSdkVersion') ?: '24')
compileSdkVersion = Integer.parseInt(findProperty('android.compileSdkVersion') ?:
'34')
targetSdkVersion = Integer.parseInt(findProperty('android.targetSdkVersion') ?:
'34')
kotlinVersion = findProperty('android.kotlinVersion') ?: '1.8.10'


I am not sure what the configuration should be.

Has anyone come across this before?

 

Thanks!

icon

Best answer by yafim-simanovsky-f0cedc 15 May 2024, 18:10

View original

3 replies

Userlevel 4
Badge +6

Hey @yafim-simanovsky-f0cedc! Sorry to hear this is happening and you haven’t been able to build the app. In the other community post that you’ve posted, the config plugin that the other user was able to use to get their app working - can you walk me through the steps you took when you tried this? Did you use prebuild and generate new native directories?

Badge +1

Hi kaitlin!

I just figure it out yesterday. I had indeed to follow the Expo BuildProperties doc, and to create specifically the app.config.js file that I did not have (I just had app.json) and add to it this in the plugins key:

 

[
"expo-build-properties",
{
android: {
minSdkVersion: 24,
},
ios: {
deploymentTarget: "13.4",
},
},
],

 

Thank you for following up! I will mark this as the answer :)

Userlevel 4
Badge +6

Hey @yafim-simanovsky-f0cedc, that’s absolutely great to hear!! Thanks for letting us know!

Reply