How can ı use expo-build-properties with module resolver?

Hi i’m currently working with sdk 44 and trying get build for android 5. I found only expo-build-properties for this solution. I cannot put this code in my app.json. I have babel.config.js. and it includes module resolver like this.

module.exports = function (api) {
  api.cache(true);
  return {
    presets: ["babel-preset-expo"],
    plugins: [
      [
        "module-resolver",
        {
          alias: {
            app: "./app",
            "@actions": "./app/actions",
            "@assets": "./app/assets",
            "@components": "./app/components",
            "@config": "./app/config",
            "@navigation": "./app/navigation",
            "@reducers": "./app/reducers",
            "@screens": "./app/screens",
            "@services": "./app/services",
            "@store": "./app/store",
            "@navigation": "./app/navigation",
            "@selectors": "./app/selectors",
            "@utils": "./app/utils",
          },
        },
        "expo-build-properties",
        {
          "android": {
            "compileSdkVersion": 31,
            "targetSdkVersion": 31,
            "buildToolsVersion": "31.0.0"
          },
          "ios": {
            "deploymentTarget": "13.0"
          }
        }
      ],
    ],
  };
};

I tried config this file like this. and take build with eas build. But build was failed and it say “.plugins[0] may only be a two-tuple or three-tup” this error. Any idea or solution about this. Or maybe other solution for get apk for android 5 ?

Hi,

The expo-build-properties plugin configuration should go in app.json, not in Babel config. Expo 44 should be compatible with Android 5 by default, as well- no need for any special configuration.

Hi,
Thanks for reply. I already try to put it in app.json like in here but i cant build it with eas build. And get

PluginError: Plugin is an unexpected type: object
    Code: INVALID_PLUGIN_TYPE

error.

my app.json file

{
  "expo": {
    "name": "test",
    "slug": "",
    "owner": "",
    "version": "0.0.1",
    "orientation": "portrait",
    "icon": "./assets/icon.png",
    "splash": {
      "image": "./assets/splash.png",
      "resizeMode": "contain",
      "backgroundColor": "#FFFFFF"
    },
    "updates": {
      "fallbackToCacheTimeout": 0
    },
    "assetBundlePatterns": [
      "**/*"
    ],
    "ios": {
      "supportsTablet": true,
      "bundleIdentifier": "com.asd",
      "buildNumber": "0.0.1"
    },
    "android": {
      "adaptiveIcon": {
        "foregroundImage": "./assets/adaptive-icon.png",
        "backgroundColor": "#FFFFFF"
      },
      "package": "com.asd",
      "versionCode": 1
    },
    "web": {
      "favicon": "./assets/favicon.png"
    },
    "androidNavigationBar": {
      "visible": "immersive"
    },
    "plugins": [
      "expo-build-properties",
      {
        "android": {
          "compileSdkVersion": 31,
          "targetSdkVersion": 31,
          "buildToolsVersion": "31.0.0"
        },
        "ios": {
          "deploymentTarget": "13.0"
        }
      }
    ],
    "extra": {
      "eas": {
        "projectId": "asdsadas"
      }
    }
  }
}

and im trying run eas build -p android. Did ı do anyting wrong

You are missing some [].

Plugins should be either:

"plugins": ["plugin1", "plugin2", "plugin3"],

or:

"plugins": [
    ["plugin1", {"arg": "value"}],
    ["plugin2", ["args"]],
    ["plugin3", "arg"]
],

or a combination:

"plugins": [
    "plugin1",
    ["plugin2": {"arg": "value"}]
],

So you want:

    "plugins": [
      [ <---
        "expo-build-properties",
        {
          "android": {
            "compileSdkVersion": 31,
            "targetSdkVersion": 31,
            "buildToolsVersion": "31.0.0"
          },
          "ios": {
            "deploymentTarget": "13.0"
          }
        }
      ] <---
    ],
3 Likes

I forgot the square brackets. Thanks, I can build. But why targetSdkVersion can’t be 22? Android 5 works with, version 22. But when I try to make 22, I get the error that it may be at least 31.

I am not sure you need to adjust the targetSdkVersion etc. in order to run on Lollipop.
If I compile a random Expo SDK 44 app that I had lying around and install it on a Lollipop emulator, it installs fine. However when I try to run it I get an error:

“The embedded manifest is invalid or could not be read. Make sure you have configured expo-updates correctly in android/app/build.gradle. app.manifest”

I have not looked into that yet.

What actual problems were you running into when trying to build your app or run it on Lollipop, before you tried changing the targetSdkVersion etc?

I’m not sure of the hard technical constraints of setting targetSdkVersion with that particular version of Expo, but the Play Store is no longer accepting new apps or updates for a target SDK less than 31, so that factors in.

As @wodin noted, the default config should work on Android 5. minSdkVersion is what affects the lowest version of Android that the app can run on (and the default should be 22 aka Android 5 already)

1 Like

Hi again,

For our app it work on our android 8+ devices correctly. But when we try to open the same app with android 5.1 we got same error like this and when we update react-native-reanimeted version to 2.2.4 etc. the error seems like solved. But the app still waiting on splash screen and we cant see the other screens

Hi

Did you try version 2.4.0 or later?

Also, see: Debugging - Production errors

sure. its same. ı can see my screens and app in my 8+ android version devices. but still cant see in my 5.1 android version devices. its waiting only in splash screen

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