DEV Community

Tulio Calil
Tulio Calil

Posted on

React Native Debugging Native Code

In the world of React Native development, a single debugging tip can make all the difference. Join us as we uncover a valuable insight to streamline your debugging process. This tip will save you time and ensure your apps run smoothly. Let's dive right in!

So run your application using the React Native CLI and attach the native debugger of the native IDE (Android Studio or Xcode) to the process.

Android Studio

On Android Studio you can do this by going on the "Run" option on the menu bar, clicking on "Attach to Process..." and selecting the running React Native app.

Android Debugging attach process

Xcode

On Xcode click on "Debug" on the top menu bar, select the "Attach to process" option, and select the application in the list of "Likely Targets".

Xcode debugging attach process

Now you can put breaking points in your native code and tada 🥳!

I added these instructions in the React Native official docs too you can check the PR status here.

Follow-me for more content about React Native.

Top comments (4)

Collapse
 
harshaart profile image
Harsha S

As a react native developer, do you think react native is the future of mobile dev? or will android studio's java and Kotlin still remain as the go-to in the future for faster native apps?

Collapse
 
tuliocalil profile image
Tulio Calil

I think that react native is an excellent way to build mobile apps, we are so close to native code and native performance, and at the same time, we have all the javascript resources (ecma features, npm, community, etc).
The developer experience is really good with RN.

Collapse
 
harshaart profile image
Harsha S

So you think android studio's java and Kotlin would go obsolete in the future?

Thread Thread
 
tuliocalil profile image
Tulio Calil

I don't know, sometimes I think that not, we still have companies that choose native code over cross-platform and we still need native code in some specific cases like a security SDK or integration with some module. It's so delicate to say