Skip to content

[3.0.6] Crashes on Android #124

Description

@joncursi

3.0.1 works on Android, but 3.0.6 causes an immediate crash. I can't even open the app, it just pops up the crash alert. Logs don't show anything useful, either:

$ react-native log-android
Scanning folders for symlinks in /Users/joncursi/Sites/joncursi/redbird-native/node_modules (29ms)
Starting the logger (/Users/joncursi/Library/Android/sdk/platform-tools/adb logcat *:S ReactNative:V ReactNativeJS:V)...
--------- beginning of main
--------- beginning of system
11-09 15:30:00.726  3099  3099 D ReactNative: [CodePush] Loading JS bundle from "assets://index.android.bundle"
11-09 15:30:00.727  3099  3099 D ReactNative: ReactInstanceManager.ctor()
--------- beginning of crash
11-09 15:30:50.816  3511  3511 D ReactNative: [CodePush] Loading JS bundle from "assets://index.android.bundle"
11-09 15:30:50.817  3511  3511 D ReactNative: ReactInstanceManager.ctor()

Activity

  1. shifeng1993 commented on Nov 10, 2017

    @shifeng1993

    Me too

  2. 3210jr commented on Nov 10, 2017

    @3210jr

    Experiencing the same issue... @joncursi are you using react-native-navigator?

  3. joncursi commented on Nov 10, 2017

    @joncursi
    Author

    No I’m using react-navigation

  4. payen83 commented on Nov 11, 2017

    @payen83

    I'm having the same problem. Any solution to this?

  5. ligongxiang commented on Nov 13, 2017

    @ligongxiang

    yes,I have a same problem

  6. ryam4u commented on Nov 13, 2017

    @ryam4u

    this is solved by creating the file: android/app/src/main/res/values/colors.xml
    <?xml version="1.0" encoding="utf-8"?> <resources> <color name="primary_dark"><!-- Colour of your status bar here --></color> </resources>

  7. AmandeepSingh06 commented on Nov 13, 2017

    @AmandeepSingh06

    Even I am finding a crash on app launch. This is the log I am getting

    Caused by: java.lang.UnsupportedOperationException: Can't convert to color: type=0x1
    at android.content.res.TypedArray.getColor(TypedArray.java:451)
    at com.android.internal.policy.PhoneWindow.generateLayout(PhoneWindow.java:3777)
    at com.android.internal.policy.PhoneWindow.installDecor(PhoneWindow.java:3981)
    at com.android.internal.policy.PhoneWindow.setContentView(PhoneWindow.java:383)
    at android.app.Dialog.setContentView(Dialog.java:512)
    at org.devio.rn.splashscreen.b$1.run(SplashScreen.java:32)

  8. ryam4u commented on Nov 13, 2017

    @ryam4u

    @AmandeepSingh06 yes, that is the error, it is solved by adding the file: android/app/src/main/res/values/colors.xml

  9. celodauane commented on Nov 14, 2017

    @celodauane

    @ryam4u that also worked for me. I could not leave the color as an empty string so I added a transparent status bar.

    I ended up with the in my android/app/src/main/res/values/colors.xml:

    <?xml version="1.0" encoding="utf-8"?> <resources> <color name="primary_dark">#00ffffff</color> </resources>

  10. payen83 commented on Nov 15, 2017

    @payen83

    @dauane Thank you. Your solution works for me.

  11. edo1493 commented on Nov 17, 2017

    @edo1493

    Same here.

  12. yewenxiang23 commented on Nov 30, 2017

    @yewenxiang23

    @ryam4u thank you Your solution suits me.

  13. elribonazo commented on Dec 6, 2017

    @elribonazo

    Thanks for the workarround, +1.

  14. BenFausch commented on Jan 5, 2018

    @BenFausch

    I just lost so much time because of this bug, thanks for the help guys, and @crazycodeboy please update your README!

  15. ABKZR commented on Jan 8, 2018

    @ABKZR

    C:\Project\Login_Page>react-native log-android
    Scanning folders for symlinks in C:\Project\Login_Page\node_modules (40ms)
    Starting the logger (c:\Users\Abkzr\AppData\Local\Android\Sdk/platform-tools/adb logcat *:S ReactNative:V ReactNativeJS:V)...
    --------- beginning of system
    --------- beginning of main
    --------- beginning of crash
    01-07 18:24:03.636 3155 3155 D ReactNative: ReactInstanceManager.ctor()
    01-07 18:24:03.939 3155 3155 D ReactNative: ReactInstanceManager.createReactContextInBackground()
    01-07 18:24:03.939 3155 3155 D ReactNative: ReactInstanceManager.recreateReactContextInBackgroundInner()
    01-07 18:24:03.999 3155 3155 D ReactNative: ReactInstanceManager.onJSBundleLoadedFromServer()
    01-07 18:24:04.000 3155 3155 D ReactNative: ReactInstanceManager.recreateReactContextInBackground()
    01-07 18:24:04.000 3155 3155 D ReactNative: ReactInstanceManager.runCreateReactContextOnNewThread()
    01-07 18:24:04.078 3155 3177 D ReactNative: ReactInstanceManager.createReactContext()
    01-07 18:24:05.180 3155 3177 D ReactNative: Initializing React Xplat Bridge.
    01-07 18:24:05.194 3155 3177 D ReactNative: Initializing React Xplat Bridge before initializeBridge
    01-07 18:24:05.264 3155 3177 D ReactNative: Initializing React Xplat Bridge after initializeBridge
    01-07 18:24:05.339 3155 3177 D ReactNative: CatalystInstanceImpl.runJSBundle()
    01-07 18:24:05.363 3155 3184 D ReactNative: ReactInstanceManager.setupReactContext()
    01-07 18:24:05.363 3155 3184 D ReactNative: CatalystInstanceImpl.initialize()
    01-07 18:24:05.381 3155 3184 D ReactNative: ReactInstanceManager.attachRootViewToInstance()
    01-07 18:24:07.032 3155 3183 I ReactNativeJS: Running application "Login" with appParams: {"rootTag":1}. DEV === true, development-level warning are ON, performance optimizations
    are OFF
    01-07 18:28:47.897 3155 3183 E ReactNativeJS: Hot loading isn't working because it cannot connect to the development server.
    01-07 18:28:47.897 3155 3183 E ReactNativeJS:
    01-07 18:28:47.897 3155 3183 E ReactNativeJS: Try the following to fix the issue:
    01-07 18:28:47.897 3155 3183 E ReactNativeJS: - Ensure that the packager server is running and available on the same network
    01-07 18:28:47.897 3155 3183 E ReactNativeJS: - Ensure that your device/emulator is connected to your machine and has USB debugging enabled - run 'adb devices' to see a list of connec
    ted devices
    01-07 18:28:47.897 3155 3183 E ReactNativeJS: - If you're on a physical device connected to the same machine, run 'adb reverse tcp:8081 tcp:8081' to forward requests from your device
    01-07 18:28:47.897 3155 3183 E ReactNativeJS: - If your device is on the same Wi-Fi network, set 'Debug server host & port for device' in 'Dev settings' to your machine's IP address a
    nd the port of the local dev server - e.g. 10.0.1.1:8081
    01-07 18:28:47.897 3155 3183 E ReactNativeJS:
    01-07 18:28:47.897 3155 3183 E ReactNativeJS: URL: 10.0.2.2:8081
    01-07 18:28:47.897 3155 3183 E ReactNativeJS:
    01-07 18:28:47.897 3155 3183 E ReactNativeJS: Error: recvfrom failed: ECONNRESET (Connection reset by peer)
    01-07 18:28:48.010 3155 3155 D ReactNative: ReactInstanceManager.detachViewFromInstance()
    01-08 12:08:12.824 4271 4271 D ReactNative: ReactInstanceManager.ctor()
    01-08 12:08:12.873 4271 4271 D ReactNative: ReactInstanceManager.createReactContextInBackground()
    01-08 12:08:12.873 4271 4271 D ReactNative: ReactInstanceManager.recreateReactContextInBackgroundInner()
    01-08 12:09:35.347 4271 4271 D ReactNative: ReactInstanceManager.onJSBundleLoadedFromServer()
    01-08 12:09:35.347 4271 4271 D ReactNative: ReactInstanceManager.recreateReactContextInBackground()
    01-08 12:09:35.347 4271 4271 D ReactNative: ReactInstanceManager.runCreateReactContextOnNewThread()
    01-08 12:09:35.373 4271 4294 D ReactNative: ReactInstanceManager.createReactContext()
    01-08 12:09:35.488 4271 4294 D ReactNative: Initializing React Xplat Bridge.
    01-08 12:09:35.550 4271 4294 D ReactNative: Initializing React Xplat Bridge before initializeBridge
    01-08 12:09:35.568 4271 4294 D ReactNative: Initializing React Xplat Bridge after initializeBridge
    01-08 12:09:35.569 4271 4294 D ReactNative: CatalystInstanceImpl.runJSBundle()
    01-08 12:09:35.571 4271 4298 D ReactNative: ReactInstanceManager.setupReactContext()
    01-08 12:09:35.571 4271 4298 D ReactNative: CatalystInstanceImpl.initialize()
    01-08 12:09:35.591 4271 4298 D ReactNative: ReactInstanceManager.attachRootViewToInstance()
    01-08 12:09:35.970 4271 4297 I ReactNativeJS: Running application "Laptop" with appParams: {"rootTag":1}. DEV === true, development-level warning are ON, performance optimizations
    are OFF
    01-08 12:10:51.295 4271 4271 D ReactNative: ReactInstanceManager.detachViewFromInstance()

    help me android crashed

  16. bjonamu commented on Jul 24, 2019

    @bjonamu

    My MainActivity.java is totally different

    public class MainActivity extends ReactActivity {
    
      @Override
      protected ReactActivityDelegate createReactActivityDelegate() {
        return new ReactActivityDelegate(this, getMainComponentName()) {
          @Override
          protected ReactRootView createRootView() {
           return new RNGestureHandlerEnabledRootView(MainActivity.this);
          }
        };
      }
    
      /**
        * Returns the name of the main component registered from JavaScript.
        * This is used to schedule rendering of the component.
        */
      @Override
      protected String getMainComponentName() {
          return "AppName";
      }
    }
    

    Am I to remove the createReactActivityDelegate method in favour of onCreate? It doesn't seem like they can co-exist.

  17. bjonamu commented on Jul 24, 2019

    @bjonamu

    For me replacing createReactActivityDelegate method in with an onCreate method worked.

  18. devonwesley commented on Dec 26, 2019

    @devonwesley

    For me I spelled lauch_screen.xml instead launch and also, I needed all of the drawable-folder.

  19. rohitsingh2410 commented on May 11, 2022

    @rohitsingh2410

    any update on this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions