I need to set the minSdkVersion of my expo app (with custom dev client) to 24. So, I added the "expo-build-properties" plugin with the minSdkVersion to my app.json file as mentioned here:
{
"expo": {
...
"plugins": [
...
[
"expo-build-properties",
{
"android": {
"minSdkVersion": 24
}
}
],
]
}
}
The problem is that when I build the app using eas build ...
, when I try to run the app on an Android emulator or a physical Android device, I get the following error. Does anyone have any idea why this is happening? The only change I made was to set the min sdk version. Everything else remained as before when the app would run properly.
In case it matters, I am developing on a MacBook Pro with an M1 chip.
For anyone who faces the same issue, I was able to fix the problem by adding a new custom plugin as mentioned in this GitHub issue:
Basically, first save the plugin code in the post above to a file in your project, for example, ./withAppBuildGradleModified.js
.
Then, in your app.json
or app.config.js
file, add the plugin to the plugins array like this:
{
"expo": {
...
"plugins": [
...
"./withAppBuildGradleModified"
]
}
}
And finally, rebuild your app using the proper eas build command. If you get any errors during the build, you may need to add --clear-cache
to your eas build command.
Hope this saves the next person a few hours of uncertainty and doubt :)