Missing assets in bundled apk

Hello,

Issue description

I’ve ejected an expo application and i’m trying the offline support.
I’ve modified my app.json like this

"assetBundlePatterns": [
  "**/*"
],

After publishing the app to the proper channel i tried to build an apk.
Starting the app the first time without connectivity i can’t see any images or fonts.
I’m not sure if the issue is related to the way that i’m requiring the images and fonts in my app or it’s because assets are not properly bundled into the apk.
As soon as the app is connected to the internet the images and fonts are shown as intended.

This is my asset folder structure under root:

/root
  /assets/
      /fonts/
          /icons
            fontello.tff
        TIMSans-Bold.tff
      /images
         margherita.jpg
  /src

app.json
package.json
....

I’ve go and index file inside the asset folder that looks like this:

const Images = {
  logo: require('./images/logo.png'),
  margherita: require('./images/margherita.jpg'),
  arrosto: require('./images/arrosto.jpg'),
};

const Fonts = {
  regular: require('./fonts/TIMSans-Regular.ttf'),
  medium: require('./fonts/TIMSans-Medium.ttf'),
  bold: require('./fonts/TIMSans-Bold.ttf'),
  fontello: require('./fonts/icons/fontello.ttf'),
};

export { Images, Fonts };

This is my Android studio asset folder after gradle building:
00

Googling around i’ve understood that images are taken from a cdn and bundled into the apk if requested by the app.json assetBundlePatterns.

The shell-app-manifest.json report a lot of bundled assets:

"bundledAssets":[
"asset_3a2ba31570920eeb9b1d217cabe58315.ttf",
"asset_744ce60078c17d86006dd0edabcd59a7.ttf",
"asset_140c53a7643ea949007aa9a282153849.ttf",
"asset_6beba7e6834963f7f171d3bdd075c915.ttf",
"asset_b06871f281fee6b241d60582ae9369b9.ttf",
 ... a lot more]

But none of them seems to be inside the unzipped apk.

What’s the expected result?

Having the proper fonts and images loaded into the application even when the app is started offline the first time.

What’s the actual result?

The app is working properly when starting the first time offline but without any images of fonts loaded.

Additional details / screenshot

"expokit": "^32.0.3",
"react": "16.5.0",
"react-native": "https://github.com/expo/react-native/archive/sdk-32.0.0.tar.gz",

Expo cli version → 2.10.1

1 Like

This solved my issue!!!

https://github.com/expo/expo/issues/3226