0

When trying to run application written in react-native I've got this errors. Can't google anything like it. The same errors either from android studio in emulator or after using "npx react-native run-android"

UPD. So the solution is to regenerate file index.android.bundle Full description I've found here - https://medium.com/@adityasingh_32512/solved-unable-to-load-script-from-assets-index-android-bundle-bdc5e3a3d5ff

The main command is

react-native bundle --platform android --dev false --entry-file index.js --bundle-output android/app/src/main/assets/index.android.bundle --assets-dest android/app/src/main/res

Error code originally I've got:

E/unknown:ReactNative: Exception in native call from JS
    com.facebook.react.devsupport.JSException: Can't find variable: MapPage
        at com.facebook.react.bridge.queue.NativeRunnable.run(Native Method)
        at android.os.Handler.handleCallback(Handler.java:907)
        at android.os.Handler.dispatchMessage(Handler.java:99)
        at com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage(MessageQueueThreadHandler.java:27)
        at android.os.Looper.loop(Looper.java:216)
        at com.facebook.react.bridge.queue.MessageQueueThreadImpl$4.run(MessageQueueThreadImpl.java:226)
        at java.lang.Thread.run(Thread.java:923)
     Caused by: com.facebook.jni.CppException: Can't find variable: MapPage

    c@index.android.bundle:25:260
    index.android.bundle:24:60
    v@index.android.bundle:2:1474
    index.android.bundle:146:70
    v@index.android.bundle:2:1474
    index.android.bundle:91:132
    v@index.android.bundle:2:1474
    d@index.android.bundle:2:876
    global code@index.android.bundle:439:4
        ... 7 more
  • maybe you used `MapPage` in your code – Shing Ho Tan Apr 20 '20 at 15:05
  • Only place where I can found it it is here ...\android\app\src\main\assets\index.android.bundle [code]__d(function(g,r,i,a,m,e,d){'use strict';var n=r(d[0])(r(d[1])),t=r(d[2]),o=r(d[3]),s=new MapPage,c={isBoldTextEnabled:function(){return Promise.resolve(!1)},isGrayscaleEnabled:function(){return .... [/code] Smth autocreated? – Igor Paikin Apr 20 '20 at 15:08
  • what is your rn version? how do you have index.android.bundle? – Shing Ho Tan Apr 20 '20 at 15:12
  • I have in package.json -> "react-native": "^0.62.2", index.android.bundle I think is auto generated file. The most strange thing that I can create aab bundle and put into the android market and it works. Smth happens when I take androind studio to build – Igor Paikin Apr 21 '20 at 09:19
  • @DevLover I've deleted the whole project, take it again from git. them I've run npm install npm start npx react-native run-android App appears on the phone with the same error. I'm runinng it on windows, other developer use linux and he didn't got this error. (only from android studio) – Igor Paikin Apr 21 '20 at 09:44

0 Answers0