Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android studio - Debug Javascript

I have to debug an Android app into Android Studio; the app contains scripts written in Javascript. Is there a way to add breakpoints to line of codes written in Javascript?

like image 276
A M Avatar asked Sep 05 '16 06:09

A M


People also ask

Can I code JavaScript in Android Studio?

Can we use JavaScript for Android? Yes, of course! The Android ecosystem supports the concept of hybrid apps, which is a wrapper over the native platform.

What does Android Debuggable do?

The debuggable flag in the app manifest tells the VM that the app is under development, and connections from debuggers should be allowed whether or not the app is running on a production device. All of the above relates to the app's runtime behavior, not the build. Debug builds are also different from release builds.


2 Answers

  • Open chrome and go to DevTools ( Inspect Element),

  • click the Main Menu then select More tools > Remote devices.

  • open the Settings tab.

  • Make sure that the Discover USB devices checkbox is enabled.

  • Connect your Android device directly to your development machine using a USB cable. The first time you do this, you usually see that DevTools has detected an unknown device. If you see a green dot and the text Connected below the model name of your Android device, then DevTools has successfully established the connection to your device

  • In the Remote Devices tab, click the tab that matches your Android device model name and Click "Inspect"

check this link for debugging JavaScript on Android in details

https://developers.google.com/web/tools/chrome-devtools/remote-debugging/

like image 193
Diptendu Das Avatar answered Oct 05 '22 23:10

Diptendu Das


Or easier way - in Chrome (or any Chromium-based browser as Edge) type url: chrome://inspect#devices.

like image 31
hcj Avatar answered Oct 06 '22 01:10

hcj