Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
998 views
in Technique[技术] by (71.8m points)

debugging - Debug native code in Android Studio

Google I/O 2015 promised debugging native code in Android Studio. To do this, you need to install ndk-bundle through SDK manager and update Android Studio to the latest version (Canary branch). And what to do next? How setup? Here is a link to the source. Source

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Update June 2016: In Android Studio 2.1 the default run configuration supports native debugging so there should be no need to do the below unless you're using an older version.

For older versions: Here's how to debug native code in Android Studio:

  • Go to Run->Edit configurations
  • Click the + sign
  • Choose 'Android Native' as the configuration type
  • In the Module dropdown choose your app's module
  • Add breakpoints to your C/C++ code
  • Run->Debug...

The app should be deployed and the lldb debugger will attach after ~10s.

Note: When creating the debug configuration under the 'Native Debugger' section you can choose gdb, however this is less well supported than lldb and known to be buggy. Use at your own risk.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...