You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

React Native新手执行react-native run-android时遇启动错误码500求助

Fixing React Native run-android Error Code 500 with Intent { cmp=com.MainActivity }

Hey there! As someone who’s worked through plenty of React Native Android startup kinks, let’s get this sorted out for you. Even though your build succeeded, that error code 500 when launching the app usually points to an issue with how the app is being targeted or cached state. Here’s what to try:

  • Verify your MainActivity path in the Intent
    The error shows cmp=com.MainActivity—this is likely missing your project’s actual package name prefix. For example, if your project is named MyAwesomeApp, the correct Intent should be cmp=com.myawesomeapp.MainActivity. Check your android/app/src/main/AndroidManifest.xml to confirm the full package name for your MainActivity. You can also test launching the app manually by tapping its icon on the device/emulator; if it opens, the Intent path in the command is definitely the problem.

  • Clean and rebuild your Android project
    Cached build artifacts often cause weird startup glitches. Run these commands in order:

    cd android
    ./gradlew clean
    cd ..
    react-native run-android
    

    This wipes old build files and forces a fresh compile, which fixes many hidden issues.

  • Check your ADB connection
    Make sure your device or emulator is properly connected:

    • Run adb devices to confirm the device shows up with a device status (not unauthorized or offline).
    • If using an emulator, restart it; if using a physical device, re-plug the USB cable and double-check that USB debugging is enabled in developer options.
  • Restart the Gradle Daemon
    Even though the build succeeded, a wonky Gradle daemon might be causing post-build issues. Stop it with:

    cd android
    ./gradlew --stop
    

    Then run react-native run-android again to start fresh.

If none of these work, check your Logcat output (adb logcat) right after the error—this will show the exact exception that’s crashing the app on launch, which can point you to deeper issues like missing dependencies or misconfigured native modules.

内容的提问来源于stack exchange,提问作者gustavo delfim

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.19 03:41:40