2

First time debugging from PC to Mobile Phone work fine, when try again get error.

Any solution how fix this when try more debugging.

enter image description here

user_odoo
  • 2,284
  • 34
  • 55

3 Answers3

5

Add -debugport=54321 to Run->Parameters Parameters. By the way, the "inconsistent certificates" message is because the apk on the device was compiled with a different version of Delphi than the one you are using right now. You will have to uninstall it from the phone first. You can also use -cleaninstall in the Run->Parameters Parameters field.

Freddie Bell
  • 2,186
  • 24
  • 43
2

There is no easy and fast solution.

You may need to:

  1. Restart IDE
  2. Kill adb.exe
  3. Restart Windows
  4. Restart device

Sometimes you will be able to debug again after doing only some of the above steps, however often you will need to do all of them.

Since every try takes plenty of time, I found out that complete Windows restart + device restart is the fastest thing to do.

Dalija Prasnikar
  • 27,212
  • 44
  • 82
  • 159
  • Tnx for help, but this is frustrating after few line of source change I must restart PC, IDE. – user_odoo Feb 09 '21 at 13:01
  • 1
    Yes, it is. I know this is not possible for all code, but I would suggest that you debug as much as possible on Windows. – Dalija Prasnikar Feb 09 '21 at 13:03
  • Can't debug on windows in source I have $IFDEF ANDROID only put cooment on this code but this is not good idea. – user_odoo Feb 09 '21 at 13:06
  • 1
    I am afraid that in that case there is very little you can do. If you just need to run code without actually debugging try running without debugging - debugger is the problem here, not starting application after you changed code. – Dalija Prasnikar Feb 09 '21 at 13:08
  • 1
    Also if you figure out some other faster workaround, please post it as answer. – Dalija Prasnikar Feb 09 '21 at 13:08
  • My app work fine on eg. Redmi Note 9, Samsung tablet but on Huawei Nexus (app stop working) Segmentation fault (11) for that I need debuging. I don't know where is problem in source. – user_odoo Feb 09 '21 at 13:12
  • 1
    In such cases, I found out that the fastest thing to do is sprinkle application code in suspicious places with Log.d and observe logs in Android Studio - this will work with Delphi running in parallel. You just run without debugging from Delphi. Also, depending on the exception, you might get additional information in Android logs that can help you to pinpoint problems. Sometimes, crash can happen on the Java side and in such cases you can get good logs in Android Studio. – Dalija Prasnikar Feb 09 '21 at 13:23
  • If you have any example how set with Android Studio up this please share link. GL – user_odoo Feb 09 '21 at 13:28
  • 1
    https://developer.android.com/studio for downloading and installing instructions. It is simple, for viewing logs https://developer.android.com/studio/debug/am-logcat. you will need to create dummy (use some dummy bundle id) android application in AS and run it with debugging. then when it starts running it will show its logs in logcat and there you have combo box where you can switch to your Delphi application and show its logs. – Dalija Prasnikar Feb 09 '21 at 13:35
2

With Delphi 10.3.3, it is enough to restart the device. After restarting the device problem goes away. It seems after the cancelation of code execution of the project debugged, the debugging service on Android continues to run. At this point, when new debugging started, IDE tries to run a new service with the same id of previous running service.