SKeney
SKeney

Reputation: 2301

Assets not showing when using expo:build for .apk after upgrading to SDK 39

I am updating app from Expo SDK 38 to Expo SDK 39. Everything goes smoothly it works perfectly in the Expo Client.

When I build a standalone app for testing before submission with the following:

expo build:android -t apk --release-channel some-build-release

I open the app to no assets showing. My custom fonts which are in the same assets directory are being used properly.

I am bundling the assets directly into the binary with the following app.json:

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

All of my assets are in the assets folder. When I build a standalone app on SDK 38 everything works perfectly. Assets show up with no issues. Any help is appreciated.

The following is my package.json in case that helps:

{
  "main": "node_modules/expo/AppEntry.js",
  "scripts": {
     ...
  },
  "dependencies": {
    "@react-native-community/async-storage": "~1.12.0",
    "@react-native-community/datetimepicker": "^3.0.4",
    "@react-native-community/masked-view": "0.1.10",
    "@react-native-community/netinfo": "5.9.6",
    "@react-native-community/slider": "3.0.3",
    "@react-navigation/bottom-tabs": "^5.10.1",
    "@react-navigation/drawer": "^5.10.1",
    "@react-navigation/material-top-tabs": "^5.3.1",
    "@react-navigation/native": "^5.8.1",
    "@react-navigation/stack": "^5.11.0",
    "@types/expo": "^32.0.13",
    "@types/react-native": "~0.63.2",
    "axios": "^0.19.2",
    "convert-time": "^0.3.0",
    "expo": "^39.0.0",
    "expo-application": "~2.3.0",
    "expo-av": "~8.6.0",
    "expo-blur": "~8.2.0",
    "expo-camera": "~9.0.0",
    "expo-constants": "~9.2.0",
    "expo-device": "~2.3.0",
    "expo-file-system": "~9.2.0",
    "expo-firebase-analytics": "~2.5.0",
    "expo-font": "~8.3.0",
    "expo-image-picker": "~9.1.0",
    "expo-linear-gradient": "~8.3.0",
    "expo-localization": "~9.0.0",
    "expo-location": "~9.0.0",
    "expo-media-library": "~9.2.1",
    "expo-network": "~2.3.0",
    "expo-notifications": "~0.7.2",
    "expo-permissions": "~9.3.0",
    "expo-status-bar": "~1.0.2",
    "expo-video-player": "^1.5.8",
    "lodash": "^4.17.19",
    "moment": "^2.24.0",
    "moment-timezone": "^0.5.31",
    "react": "16.13.1",
    "react-devtools": "^3.6.3",
    "react-dom": "16.13.1",
    "react-native": "https://github.com/expo/react-native/archive/sdk-39.0.3.tar.gz",
    "react-native-animatable": "^1.3.3",
    "react-native-collapsible": "^1.5.2",
    "react-native-elements": "^2.1.0",
    "react-native-expo-image-cache": "^4.1.0",
    "react-native-geocoding": "^0.4.0",
    "react-native-gesture-handler": "~1.7.0",
    "react-native-google-places-autocomplete": "^1.8.0",
    "react-native-hyperlink": "0.0.19",
    "react-native-keyboard-accessory": "^0.1.10",
    "react-native-keyboard-aware-scroll-view": "^0.9.1",
    "react-native-maps": "0.27.1",
    "react-native-modal": "^11.5.6",
    "react-native-modal-datetime-picker": "^8.9.0",
    "react-native-paper": "^3.10.1",
    "react-native-reanimated": "~1.13.0",
    "react-native-safe-area-context": "3.1.4",
    "react-native-screens": "~2.10.1",
    "react-native-snap-carousel": "^3.9.1",
    "react-native-svg": "12.1.0",
    "react-native-tab-view": "^2.15.2",
    "react-native-web": "~0.13.7",
    "react-navigation-header-buttons": "^6.0.0",
    "react-redux": "^7.1.1",
    "redux": "^4.0.4",
    "redux-devtools-extension": "^2.13.8",
    "redux-saga": "^1.1.3",
    "redux-thunk": "^2.3.0",
    "sentry-expo": "^3.0.3",
    "tslib": "^2.0.1",
    "validator": "^12.1.0"
  },
  "devDependencies": {
    "@typescript-eslint/eslint-plugin": "^3.9.0",
    "@typescript-eslint/parser": "^3.9.0",
    "babel-eslint": "^10.1.0",
    "babel-preset-expo": "^8.3.0",
    "eslint": "^7.7.0",
    "eslint-config-airbnb": "^18.2.0",
    "eslint-plugin-import": "^2.22.0",
    "eslint-plugin-jsx-a11y": "^6.3.1",
    "eslint-plugin-react": "^7.20.6",
    "eslint-plugin-react-hooks": "^4.0.8",
    "typescript": "~3.9.2"
  },
  "private": true
}

Upvotes: 1

Views: 1516

Answers (1)

SKeney
SKeney

Reputation: 2301

Was not an issue with the build process but instead an issue with another part of my code where other assets were getting saved to the documentDirectory.

I originally was saving assets (such as a small video) to the root documentDirectory. I had another process that would clear old assets based on an array of values of "what should be there".

There was a change from Expo 38 -> 39 where binary assets now got bundled directly to the root of the documentDirectory so when my app was loading it would remove all the bundled assets.

Easy fix was to just store these other assets that I was loading on app launch to a subdirectory in the documentDirectory (in my case documentDirectory/assetCache).

Upvotes: 1

Related Questions