Debug native code in Android Studio

Yevhen Vasilenko 09/16/2017. 2 answers, 13.729 views
android android debugging android-studio android-studio android-ndk android-ndk

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

durbnpoisn 06/08/2015
Explaining the ins and outs of an upgrade to an entire development environments is a bit too much for us to answer here.
Yevhen Vasilenko 06/08/2015
So, you say that it is better to remove current Android Studio and SDK and install new?

2 Answers

ph0b 12/18/2015.

Actually, the advertised NDK support isn't available yet, even if you download the ndk-bundle and update Android Studio to the latest version in the canary channel (1.3-preview3 as of now).

The SDK tools team said that the NDK support wasn't part of the first previews of Android Studio 1.3. However it should be out soon - they recently mentioned mid-June as a target.

update: the debugging support is out now. It wasn't the case at the time of the initial question - thanks for all the downvotes since then :) please look at donturner's answer below.

3 Glenn Maynard 01/14/2016
Downvotes are just a tax on questions with answers that change over time...

donturner 06/15/2016.

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.

1 Alex Cohn 10/15/2015
I believe that gdb is discontinued since AS v.1.4.
Mitch 05/01/2016
"In the Module dropdown choose your app's module" is in the General Tab v2.1 Android Studio
Mitch 05/01/2016
Missing instructions on naming the configuration. Also, these instructions create an error "Build type isn't JNI debuggable". I'm guessing these directions are no longer correct due to interface changes. I'm still unable to debug.
4 m0skit0 06/01/2016
No such option as 'Android Native'.
2 donturner 06/15/2016
The 'Android Native' run configuration is no longer supported because the 'Android Application' configuration now fully supports native debugging. - Download Hi-Res Songs

1 (G)I-DLE


(G)I-DLE. 2018. Writer: Riot Music Team;Harloe.
2 The Chainsmokers

Beach House flac

The Chainsmokers. 2018. Writer: Andrew Taggart.
3 Ariana Grande

​Thank U, Next flac

Ariana Grande. 2018. Writer: Crazy Mike;Scootie;Victoria Monét;Tayla Parx;TBHits;Ariana Grande.
4 Nicki Minaj

No Candle No Light flac

Nicki Minaj. 2018. Writer: Denisia “Blu June” Andrews;Kathryn Ostenberg;Brittany "Chi" Coney;Brian Lee;TJ Routon;Tushar Apte;ZAYN;Nicki Minaj.
5 Clean Bandit

Baby flac

Clean Bandit. 2018. Writer: Jack Patterson;Kamille;Jason Evigan;Matthew Knott;Marina;Luis Fonsi.
6 Imagine Dragons

Bad Liar flac

Imagine Dragons. 2018. Writer: Jorgen Odegard;Daniel Platzman;Ben McKee;Wayne Sermon;Aja Volkman;Dan Reynolds.
7 Halsey

Without Me flac

Halsey. 2018. Writer: Halsey;Delacey;Louis Bell;Amy Allen;Justin Timberlake;Timbaland;Scott Storch.

Waste It On Me flac

BTS. 2018. Writer: Steve Aoki;Jeff Halavacs;Ryan Ogren;Michael Gazzo;Nate Cyphert;Sean Foreman;RM.
9 BlackPink

Kiss And Make Up flac

BlackPink. 2018. Writer: Soke;Kny Factory;Billboard;Chelcee Grimes;Teddy Park;Marc Vincent;Dua Lipa.
10 Fitz And The Tantrums

HandClap flac

Fitz And The Tantrums. 2017. Writer: Fitz And The Tantrums;Eric Frederic;Sam Hollander.
11 Backstreet Boys

Chances flac

Backstreet Boys. 2018.
12 Kelly Clarkson

Never Enough flac

Kelly Clarkson. 2018. Writer: Benj Pasek;Justin Paul.
13 Diplo

Close To Me flac

Diplo. 2018. Writer: Ellie Goulding;Savan Kotecha;Peter Svensson;Ilya;Swae Lee;Diplo.
14 Anne-Marie

Rewrite The Stars flac

Anne-Marie. 2018. Writer: Benj Pasek;Justin Paul.
15 Little Mix

Woman Like Me flac

Little Mix. 2018. Writer: Nicki Minaj;Steve Mac;Ed Sheeran;Jess Glynne.
16 Imagine Dragons

Machine flac

Imagine Dragons. 2018. Writer: Wayne Sermon;Daniel Platzman;Dan Reynolds;Ben McKee;Alex Da Kid.
17 Little Mix

The Cure flac

Little Mix. 2018.
18 Bradley Cooper

Always Remember Us This Way flac

Bradley Cooper. 2018. Writer: Lady Gaga;Dave Cobb.
19 Rita Ora

Velvet Rope flac

Rita Ora. 2018.
20 Lady Gaga

I'll Never Love Again flac

Lady Gaga. 2018. Writer: Benjamin Rice;Lady Gaga.

Related questions

Hot questions


Popular Tags