Skip to content
This repository has been archived by the owner on Apr 20, 2022. It is now read-only.

Latest commit

 

History

History
69 lines (35 loc) · 3.79 KB

DEBUGGING_TOOLS_ANDROID.md

File metadata and controls

69 lines (35 loc) · 3.79 KB

Debugging Tools and Tips

Go back to Readme Home

Debugging react-native Android:

Open Android Studio, by selecting the android dir within the WeVoteReactNative dir.

Android Studio is not useful for the JavaScript part, only for the Java native code, packing, simulator launching, and viewing of logs for the app.

You need to get a simulator running before going much further. I used AMD, the free one that comes from Facebook then later used Genymotion. And Nuclide is no longer available for react-native.
As of October 2, 2017 don't choose the latest 8.0 Nougat, instead use 7.1 Nougat -- react-native-oauth has a problem with 8.0.

If you run into compile issues, see the Android Cheat Sheet Wiki Page

In the Android simulator press ⌘+M to get the simulator debugger window (use ⌘+D for the iOS simulator)

alt text

Once the simulator is running, and you have the JavaScript packager running on port 8081, you should see the app in the simulator. After pressing ⌘+M, click "Remote JS Debugging" in Android simulator, if the chrome tools are not already launched, you may have to launch them yourself http://localhost:8081/debugger-ui

This will open a Chrome dev tools browser debugger:

alt text

Click "⌘+⌥+j" to open the developer log. Then click on the "console" log to view the logging from the app.
Then you should see the debuggerWorker.js in the Sources pane, click through to find your source files and apply breakpoints as needed.

HTTP/Ajax/XHR requests are hard to debug in simulators, since the requests go through proxy simulators. In src/js/config.js if you enable LOG_NATIVE_HTTP_REQUESTS to true, much of the request info will end up in the console log in the debugger.

Some Useful Articles

react-native getting-started.html

https://medium.com/@vinceyuan/react-native-debugging-tools-3a24e4e40e4

medium.com react-native-my-developer-guide-to-configure-build-and-publish-using-mac-for-android

medium.com running-react-native-app-on-the-android-emulator

Some pictures of a working Android Studio setup

alt text

alt text

alt text

alt text

alt text

alt text


Next: Issues and Reporting Bugs

Go back to Readme Home