Assets on SDK 28

#1

I Upgrade Android App to SDK 28.0.0
All assets stop working on production detached app

all work on dev mode with xde

#2

The Fonts dont work, images!..

#3

Hey @victorwads,

How are you handling your assets? Are you pre-fetching them? Bundling them into your binary?

Also, what exactly is or isn’t happening in the production environment?

#5

I’m Bundling them.

{
  "env": "production",
  "expo": {
    "sdkVersion": "28.0.0",
    "name": "Ecocard",
    "description": "Seja digital! Troque cartões de visitas com o Ecocard!",
    "slug": "ecocard",
    "icon": "./assets/img/icon-android.png",
    "privacy": "unlisted",
    "version": "2.3.0",
    "platforms": [
      "ios",
      "android"
    ],
    "assetBundlePatterns": [
      "**/*"
    ],
    "updates": {
      "enabled": false
    },
    "splash": {
      "backgroundColor": "#404040",
      "image": "./assets/img/splash.png",
      "resizeMode": "cover"
    },
    "scheme": "ecocard",
    "orientation": "portrait",
    "facebookAppId": "#######",
    "facebookDisplayName": "Ecocard",
    "facebookScheme": "#######",
    "android": {
      "package": "br.com.i9xp.ecocard",
      "icon": "./assets/img/icon-android.png",
      "permissions": [
        "READ_CONTACTS",
        "READ_PROFILE",
        "WRITE_CONTACTS",
        "LOCATION",
        "ACCESS_FINE_LOCATION",
        "ACCESS_COARSE_LOCATION",
        "CAMERA",
        "READ_INTERNAL_STORAGE",
        "READ_EXTERNAL_STORAGE",
        "WRITE_EXTERNAL_STORAGE"
      ],
      "config": {
        "googleSignIn": {
          "certificateHash": "#######"
        }
      },
      "publishBundlePath": "android/app/src/main/assets/shell-app.bundle",
      "publishManifestPath": "android/app/src/main/assets/shell-app-manifest.json"
    },
    "ios": {
      "icon": "./assets/img/icon-ios.png",
      "bundleIdentifier": "br.com.i9xp.ecocard",
      "supportsTablet": false,
      "config": {
        "googleSignIn": {
          "reservedClientId": "#######"
        }
      },
      "infoPlist": {
        "NSContactsUsageDescription": "Você permite o Ecocard acessar sua lista de contatos para atualiza-los com as informações dos cartões digitais?",
        "NSLocationWhenInUseUsageDescription": "Você permite o Ecocard utilizar sua localização atual para procurar contatos que estejam próximos de você?",
        "NSPhotoLibraryUsageDescription": "Você permite o Ecocard utilizar sua galeria para atualizar suas imagens através dos nossos servidores?",
        "NSCameraUsageDescription": "Você permite o Ecocard utilizar sua camera para leitura de QRCodes?"
      },
      "publishBundlePath": "ios/ecocard/Supporting/shell-app.bundle",
      "publishManifestPath": "ios/ecocard/Supporting/shell-app-manifest.json"
    },
    "locales": {
      "en": "./assets/locales/en.json"
    },
    "isDetached": true,
    "detach": {
      "androidExpoViewUrl": "https://s3.amazonaws.com/exp-exponent-view-code/android-v2.6.2-sdk28.0.0-141d0954-b898-4919-aa89-3ab45453213f.tar.gz",
      "iosExpoViewUrl": "https://s3.amazonaws.com/exp-exponent-view-code/ios-v2.6.5-sdk28.0.0-7eac2a72-06b2-48c9-8281-c0c6c308f0b0.tar.gz"
    }
  }
}

Exemple on fonts:

      Font.loadAsync({
        Roboto: require('./assets/fonts/Roboto.ttf'),
        Roboto_medium: require('./assets/fonts/Roboto.ttf'),
        Raleway_Light: require('./assets/fonts/RalewayLight.ttf'),
        Raleway_Regular: require('./assets/fonts/RalewayRegular.ttf'),
        Raleway_Medium: require('./assets/fonts/RalewayMedium.ttf'),
        Raleway_SemiBold: require('./assets/fonts/RalewaySemiBold.ttf'),
        Raleway_Bold: require('./assets/fonts/RalewayBold.ttf'),
        EcoCardIcons: require('./assets/fonts/EcoCardIcons.ttf')
      }),

Exemple on images:

const Logo = require('../../assets/img/logo.png')
// ...
<Image style={{flex: 0.8, aspectRatio: 1.77}} source={Logo} resizeMode='contain' />
#6

Just noticed you said you upgraded the SDK. Just to be certain, did you perform the one-time instructions to enable asset bundling on detached projects that was part of the SDK27 upgrade steps? https://blog.expo.io/expo-sdk-v27-0-0-is-now-available-898bf1e5b0e4

Said instructions: https://gist.github.com/janicduplessis/30ec95451733d34ffcf7d5cb27ba0e28

#7

@adamjnav, first thanks for your support.

Yes, when i upgrade from SDK 26 to SDK 27, and all has working fine.

I found something,

in ‘android/app.gradle’:
On update zip it is:

/* UNCOMMENT WHEN DISTRIBUTING
apply from: 'expo.gradle'
END UNCOMMENT WHEN DISTRIBUTING */

I remove de comments.

/* UNCOMMENT WHEN DISTRIBUTING */
apply from: 'expo.gradle'
/* END UNCOMMENT WHEN DISTRIBUTING */

Thank U, i found this seeing the diff between my app.gradle and the “SDK27 upgrade steps” app.gradle

But, how i said in another post, Splash screen, still not work on SDK 28.

closed #8

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