question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Adding expo-localization as dependency causes some Play Store / Robo tests to fail with native crash

See original GitHub issue

Summary

Having expo-localization as dependency causes some Play Store pre-launch tests and manually run Robo tests to fail. The crash doesn’t even require importing expo-localization in code. Crash occurs on app startup before the splash screen gets hidden and the device locale seems to be a deciding factor in the crash. For example, English (United States), Dutch (Belgium),English (United Kingdom) and English (Guam) are fine. On the other hand, Finnish, Swedish, Norwegian Bokmål, English and Afrikaans seem to trigger the crash.

       *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
Build fingerprint: 'Sony/H8296/H8296:9/52.0.A.8.25/2936766125:user/release-keys'
Revision: '0'
ABI: 'arm64'
pid: 27505, tid: 27622, name: mqt_js  >>> com.jouhou.loc_crash_test <<<
signal 6 (SIGABRT), code -6 (SI_TKILL), fault addr --------
    x0  0000000000000000  x1  0000000000006be6  x2  0000000000000006  x3  0000000000000008
    x4  fefeff00ad349b0a  x5  fefeff00ad349b0a  x6  fefeff00ad349b0a  x7  7f7f7f7fff7fff7f
    x8  0000000000000083  x9  8002ff6da7d9ecb9  x10 0000000000000000  x11 fffffffc7ffffbdf
    x12 0000000000000001  x13 000000000000000f  x14 0000000000000780  x15 00000074fb2b70f0
    x16 00000075991322b8  x17 0000007599053be8  x18 00000000ebad6082  x19 0000000000006b71
    x20 0000000000006be6  x21 434c4e47432b2b00  x22 0000000000000000  x23 00000074fb2ba588
    x24 0000000000000000  x25 00000074fb7bd060  x26 00000074fb2ba588  x27 00000074fb2b8338
    x28 0000007515dde9c0  x29 00000074fb2b70f0
    sp  00000074fb2b70b0  lr  0000007599045314  pc  000000759904533c

Here is a tombstone file of the crash: web-build_2022-01-15T20 18 50.txt

I haven’t been able to reproduce this on real devices or on emulators, but for obvious reasons, I have refrained from publishing the recent builds to production.

Managed or bare workflow? If you have ios/ or android/ directories in your project, the answer is bare!

managed

What platform(s) does this occur on?

Android, with both hermes and jsc

SDK Version (managed workflow only)

44

Environment

Expo CLI 5.0.3 environment info: System: OS: Linux 5.15 Fedora Linux 35 (Workstation Edition) Shell: 5.1.8 - /bin/bash Binaries: Node: 14.18.2 - /var/lib/snapd/snap/bin/node Yarn: 1.22.15 - /var/lib/snapd/snap/bin/yarn npm: 6.14.15 - /var/lib/snapd/snap/bin/npm npmPackages: expo: ~44.0.4 => 44.0.4 react: 17.0.1 => 17.0.1 react-dom: 17.0.1 => 17.0.1 react-native: 0.64.3 => 0.64.3 react-native-web: 0.17.1 => 0.17.1 npmGlobalPackages: eas-cli: 0.38.3 expo-cli: 5.0.1 Expo Workflow: managed

Reproducible demo

This is basically unaltered code right after expo init, apart from running expo install expo-localization.

App.js:

import { StatusBar } from 'expo-status-bar';
import { StyleSheet, Text, View } from 'react-native';

export default function App() {
  return (
    <View style={styles.container}>
      <Text>Open up App.js to start working on your app!</Text>
      <StatusBar style="auto" />
    </View>
  );
}

const styles = StyleSheet.create({
  container: {
    flex: 1,
    backgroundColor: '#fff',
    alignItems: 'center',
    justifyContent: 'center',
  },
});

Package.json:

{
  "name": "loc_crash_test",
  "version": "1.0.0",
  "main": "node_modules/expo/AppEntry.js",
  "scripts": {
    "start": "expo start",
    "android": "expo start --android",
    "ios": "expo start --ios",
    "web": "expo start --web",
    "eject": "expo eject"
  },
  "dependencies": {
    "expo": "~44.0.0",
    "expo-localization": "~12.0.0",
    "expo-status-bar": "~1.2.0",
    "react": "17.0.1",
    "react-dom": "17.0.1",
    "react-native": "0.64.3",
    "react-native-web": "0.17.1"
  },
  "devDependencies": {
    "@babel/core": "^7.12.9"
  },
  "private": true
}

Issue Analytics

  • State:open
  • Created 2 years ago
  • Comments:15 (2 by maintainers)

github_iconTop GitHub Comments

5reactions
JouHouFincommented, Jan 16, 2022

Okay, seems that I found the problem.

In LocalizationModule.kt there is:

  • a function getConstants() which is returning Map<String, Any>.
  • in that function there is a HashMap: val constants = HashMap<String, Any>()
  • and assignment to that map: constants[key] = bundle[key] as Any

If I have understood Kotlin correctly by my Googlings today, Any cannot be assigned a null value, but region is in this locale (ie. Finnish) null.

By changing this…

override fun getConstants(): Map<String, **Any**> {
  val constants = HashMap<String, **Any**>()
  val bundle = bundledConstants
  for (key in bundle.keySet()) {
    constants[key] = bundle[key] as **Any**
  }
  return constants
}

to this…

override fun getConstants(): Map<String, **Any?**> {
  val constants = HashMap<String, **Any?**>()
  val bundle = bundledConstants
  for (key in bundle.keySet()) {
    constants[key] = bundle[key] as **Any?**
  }
  return constants
}

…the app launches without a problem. Now I have no Kotlin experience (besides today’s experiments), so someone else more experienced than me can say if those changes could have any side effects.

1reaction
Sheharyar566commented, Aug 24, 2022

The app crashes when added 13.1.0 as a dependency for SDK 46, but works fine when added 13.0.0

Read more comments on GitHub >

github_iconTop Results From Across the Web

Run a Robo test | Firebase Test Lab - Google
Robo test is a testing tool that is integrated with Firebase Test Lab. ... screenshots, and videos can help you determine the root...
Read more >
fails to build an (newly created) ejected expo project
I am trying to add react-native-firebase to a newly created expo project, I ejected the app successfully, but when I try to add...
Read more >
Test Robo Scripts Locally: Useful For Firebase Test Lab & Pre ...
I found the least known way to test robo scripts locally. So, the robo scripts that we have uploaded for the Google Play...
Read more >
Firebase Test Lab: using Robo Tests (Firecasts) - YouTube
In a previous episode of Firecasts (http://bit.ly/2Hc7FKq), Todd gave us an introduction to Firebase Test Lab, a cloud-based app - testing ...
Read more >
Firebase Test Lab launches full support for iOS, Robo ...
When Test Lab was originally launched with Firebase in 2016, it supported only Android devices. At Google I/O 2018 in May, Test Lab...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found