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.

App wouldn't start with old code structure.

See original GitHub issue

Hi, @kanzitelli you have saved me from lot of troubles and i’m very grateful to u. Thank you for maintaining this starter kit. Here is my problem. After upgrading to the latest changes i can’t use this old following code structure. if i convert the old way to new way using ‘rnn-screens’ it works. but i have huge code base and conversion to ‘rnn-screens’ is not option for me right now. is there anyway i can run the app with the old following structure?

The error message says:

Invariant Violation: Module AppRegistry is not a registered callable module (calling runApplication). A frequent cause of the error is that the application entry file path is incorrect. This can also happen when the JS bundle is corrupt or there is an early initialization error when loading React Native., js engine: hermes

Possible Unhandled Promise Rejection (id: 0): TypeError: Cannot read property ‘screens’ of undefined TypeError: Cannot read property ‘screens’ of undefined

index.js

import 'react-native-gesture-handler';
import { Navigation } from 'react-native-navigation';
import { start } from './src/app';

Navigation.events().registerAppLaunchedListener(start);

./src/app


import {hydrateStores} from './stores';
import {initServices, services} from './services';
import {configureDesignSystem} from './utils/designSystem';

export const start = async (): PVoid => {
  const {nav, Noti} = services;

  // 1. hydrate stores
  await hydrateStores();

  // 2. configure design system
  configureDesignSystem();

  // 3. init services
  await initServices();

  // 4. start app
  nav.start();
};

./src/services/navigation/index.ts

start = async (): PVoid => {
    const token = await AsyncStorage.getItem('@token');
    token ? await this.startThreeTabsApp() : await this.startOneScreenApp();
    await this.getConstants(); // needs to be called after setRoot()
  };

private startOneScreenApp = async (): PVoid => {
    await Navigation.setRoot(Root(Stack(Component(screensLayouts.ScreenOne))));
  };

  private startThreeTabsApp = async (): PVoid => {
    await Navigation.setRoot(
      Root(
        BottomTabs([
          Stack(Component(screensLayouts.HomeScreen)),
          Stack(Component(screensLayouts.ScanScreen)),
          Stack(Component(screensLayouts.MailScreen)),
        ]),
      ),
    );
  };

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:11 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
kanzitellicommented, Sep 7, 2022

@Yasir5247 great to hear! probably it was a cache error or something. then I’m closing the issue.

0reactions
kanzitellicommented, Sep 25, 2022

Hi @Yasir5247! Well, it looks like you’ve done everything correct, but the script still can not be run because of the wrong directory. As I remember, this error Cannot run program "/home/expo/Android/Sdk/cmdline-tools/latest/bin/sdkmanager" comes from React Native Navigation app’s build.gradle file. You can check it here - https://github.com/wix/react-native-navigation/blob/master/lib/android/app/build.gradle#L176. What I would recommend is to change that directory manually to yours from node_modules of your project. And if that works, just create a patch file which will change it.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Visual Studio keeps running the old build - Stack Overflow
There are two things: 1) the debugging info being linked-in to the application, and 2) the way the application is started - either...
Read more >
Debug an app that isn't part of a Visual Studio solution
For an app that doesn't exist in Visual Studio, the usual way to debug is to start the app outside of Visual Studio,...
Read more >
Using the latest code signature format - Apple Developer
Apps signed with a previous signature format will not launch. Determine whether your app needs a new signature. This change to DER embeddded...
Read more >
Known issues with Android Studio and Android Gradle Plugin
Native debugger crashes with "Debugger process finished with exit code 127" ... This error occurs on Linux-based platforms when starting the native debugger....
Read more >
What To Do When Your Computer Won't Start ... - YouTube
In this tutorial I will show you how to help fix a computer that won't boot into Windows due to a BSOD, black...
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