简体   繁体   中英

How to debug the android app in emulator/device on react native 0.62.0?

I have updated my react native app to version 0.62.0 from 0.59.0 some time ago. I am able to debug the app on ios simulator and device but not able to get the in app developer menu on android by pressing the command+m key for emulator and device (on shaking the device). While updating I skipped the code for Flipper which is a new debugging tool that comes by default with RN 0.62.0. I am also not able to see the change in app when I run the app from Android Studio.

Is it not possible to use the shake gesture feature or debug the app without Flipper on Android?

I found the solution, MainApplication.java file contained this import statement import com.facebook.react.BuildConfig;which is not needed. The BuildConfig.java should be pulled from android/app/build/generated/source/buildConfig/debug/[your]/[package]/[name]/BuildConfig.java instead, which is imported automatically when the project is build/synced in Android Studio.

After I remove the import statement I was able to see the developer menu and reload the app.

You can use this command from terminal, I set it up to a hotkey so I can do it quickly cause its annoying to have to shake your device anyway..

  1. First time you need to do this to get device list and it will return a list of devices, choose the number for your device, something like "2663404d12057ece"

adb devices

  1. To open developer menu on device use command:

adb -s YOUR_DEVICE_NUMBER shell input keyevent 82

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM