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.

Dev mode trying to find /index.android.bundle (Unable to resolve module `./index.android` from ``)

See original GitHub issue

Hello,

I upgraded from RN 0.59.9 to 0.61.0.rc3.

On Android, when I compile the app (after yarn install and cleaning the Android project), I have a red crash error saying :

Error: Unable to resolve module `./index.android` from ``:

None of these files exist:
  * index.android(.native|.android.js|.native.js|.js|.android.json|.native.json|.json|.android.ts|.native.ts|.ts|.android.tsx|.native.tsx|.tsx|.android.svg|.native.svg|.svg)
  * index.android/index(.native|.android.js|.native.js|.js|.android.json|.native.json|.json|.android.ts|.native.ts|.ts|.android.tsx|.native.tsx|.tsx|.android.svg|.native.svg|.svg)
    at ModuleResolver.resolveDependency (/Users/jbchauvin1/Documents/Projets/Santoyamo/Cegedim/new/Mobile/app-dev/node_modules/metro/src/node-haste/DependencyGraph/ModuleResolution.js:163:15)
    at ResolutionRequest.resolveDependency (/Users/jbchauvin1/Documents/Projets/Santoyamo/Cegedim/new/Mobile/app-dev/node_modules/metro/src/node-haste/DependencyGraph/ResolutionRequest.js:52:18)
    at DependencyGraph.resolveDependency (/Users/jbchauvin1/Documents/Projets/Santoyamo/Cegedim/new/Mobile/app-dev/node_modules/metro/src/node-haste/DependencyGraph.js:282:16)
    at /Users/jbchauvin1/Documents/Projets/Santoyamo/Cegedim/new/Mobile/app-dev/node_modules/metro/src/lib/transformHelpers.js:267:42
    at Server.<anonymous> (/Users/jbchauvin1/Documents/Projets/Santoyamo/Cegedim/new/Mobile/app-dev/node_modules/metro/src/Server.js:1088:41)
    at Generator.next (<anonymous>)
    at asyncGeneratorStep (/Users/jbchauvin1/Documents/Projets/Santoyamo/Cegedim/new/Mobile/app-dev/node_modules/metro/src/Server.js:99:24)
    at _next (/Users/jbchauvin1/Documents/Projets/Santoyamo/Cegedim/new/Mobile/app-dev/node_modules/metro/src/Server.js:119:9)

And my app/build.gradle :

project.ext.react = [
    entryFile: "index.js",
    bundleAssetName: "index.android.bundle",
    bundleInDebug: false,
    bundleInRelease: true,
    enableHermes: false,  // clean and rebuild if changing
]

React Native version: 0.61 RC 3

Steps To Reproduce

  1. react-native run-android
  2. Red crash error…

Describe what you expected to happen: I would like to see the Android app without any problems. That’s weird, I don’t understand why it’s trying to load the index.android.bundle file.

Thanks for the help

Issue Analytics

  • State:open
  • Created 4 years ago
  • Reactions:5
  • Comments:15

github_iconTop GitHub Comments

4reactions
tsehiumingcommented, Sep 16, 2019

Hi JB-CHAUVIN, Came across the exact same issue this morning, here is my steps to solve the issue

  1. Remove the bundleAssetName from project.ext.react (in app/build.gradle)
project.ext.react = [
    entryFile: "index.js",
    enableHermes: false,  // clean and rebuild if changing
]
  1. Please make sure the function getJSMainModuleName() exist in MainApplication.java
public class MainApplication extends Application implements ReactApplication {

  private final ReactNativeHost mReactNativeHost = new ReactNativeHost(this) {
    @Override
    public boolean getUseDeveloperSupport() {
      return BuildConfig.DEBUG;
    }

    @Override
    protected List<ReactPackage> getPackages() {
      @SuppressWarnings("UnnecessaryLocalVariable")
      List<ReactPackage> packages = new PackageList(this).getPackages();
      // Packages that cannot be autolinked yet can be added manually here, for example:
      // packages.add(new MyReactNativePackage());
      return packages;
    }

    @Override
    protected String getJSMainModuleName() {
      return "index";
    }
  };
1reaction
unpokolokkocommented, Aug 12, 2020

solution by @tsehiuming solve my problem. i missed out

@Override
    protected String getJSMainModuleName() {
      return "index";
    }

in my MainApplication.java

Read more comments on GitHub >

github_iconTop Results From Across the Web

Ask Question - Stack Overflow
It's throwing error because it's not able to find index.android file in your root directory of project , if you have index.ios in...
Read more >
React Native: Unable to load script: index. android.bundle
Step 1: I am using React Native version 0.63.2 like below, and I want to build an android app by using Fastlane for...
Read more >
Integration with Existing Apps - React Native
With a few steps, you can add new React Native based features, screens, views, etc. The specific steps are different depending on what...
Read more >
Troubleshooting | React Navigation
If the module points to an npm package (i.e. the name of the module doesn't with ./ ), then it's probably due to...
Read more >
Troubleshooting build errors and crashes - Expo Documentation
For example, you might see something like this on your Android builds: Terminal ... Metro encountered an error: Unable to resolve module ....
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