Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

App crashes on launch immediately without any error log #41954

Closed
Vaib215 opened this issue Dec 15, 2023 · 18 comments
Closed

App crashes on launch immediately without any error log #41954

Vaib215 opened this issue Dec 15, 2023 · 18 comments
Labels
Needs: Repro This issue could be improved with a clear list of steps to reproduce the issue. Type: Upgrade Issue Issues reported from upgrade issue form

Comments

@Vaib215
Copy link

Vaib215 commented Dec 15, 2023

Old Version

0.72.3

New Version

0.73.0

Description

I upgraded all the libraries in my app and now when i run it in debug mode, it crashes immediately without any error log.

Here is my package.json:

{
  "name": "thefutureuniversity",
  "version": "0.0.1",
  "private": true,
  "scripts": {
    "cc": "rimraf node_modules/.cache/babel-loader/*,",
    "android": "react-native run-android",
    "ios": "react-native run-ios",
    "lint": "eslint .",
    "start": "react-native start",
    "test": "jest",
    "postinstall": "patch-package",
    "bundleRelease": "cd android && ./gradlew bundleRelease && cd ..",
    "assembleRelease": "cd android && ./gradlew assembleRelease && cd .."
  },
  "dependencies": {
    "@azure/core-asynciterator-polyfill": "^1.0.2",
    "@heroicons/react": "^2.0.18",
    "@livekit/react-native": "^1.4.1",
    "@livekit/react-native-webrtc": "^114.0.0",
    "@notifee/react-native": "^7.8.0",
    "@openspacelabs/react-native-zoomable-view": "^2.1.1",
    "@react-native-async-storage/async-storage": "^1.21.0",
    "@react-native-community/cli-plugin-metro": "^12.3.0",
    "@react-native-firebase/analytics": "^18.7.1",
    "@react-native-firebase/app": "^18.7.1",
    "@react-native-firebase/auth": "^18.7.1",
    "@react-native-firebase/messaging": "^18.7.1",
    "@react-native/metro-config": "^0.73.2",
    "@react-navigation/material-bottom-tabs": "^6.2.19",
    "@react-navigation/material-top-tabs": "^6.6.5",
    "@react-navigation/native": "^6.1.9",
    "@react-navigation/native-stack": "^6.9.17",
    "@sayem314/react-native-keep-awake": "^1.2.2",
    "@shopify/flash-list": "^1.6.3",
    "@types/react-native-snap-carousel": "^3.8.5",
    "appcenter": "5.0.0",
    "appcenter-analytics": "5.0.0",
    "appcenter-crashes": "5.0.0",
    "axios": "^1.4.0",
    "dayjs": "^1.11.7",
    "deprecated-react-native-prop-types": "^5.0.0",
    "jetifier": "^2.0.0",
    "mixpanel-react-native": "^2.3.1",
    "nativewind": "^2.0.11",
    "postcss": "^8.4.23",
    "react": "18.2.0",
    "react-hook-form": "^7.44.1",
    "react-native-appsflyer": "^6.12.2",
    "react-native-autolink": "^4.1.0",
    "react-native-code-push": "^8.1.0",
    "react-native-config": "^1.5.1",
    "react-native-confirmation-code-field": "^7.3.1",
    "react-native-gesture-handler": "^2.14.0",
    "react-native-image-picker": "^7.0.1",
    "react-native-keyboard-aware-scroll-view": "^0.9.5",
    "react-native-linear-gradient": "^2.8.2",
    "react-native-pager-view": "^6.2.0",
    "react-native-paper": "^5.11.4",
    "react-native-pip-android": "^1.0.1",
    "react-native-razorpay": "^2.3.0",
    "react-native-reanimated": "^3.6.1",
    "react-native-render-html": "^6.3.4",
    "react-native-responsive-screen": "^1.4.2",
    "react-native-safe-area-context": "^4.5.3",
    "react-native-screens": "^3.29.0",
    "react-native-share": "^10.0.2",
    "react-native-snap-carousel": "^3.9.1",
    "react-native-svg-transformer": "^1.2.0",
    "react-native-vector-icons": "^10.0.0",
    "react-native-webview": "^13.6.3",
    "react-native-youtube-iframe": "^2.3.0",
    "rn-fetch-blob": "^0.12.0",
    "sass": "^1.62.1",
    "swr": "^2.1.5",
    "text-encoding": "^0.7.0"
  },
  "devDependencies": {
    "@babel/core": "^7.20.0",
    "@babel/preset-env": "^7.20.0",
    "@babel/runtime": "^7.20.0",
    "@react-native-community/cli-platform-android": "^12.3.0",
    "@react-native-community/eslint-config": "^3.2.0",
    "@tsconfig/react-native": "^3.0.2",
    "@types/jest": "^29.2.1",
    "@types/node": "^20.2.5",
    "@types/react": "^18.0.24",
    "@types/react-native-countdown-component": "^2.7.0",
    "@types/react-native-vector-icons": "^6.4.13",
    "@types/react-test-renderer": "^18.0.0",
    "babel-jest": "^29.2.1",
    "eslint": "^8.19.0",
    "jest": "^29.2.1",
    "metro-react-native-babel-preset": "^0.77.0",
    "patch-package": "^8.0.0",
    "prettier": "^3.1.1",
    "react-native": "^0.73.0",
    "react-native-dotenv": "^3.4.8",
    "react-native-gradle-plugin": "^0.71.19",
    "react-test-renderer": "18.2.0",
    "tailwindcss": "^3.3.2",
    "typescript": "^5.3.3"
  },
  "jest": {
    "preset": "react-native"
  }
}

Here is build.gradle
// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
ext {
buildToolsVersion = "33.0.0"
minSdkVersion = 21
compileSdkVersion = 33
targetSdkVersion = 33
kotlinVersion = "1.8.0"

    // We use NDK 23 which has both M1 support and is the side-by-side NDK version from AGP.
    ndkVersion = "23.1.7779620"
}
repositories {
    google()
    mavenCentral()
}
dependencies {
    classpath("com.android.tools.build:gradle:7.2.2")
    classpath("com.facebook.react:react-native-gradle-plugin")
    classpath("com.google.gms:google-services:4.3.15")
}

}

Steps to reproduce

Install dependencies
Run the app

Affected Platforms

Runtime - Android, Build - MacOS

Output of npx react-native info

info Fetching system and libraries information...
System:
  OS: macOS 14.1.2
  CPU: (8) arm64 Apple M1
  Memory: 164.72 MB / 8.00 GB
  Shell:
    version: "5.9"
    path: /bin/zsh
Binaries:
  Node:
    version: 20.7.0
    path: /opt/homebrew/bin/node
  Yarn: Not Found
  npm:
    version: 10.1.0
    path: /opt/homebrew/bin/npm
  Watchman: Not Found
Managers:
  CocoaPods: Not Found
SDKs:
  iOS SDK: Not Found
  Android SDK:
    API Levels:
      - "29"
      - "31"
      - "33"
      - "34"
    Build Tools:
      - 30.0.3
      - 33.0.0
      - 34.0.0
    System Images:
      - android-34 | Google APIs ARM 64 v8a
    Android NDK: Not Found
IDEs:
  Android Studio: 2022.3 AI-223.8836.35.2231.10811636
  Xcode:
    version: /undefined
    path: /usr/bin/xcodebuild
Languages:
  Java:
    version: 17.0.9
    path: /usr/bin/javac
  Ruby:
    version: 2.6.10
    path: /usr/bin/ruby
npmPackages:
  "@react-native-community/cli": Not Found
  react:
    installed: 18.2.0
    wanted: 18.2.0
  react-native:
    installed: 0.73.0
    wanted: ^0.73.0
  react-native-macos: Not Found
npmGlobalPackages:
  "*react-native*": Not Found
Android:
  hermesEnabled: true
  newArchEnabled: false
iOS:
  hermesEnabled: Not found
  newArchEnabled: false


### Stacktrace or Logs

```text
> Task :app:installDebug
Installing APK 'app-debug.apk' on 'Resizable_Experimental_API_34(AVD) - 14' for :app:debug
Installed on 1 device.

Deprecated Gradle features were used in this build, making it incompatible with Gradle 8.0.

You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.

See https://docs.gradle.org/7.5.1/userguide/command_line_interface.html#sec:command_line_warnings

BUILD SUCCESSFUL in 29s
574 actionable tasks: 15 executed, 559 up-to-date
info Connecting to the development server...
info Starting the app on "emulator-5554"...
Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] cmp=university.thefuture/.MainActivity }
 BUNDLE  ./index.js 

 BUNDLE  ./index.js 

 BUNDLE  ./index.js 



### Reproducer

Unable to reproduce

### Screenshots and Videos

_No response_
@Vaib215 Vaib215 added Needs: Triage 🔍 Type: Upgrade Issue Issues reported from upgrade issue form labels Dec 15, 2023
Copy link

⚠️ Missing Reproducible Example
ℹ️ We could not detect a reproducible example in your issue report. Please provide either:
  • If your bug is UI related: a Snack
  • If your bug is build/update related: use our Reproducer Template. A reproducer needs to be in a GitHub repository under your username.

@github-actions github-actions bot added the Needs: Repro This issue could be improved with a clear list of steps to reproduce the issue. label Dec 15, 2023
@Vaib215
Copy link
Author

Vaib215 commented Dec 15, 2023

unable to create a repro

@github-actions github-actions bot added Needs: Attention Issues where the author has responded to feedback. and removed Needs: Author Feedback labels Dec 15, 2023
@Vaib215
Copy link
Author

Vaib215 commented Dec 15, 2023

The app works fine in release mode but fails in debug mode

@hamzakashifCL
Copy link

same is happening with me

@IslamRustam
Copy link

IslamRustam commented Dec 18, 2023

Did you check logs in Android Studio's Logcat? I often do that when Metro doesn't show any logs during crashes. 99.9% chance you will see some useful log in Logcat that explains why the app crashes.

@marijache
Copy link

marijache commented Dec 19, 2023

Having the same issue after upgrade from 0.71.7. I followed all the instructions from https://react-native-community.github.io/upgrade-helper/?from=0.71.7&to=0.73.1

In Logcat I see this exception

java.lang.RuntimeException: Unable to instantiate application com.tst.MainApplication package com.tst: java.lang.ClassNotFoundException: Didn't find class "com.tst.MainApplication" on path: DexPathList

My AndroidManifest.xml

<manifest xmlns:android="http://schemas.android.com/apk/res/android">

    <uses-permission android:name="android.permission.INTERNET" />

    <application
      android:name=".MainApplication"
      android:label="@string/app_name"
      android:icon="@mipmap/ic_launcher"
      android:roundIcon="@mipmap/ic_launcher_round"
      android:allowBackup="false"
      android:theme="@style/AppTheme"
      android:usesCleartextTraffic="true">
      <activity
        android:name=".MainActivity"
        android:label="@string/app_name"
        android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|screenSize|smallestScreenSize|uiMode"
        android:launchMode="singleTask"
        android:windowSoftInputMode="adjustResize"
        android:exported="true">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
      </activity>
    </application>
</manifest>

@supriyoMondal
Copy link

Probably you missed something in MainApplication.java , probably a small typo. open this file in android studio for recheck , also check for typos in debug/AndroidManifest.xml

@AliRezaBeigy
Copy link

check you have already apply Kotlin plugin in app/gradle.build

apply plugin: "org.jetbrains.kotlin.android"

@cortinico
Copy link
Contributor

@Vaib215 We can't help without a repro or a log of any sort sadly.

@cortinico cortinico removed Needs: Triage 🔍 Needs: Attention Issues where the author has responded to feedback. labels Dec 27, 2023
@omaranwaar
Copy link

omaranwaar commented Jan 16, 2024

@marijache Hello, did you fix this? I am getting the same crash and same error in logcat. Trying to update my rn version from 0.72.3 to 0.73.2

@Cheizr
Copy link

Cheizr commented Jan 19, 2024

@marijache Hello, did you fix this? I am getting the same crash and same error in logcat. Trying to update my rn version from 0.72.3 to 0.73.2

  • Added plugin in app/gradle.build
    apply plugin: "org.jetbrains.kotlin.android"
  • cleaned gradlew

I'm having the same issue, i upgraded to 0.73.2 from 0.72, upgraded the project to gradle 8.1.1.

My app build is Successfull but the app crash when i open it

@timothyerwin
Copy link

I have the exact same issue. Upgraded to 0.73 and followed the upgrade diffs. Works fine on iOS and crashes immediately on launch with Android.

@timothyerwin
Copy link

I have the exact same issue. Upgraded to 0.73 and followed the upgrade diffs. Works fine on iOS and crashes immediately on launch with Android.

I solved it. For anyone else looking for this I accidentally left the wrong package in the top of MainActivity.kt

You can take the logs from here and paste it into ChatGPT if you need more help.

adb logcat | grep com.yourpackage

@anatooly
Copy link

anatooly commented Feb 7, 2024

check you have already apply Kotlin plugin in app/gradle.build

apply plugin: "org.jetbrains.kotlin.android"

Very thanks, this help me after upgrade RN 0.72-0.73, app build but crash on Android after start.

@asusoft
Copy link

asusoft commented Mar 20, 2024

I solved it by commenting out this line: //ReactNativeFlipper.initializeFlipper(this, getReactNativeHost().getReactInstanceManager()); from MainApplication.java

@Essam-Harrous
Copy link

Hey guys this might help someone else in future.
I faced this bug after upgrading from 0.72.x to 0.73.6.
in /SwarPay/MainActivity.kt, you have to change the first line package com.rndiffapp to your package name.

@HXLH50K
Copy link

HXLH50K commented Aug 24, 2024

Hey guys this might help someone else in future. I faced this bug after upgrading from 0.72.x to 0.73.6. in /SwarPay/MainActivity.kt, you have to change the first line package com.rndiffapp to your package name.

Also MainApplication.kt

@Mizile
Copy link

Mizile commented Nov 10, 2024

I solved it by commenting out this line: //ReactNativeFlipper.initializeFlipper(this, getReactNativeHost().getReactInstanceManager()); from MainApplication.java

From my own experience, what I realized is that if this issue is fixed by commenting out ReactNativeFlipper as the above solution suggested, it means that ReactNativeFlipper is pointing to the wrong package name (or application Id).

You'd need to open android\app\src\debug\java\com\appname\ReactNativeFlipper.java and ensure that the first line package com.example; is set to the correct name of your app.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Needs: Repro This issue could be improved with a clear list of steps to reproduce the issue. Type: Upgrade Issue Issues reported from upgrade issue form
Projects
None yet
Development

No branches or pull requests