Jump to content
RadStudio 10.3.1 was released today Read more... ×
John Kouraklis

Debugging in Android

Recommended Posts

Hi,

I wanted to see other people's experiences with debugging in Android.

How does it work for you?

Actually, I've never managed to make it work :classic_sad::classic_sad:. The debugger never gets connected to the right port, etc. etc.

Now I've got some code that does not work and I comment/uncomment code to find the problem.

There must be surely an easier way.

I use a real Android tablet connected to a VM, if it matters 

 

????

Share this post


Link to post

Delphi in VM and Android debugging don't work well together. Actually, I never managed to debug Android from VM.

 

If not in VM debugging on Android works fine, most of the time.

Share this post


Link to post

Debugging in Android is somewhat a matter of chance - sometimes it works sometimes it doesn't for not obvious reasons. I have never tried it from within a VM, so I can't comment on that.

What I found quite helpful in some cases was a tool called Android log viewer which can be found here: http://app.serialgames.jp/sgd/alog/

It works similarly to the  CodeSite Viewer. You can send log messages to it via the different class functions in the Log class which is in the System.Diagnostics unit.

There is also a similar tool from Griijy. Find more about it here: https://blog.grijjy.com/2017/08/22/grijjycloudlogger-remote-logging-for-windows-ios-android-macos-and-linux/

I personally found the latter one somewhat cumbersome to get running, but your mileage may vary.

Edited by M.Joos

Share this post


Link to post

I cannot complain much.

Works well from a VM und er Macos, able to debug iOS and android. 

Usually iOS was more trickier to get running för me, Android was always quite calm.

Only since Google changed permissions it got problematic.

 

Rollo

Edited by Rollo62

Share this post


Link to post

I have issues sometimes with older devices (not being able to debug), but on the whole no other issues.

 

I use a VirtualBox VM running Windows 10, on my MacBook Pro running macOS 10.14.1.

 

My current devices are a Nexus 5X and a Samsung Tab A 7 (SM-T380)

 

One thing I will advise to anyone doing serious Android development is to become very familiar with a logcat viewer such as Monitor, which comes with the "original" Android SDK.

Share this post


Link to post

Some isues I had with Samsung devices for debugging in the past, since they seem to had problems with permissions to debug.
There were issues with accelleration sensor too, not returning any data.
But with the current versions this works again, and debugging is quite smooth (but somewhat slow).
Of coarse my oldest, main phone for testing is Samsung S7 Edge, also with older Android 7.0, so I don't check with older devices or OS really.

Edited by Rollo62

Share this post


Link to post

Debugging worked fine for me in v10.2.2 and stopped working in v10.2.3.

I'm sad to report that even after doing a fresh install of the recently released Delphi v10.3, I am still getting the 'port in use' error when trying to debug.

 

Perhaps this may be related to the Android libraries updates introduced in v10.2.3?

And yes, I'm testing devices running Android v4-v6, which may also be related.

Edited by Yaron

Share this post


Link to post
4 hours ago, Yaron said:

Debugging worked fine for me in v10.2.2 and stopped working in v10.2.3.

I'm sad to report that even after doing a fresh install of the recently released Delphi v10.3, I am still getting the 'port in use' error when trying to debug.

 

Perhaps this may be related to the Android libraries updates introduced in v10.2.3?

And yes, I'm testing devices running Android v4-v6, which may also be related.

Hi,

 

1. If you have Phone Android version higher than SDK version ? it's a problem 😞 

2. My Debug issues  After a few successful debug session (10.2.3 or 10.3)  debuging is not working anymore ('port in use' ) . Close Delphi, reconnect device and It's working again.

 

Regards, Marjan

 

Share this post


Link to post

1. I was testing against Android 6.0.1 so I don't think that's an issue.

2. For me restarting delphi and reconnecting the device doesn't help, restarting the device worked once, but even that's not reliable (or timely) and I tried using multiple devices and they all had this issue (they were Android 4 and Android 5).

 

I ordered a cheap Android 8.1 tablet, so we'll see how newer versions of Android work.

Share this post


Link to post

Not had many issues debugging android from a Windows PC.

 

There were problems with getting multiple copies of adb resident in memory which needed to be terminated but I always thought that issue was related to running Sophos AV.

 

My current problem is that after installing 10.3, the Android tools won't install 😉

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×