Android NDK debugging with Android Studio - android

When creating a new project using the Android Studio Native C++ template I'm unable to debug the project on any device I own. Logcat reports not much info as to why.
Are there any extra steps I need to take to setup breakpoint debugging?
Could someone try create a new native template using android studio and see if they can get it debugging?

Android Studio was also reporting:
Debugger process finished with exit code 127. A library required by the native debugger might be missing on your system. See idea.log file for more details.
I found this stackoverflow post after a quick google:
Android Studio Debugger process finished with exit code 127
I couldn't find libncurses5 on my current distribution: Fedora, so instead opted to symlink the v6 libraries to v5:
ln -s /usr/lib64/libncurses6.so /usr/lib64/libncurses5.so
After doing this for all libraries listed in the idea.log (one after another) I was able to get debugging working in Android Studio

Related

Why is attaching gdbserver to a native android app failing?

I am developing a fully native application in using C++ and pure CMake as the build system - no Android Studio involved at all (proof of concept here)
The code builds, apk is generated and can be installed and run via ADB without issue but I cannot get gdbserver64 to attach to the process for debugging.
More details:
App is built against SDK/NDK API level 30
Attempting to debug on an Android 11 emulator instance without Google Play
I can run adb root just fine
Image already includes gdbserver and gdbserver64, attempting to use those
Developer options and USB debugging enebled in emulator
App has android:debuggable="true" in manifest
But every time I try gdbserver64 :5039 --attach $(pidof my.app.id)
I get /bin/sh: <app_pid>: inaccessible or not found
What am I missing? And no, I cannot just move to Android Studio - this is a cross platform project that needs to be buildable using only CMake.
According to my observation, this may be a bug of prebuilt gdbserver. It treats the parameter after --attach as a program name and tries to start it.
It's not really an answer, but in similar configuration to yours I got same error message and unable to overcome this. For me, switching to lldb helped, see e.g.

How to disable android native debugger in Android studio

Using Studio 2.3, gradle:2.2.1
When I try to attached debugger to app, it shows Android Hybrid Debugger ->
Now Launching Native Debug Session Attention! No symbol directories
found - please check your native debug
Start hybrid debugger.
And loading all *.so libraries.
I try to rename Android sdk/lldb to lldb_bak but still starting hybrid debugger.
It takes too long, waste of time. Mean while app is not responding. Can any one help me to disable native debugging. I need only java debugging.
Edit:
After uninstalling LLDB from sdk tools Android Studio ask me for Quick fix dialog saying "C++ debugger is missing". If I press yes. It install LLDB again and if I press no it gives me error saying.
Error running Android Hybrid Debugger (23533): C++ debugger package is
missing or incompatible
By the way I am using wireless debugging and I have c++ module with sources in my project.
Changing run configuration -> "Debug type" to 'Java' doesn't work for me.
I found solution. Select Java from debugger list. Enjoy. Sometime it happens :)
For the ones still looking for a permanent solution:
Go to menu Run, then Edit Configurations. Under Debugger then select the Debug Type Java.

Exporting a build from Unity to Android fails

I'm new to coding and to Unity. I've followed the step-by-step found in this google page. I have installed all the SDKs and the latest versions of Unity and Android Studio for mac OS.
Everything goes according to plan and I get to the final "run and build". It connects fine to my Note 3 and runs almost to the end when I get the following errors:
Error message window
Assets/GoogleVR/Scripts/VRDevices/GvrDevice.cs(99,10): warning CS0618: `UnityEngine.GL.IssuePluginEvent(int)' is obsolete: `IssuePluginEvent(eventID) is deprecated. Use IssuePluginEvent(callback, eventID) instead.'
and
CommandInvokationFailure: Unable to convert classes into dex format. See the Console for details. /Library/Java/JavaVirtualMachines/jdk1.7.0_79.jdk/Contents/Home/bin/java
-Xmx2048M -Dcom.android.sdkmanager.toolsdir="/Users/Bruno.Vilela/Library/Android/sdk/tools"
-Dfile.encoding=UTF8 -jar "/Applications/Unity/PlaybackEngines/AndroidPlayer/Tools/sdktools.jar"
-
I have tried all that I am able to and have found no way around this. I am simply not versed enough in C# to debug this on my own. Any help will be greatly appreciated!!
SPECS:
Macbook Pro running OS X 10.10.5
Unity 5.3.4f1 Personal
Android Studio 2.1.1
Galaxy Note 3 running Android 5.0
Cheers!!
-BV
This might be caused due to having duplication jar files in your project. check if that is true, try removing any duplication and building the project again.
some similar reference : http://answers.unity3d.com/questions/765961/multiple-plugin-conflict.html

Failed to pull "/system/bin/sh: readlink - QtCreator bug workaround?

I'm supposed to develop an android app using QtCreator in C++. QtCreator is, however, very user unfriendly and permanently confronts me with bugs and errors that I did not cause and do not understand. I'm still in the phase if building plain new project. The error that occurs when I build it is:
The process "C:/Qt/android.5.5.1/5.5/android_armv7/bin/androiddeployqt.exe" exited normally.
Pulling files necessary for debugging.
Package deploy: Running command "C:/Users/username/AppData/Local/Android/android-sdk/platform-tools/adb.exe -s 520592f0406021ce pull /system/bin/sh: readlink: not found D:/projects/build-androidtest-Android_for_armeabi_v7a_GCC_4_9_Qt_5_5_1-Debug/app_process".
Packaging error: Command "C:/Users/username/AppData/Local/Android/android-sdk/platform-tools/adb.exe -s 520592f0406021ce pull /system/bin/sh: readlink: not found D:/projects/build-androidtest-Android_for_armeabi_v7a_GCC_4_9_Qt_5_5_1-Debug/app_process" failed.Exit code: 1
Package deploy: Failed to pull "/system/bin/sh: readlink: not found" to "D:/projects/build-androidtest-Android_for_armeabi_v7a_GCC_4_9_Qt_5_5_1-Debug/app_process".
I have a suspicion that a piece of unix oriented code propagated into Windows version of QtCreator. It's a reported bug marked as fixed, but not in any released version, so I need to get it to work anyway.
Any ideas? I mean, is there actually anyone who uses Qt C++ android librarie in QtCreator on Windows? Because google searches are not very helpful on these topics.
Well it seems this is Qt creator bug to connect and debug the app you can try using qt libraries with visual studio and debug your application with VS.
UPDATE
it's a little bit hard but you can find the full process of doing that in here

Scala+Android: Is anybody successfully building and debugging in Eclipse?

So far, the only way I've been able to debug within Eclipse is to use Treeshaker with Scala IDE's buggy 2.8 branch. If I try to build with Scala IDE without Treeshaker, I get ClassNotFound errors per this long thread on scala-on-android.
Ideally I would build with sbt-android and debug within Eclipse, but I've been unable to do so successfully. The closest to debugging an sbt-android project I was able to achieve was to build the sbt-android project with the android:package-debug command, start the executable with the android:start-emulator command, and then connect DDMS to the application's thread.
However, I had breakpoints set that only would have executed after I connected the debugger to the thread, and none of them caused the thread to stop when reached.
Has anyone been able to debug Scala Android code in Eclipse using any other tools besides Treeshaker with Scala IDE based on Scala 2.8?
UPDATE: I'm successfully debugging (not building) in Eclipse after building from the command line with sbt, sbteclipse, and android-plugin.
What I did was to use Eclipse's new Android project menu, connect to existing source, and point it to the ./src/main directory. Then Eclipse recognized the Android settings, and DDMS recognized the task as belonging to the Eclipse Android project.
I also had to reconfigure the Eclipse project's Java build path source folders by removing the src folder from the build path and adding the ./scala folder. Then I had to restart Eclipse to add breakpoints to the Scala file.
Here's some interesting discussion about the difficulties building and debugging Android applications using Eclipse.
In general debugging Scala code running on Android using Eclipse works well and behaves more or less like debugging Scala on regular (non-Android) applications.
I use sbt with sbt-android and android:start-emulator or android:start-device.
Depending on whether I need to debug the application startup, I set the option to wait for the debugger in the developer settings on the device or emulator. To do this, run "DevTools" / "Development Settings". Select your application and check "Wait for Debugger".
Then you have to select the process to debug in DDMS. Make sure the debug port is shown, and then connect with the Eclipse debugger.
A potential cause for the debugger not installing the breakpoints is that the source code line has no direct equivalent in byte code. For comprehensions come to mind.
Using AndroidProguardScala, I am successful in debugging, using scala 2.10 and Eclipse 3.7
It also deals with for comprehensions as the usual plugin.
See the detailed answer there:
Eclipse, Android, Scala made easy but still does not work
The only missing feature is the new scala debugger in the latest scala eclipse plugin, which is not yet integrated. So for example, to debug a map, you will have to go though files such as Map.scala, ArrayBuffer.scala, Object.scala, and so on.

Categories

Resources