expo-print dosen't work on APK

Please provide the following:

  1. SDK Version: 46.0.0
  2. Platforms(Android/iOS/web/all): Android

expo-print only works in expo go. when i build the apk it doesn’t work, it just doesn’t do anything.
I would like to know if I am doing something wrong or if I am missing some configuration, because when I generated it with the expo build command it always worked, now that I generate it with eas build it is no longer working.

import * as React from 'react';
import { View, StyleSheet, Button, Platform, Text } from 'react-native';
import * as Print from 'expo-print';
import { shareAsync } from 'expo-sharing';

const html = `
<html>
  <head>
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=no" />
  </head>
  <body style="text-align: center;">
    <h1 style="font-size: 50px; font-family: Helvetica Neue; font-weight: normal;">
      Hello Expo!
    </h1>
    <img
      src="https://d30j33t1r58ioz.cloudfront.net/static/guides/sdk.png"
      style="width: 90vw;" />
  </body>
</html>
`;

export default function App() {

  const print = async () => {
    await Print.printAsync({html});
  };

  return (
    <View style={styles.container}>
      <Button title="Print" onPress={print} />
    </View>
  );
}

The eas.json:

{
  "cli": {
    "version": ">= 0.60.0"
  },
  "build": {
    "development": {
      "developmentClient": true,
      "distribution": "internal"
    },
    "preview": {
      "android": {
        "buildType": "apk"
      }
    },
    "production": {}
  },
  "submit": {
    "production": {}
  }
}

eas build --platform android --profile preview

Hi, check if you have a base64 image, the problem is that the eas build command doesn’t upload certain files. In the case of images, if they aren’t used as splash or icon, they aren’t found and the print dosen’t open.
Then it will work in expo go, but when you generate the app it won’t anymore.

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