Debugging Native Code
Accessing Logs
You can display the native logs for an iOS or Android app by using the following commands in a terminal while the app is running:
# For Android:
npx react-native log-android
# Or, for iOS:
npx react-native log-ios
You may also access these through Debug > Open System Log… in the iOS Simulator or by running adb logcat "*:S" ReactNative:V ReactNativeJS:V in a terminal while an Android app is running on a device or emulator.
💡 Custom Native Logs
If you are writing a Native Module and want to add custom logs to your module for debugging purposes, you can use the following method:
Android (Java/Kotlin)
In your native module, use the Log class to add logs that can be viewed in Logcat:
Java
import android.util.Log;