简体   繁体   中英

Unable to debug Native app on Android Studio

I got this error when I try to debug a simple native android app with android studio:

Failed to attach native debugger: unable to attach 

I tied several ideas to solve it. But they didn't work for me.

more information:

  • Ubuntu 16.04 (x64)
  • java version "1.8.0_91"
  • Android Studio v2.1.1
  • gradle-experimental:0.7.0
  • lldb 2.1

Do you have any idea?


UPDATE

After installing AVD (Android Virtual Device) on my pc (Ubuntu). Now I am able to debug both java and C++ codes. I think something wrong in my phone or lldb can not run in my phone (?). Do you have any Idea what does cause it?

My phone is HTC.

Your gradle-experimental setup should follow guidelines set forth by google. You can see their ndk samples of such here: https://github.com/googlesamples/android-ndk

Essentially, your android.ndk block in build.gradle should resemble this:

android.ndk { moduleName = "MostafaModule" cppFlags.addAll(['-std=c++11', '-fexceptions', '-Wall', '-Wno-literal-suffix']) cppFlags.add("-I${file("src/main/jni/mostafanativelib")}".toString()) ldLibs.addAll(["android", "log"]) stl = "gnustl_shared" }

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