App stops when run sometimes.

  Expo CLI 3.11.7 environment info:
      OS: Windows 10
      npm: 6.13.4 - C:\Program Files\nodejs\npm.CMD
      Android Studio: Version AI-191.8026.42.35.5977832

App stops when load sometimes.

source code: GitHub - hsk-kr/plan-manager: Mobile App for management your daily plans. written RN.

I’m going to write down here everything that I did.

I was developing an app with Expo. I finished my app and I was preparing for publishing to the google play store.
I made apk file using a command expo build:android -t. and I uploaded the apk file to the google console. and an error’d shown on the page that needs permissions for the app.

    "android": {
      "permissions": [

I 'd set up above and I tried to re-upload. and there was an error that versionCode is one is the same before.

    "android": {
      "versionCode": 2,
      "permissions": [

so I added ‘versionCode’ to the android object.
And I did re-build using a command ‘expo build:android -t apk’.
and I uploaded the apk file to my google drive. and I installed it to my phone then I executed it before publishing.

But The app’d been stopped while loading.
My loading code composed like this.

import React, { useState, useEffect } from 'react';
import AppNavigator from '../../navigators/AppNavigator';
import Loading from '../../components/Loading';

function Main() {
  const [isLoading, load] = useState(true);

  useEffect(() => {
  }, []);

  if (isLoading) {
    return <Loading />
  } else {
    return <AppNavigator />

export default Main;
import React from 'react';
import configureStore from './redux/configureStore';
import { Provider } from 'react-redux';
import { PersistGate } from 'redux-persist/es/integration/react';
import Loading from './components/Loading';
import Main from './containers/Main';

export default function App() {

  const { store, persistor } = configureStore();

  return (
    <Provider store={store}>
        loading={<Loading />}
        <Main />

I replaced Main tag to a text tag. and error was the same.
I expected that the error is in the Loading Component.

Loading Component used redux states. so I removed the code.
And error’d gone.

I replaced a text tag to the Main tag again.
I ran and app’d been stopped after loading AGAIN.

My app supports dynamic styles(theme) and language.
But I implemented them in a weirdest way.

My code tried to

// ...

// A string variable for theme. If this is 'undefined', theme uses to default theme.
let themeName = undefined;
let styles = require('./styles').default(theme, themeName); // get styles depend on theme.

function PlanHistory(props) {
  // update theme
  useEffect(() => {
    themeName = props.settings.theme;
    styles = require('./styles').default(theme, themeName);

      headerTitleColor: theme(themeName).headerTitle,
      headerBackgroundColor: theme(themeName).headerBackground,
      shown: true
  }, [props.settings.theme]);

  // change header title to appropriate title depends on language
  useEffect(() => {
      title: t('HEADER_TITLE')
  }, [props.settings.language]);

I think you wouldn’t understand it. don’t worry. that’s normal.
PlanListContainer is the first component that shown to users.
I made that PlanList render a simple text.
And error’d gone again.
I thought dynamic styles system is the problem.
And I searched for that. and I figured out that JSON also can be used of styles. and actually, I should’d been used JSON instead of StyleSheet. because I had to change styles dynamically.

I changed StyleSheet to the normal JSON.
And App ran successfully. I closed the app and re-open a few times.
And error’d shown up again. ha…

I gave up. this is my first expo app and I think I didn’t have experiences much yet. and I felt testing is most important for developing an application.

The bug occurs once per twenty times when run the app.
Anyway, If you have any doubts of the bug. please, let me know.

Thank you for reading it.
and I’m sorry for my English. genuinely, I got negative points from stackoverflow because of my English. I can’t ask it again in stackoverflow. :((
Anyway, I hope the bug can be figured.


What us the error you get? You might need to run adb logcat to see the error message.

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