SDK 32 Android Bundled Assets not loading

Hi,

I’m not being able to use bundled assets in Android, it always gets the assets from the cdn, and it doesn’t work offline.

I’ve already included font and image folders in assetBundlePatterns as following:

“assetBundlePatterns”: [
“assets/images/",
"assets/fonts/

],

And i see fonts and images in the bundle when inspecting the sdk in Android Studio.

I don’t know what else i’m missing.

Thanks!

Hi @cbeiro - sorry for the trouble :disappointed: We had an issue with bundled assets on our build server, but it’s fixed now. If you run expo build:android again then your bundled assets should work in the new APK. (More info here if you’re curious: https://github.com/expo/expo/issues/3226)

Thanks for your quick response!. I’m using turtle cli for building the apk, is there also fixed?

Hi @cbeiro- yes, if you update to turtle-cli@0.5.7 or later it should be fixed. Make sure to clear out your ~/.turtle/workingdir just in case, to make sure the new code gets downloaded properly.

Great it worked! Thanks!

Hi, I am having the same problem right now with turtle-cli. I have upgrading to 0.5.7 and deleted the entire ~/.turtle directory but none of the bundled assets are loading in my app. I can see the files there when I unzip the apk file but the app is attempting to load the files from a network location. Do you have any ideas that might help me fix this?

Hey @jamesmorad - hmm, that’s interesting :thinking: I’m not able to reproduce that right now. Could you verify that the version number in ~/.turtle/workingdir/android/sdk32/expokit-npm-package/package.json is 32.0.6?

Sure, here are the contents of the file:

{
  "name": "expokit",
  "version": "32.0.6",
  "description": "",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "author": "",
  "license": "MIT",
  "dependencies": {
    "jsc-android": "^224109.1.0"
  }

It looks like it is using 32.0.6.

Hey @jamesmorad – hmmm, that looks right. It’s hard to tell exactly what’s going on here :thinking: Does this also repro for you with a brand new expo project? (If you do expo init and choose the tabs template, there are some bundled assets in that project.)

So it looks like I’m having the same issue with the tabs template when I put the emulator in airplane mode (otherwise it grabs the images from a CDN I guess?):

Here’s some more info that might help:

jamesmorad$ npm list -g turtle-cli && npm list -g gulp-cli && npm list -g expo-cli
/usr/local/lib
└── turtle-cli@0.5.7

/usr/local/lib
└── gulp-cli@2.0.1

/usr/local/lib
└── expo-cli@2.7.1
jamesmorad$ uname -a
Darwin Jamess-MacBook-Pro.local 18.2.0 Darwin Kernel Version 18.2.0: Fri Oct  5 19:41:49 PDT 2018; root:xnu-4903.221.2~2/RELEASE_X86_64 x86_64

Thanks for any input.

Also just to be 100% clear, my build process looks like this:

expo export --public-url http://`ipconfig getifaddr en0`:8000 --dev;
cd dist/
python -m SimpleHTTPServer 8000
turtle build:android \
--public-url http://`ipconfig getifaddr en0`:8000/android-index.json \
--keystore-path ${EXPO_ANDROID_KEYSTORE_BASE64} \
--keystore-alias ${EXPO_ANDROID_KEYSTORE_ALIAS} \
--output ./build/test.apk

@jamesmorad interesting. Could you send one of the affected APK files to secure@expo.io so we can take a look?

@esamelson Sure, thanks for helping me look into this! I just sent the email containing the apk in question.

@jamesmorad - thanks for sending! It looks your APK is made with a development mode JS bundle. (I didn’t notice that --dev flag in your export command earlier – sorry!) Bundled assets are only supported with production mode JS bundles right now, so in order to get them to work you’ll need to export your app with the --no-dev option (which should be the default).

Great, thank you for the help! I am confirming the test app compiles an apk that loads the local assets correctly.

2 Likes

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