Lazarus

Programming => Operating Systems => Android => Topic started by: jmpessoa on January 21, 2021, 04:31:11 pm

Title: [LAMW] Debug Apk From IDE
Post by: jmpessoa on January 21, 2021, 04:31:11 pm
New!

"Debug Apk From IDE"  by  @leopreo

ref.

https://github.com/jmpessoa/lazandroidmodulewizard/blob/master/LAMW_DebugApkFromIDE.txt

Thanks to @leopreo!

PS. dependency/required package "LazDebuggerFpGdbmi"
Title: Re: [LAMW] Debug Apk From IDE
Post by: rsu333 on January 22, 2021, 04:29:44 pm
Thanks for your great job.
Title: Re: [LAMW] Debug Apk From IDE
Post by: rsu333 on January 24, 2021, 06:40:59 am
Kindly explain the importance of above method over previous  method of  debugging. I have try it on laz4and.
in another folder , girdle 6.>,  fetal at  build step.
You have also explain key store in debugging which I can't do easily .
Is there any google friendly debugging method ? Or can do any changes in debugging option ? Please   
Title: Re: [LAMW] Debug Apk From IDE
Post by: Segator on January 24, 2021, 02:34:09 pm
I think that you not need the keystore in debugging option, when the app work fine then you change from debugging to release and then use keystore.
Title: [LAMW] Debug Apk From IDE
Post by: Leopreo on January 26, 2021, 02:47:49 pm
26.01.2021: Add chipset ARMv7a+Soft and test it on AVD Android Emulator (Device Nexus 9 [5.1.1-API22]
Google APIs ARM (armeabi-v7a)), Setup in gdbmiserverdebuggerlamw.pas SIG33 & SIG35 to "nopass nostop noprint" (blocks real time events), add for localhost command "adb forward tcp:port tcp:port"

https://github.com/jmpessoa/lazandroidmodulewizard/blob/master/LAMW_DebugApkFromIDE.txt
Title: Re: [LAMW] Debug Apk From IDE
Post by: Segator on February 11, 2021, 04:39:36 pm
i can't find the ...android-ndk-r10e\toolchains\arm-linux-androideabi-4.9\prebuilt\windows\bin\arm-linux-androideabi-gdb.exe binary in that place exits other like:
Code: Pascal  [Select][+][-]
  1. arm-linux-androideabi-g++.exe
  2. arm-linux-androideabi-gcc.exe
  3. arm-linux-androideabi-gcc-4.9.exe
  4. arm-linux-androideabi-gcc-4.9.x.exe
  5. arm-linux-androideabi-gcc-ar.exe
  6. arm-linux-androideabi-gcc-nm.exe
  7. arm-linux-androideabi-gcc-ranlib.exe
  8. arm-linux-androideabi-gcov.exe
  9. arm-linux-androideabi-gcov-tool.exe
  10. arm-linux-androideabi-gprof.exe

but not gdb, what can i do?
Title: Re: [LAMW] Debug Apk From IDE
Post by: juank1971 on February 11, 2021, 05:01:48 pm
yes i have in
C:\LAMW\android-ndk-r10e\toolchains\arm-linux-androideabi-4.9\prebuilt\windows\bin\arm-linux-androideabi-gdb.exe
donwload android-ndk-r10e again and uncompress
Title: Re: [LAMW] Debug Apk From IDE
Post by: juank1971 on February 11, 2021, 05:04:37 pm
this is
Title: Re: [LAMW] Debug Apk From IDE
Post by: Segator on February 12, 2021, 11:26:48 pm
thanks @juank1971 i will try it.
Title: Re: [LAMW] Debug Apk From IDE
Post by: Segator on February 17, 2021, 05:57:44 pm
i try other ndk version the file is not present, i try with the 64bits versions 16b and 18b, is only present in the 32 bits version or the 10e like the tutorial?
Title: Re: [LAMW] Debug Apk From IDE
Post by: Leopreo on February 18, 2021, 04:46:57 pm
32bit: android-ndk-r18b\prebuild\windows\bin\gdb.exe
64bit: android-ndk-r18b\prebuild\windows-x86_64\bin\gdb.exe
Title: Re: [LAMW] Debug Apk From IDE
Post by: Segator on February 19, 2021, 02:12:11 am
thanks @Leopreo i will try it.
Title: Re: [LAMW] Debug Apk From IDE
Post by: cappe on April 10, 2021, 09:27:40 am
Thanks for this implementation.

I wanted to ask if it is possible to debug also by launching the apk on a physical device. I tried, with emulator it works fine, but on a physical device it gives me this error:

Messaggi, suggerimenti: 2
Verbose: Selected chip architecture: armeabi-v7a
Verbose: Taking libraries from folder: C:\lamw\test\canccanc\AppLAMWProject2\libs\armeabi-v7a
Verbose: Found library: libcontrols.so
Note: Duplicate unit "controls" in "controls", orphaned ppu "C:\lamw\test\canccanc\AppLAMWProject2\obj\controls\controls.o"
Note: Duplicate unit "controls" in "LCLBase 2.0.0.4", ppu="C:\lamw\laz4android2.0.0\lcl\units\arm-android\controls.ppu", source="C:\lamw\laz4android2.0.0\lcl\controls.pp"
Compila il progetto, OS: android, CPU: arm, Destinazione: C:\lamw\test\canccanc\AppLAMWProject2\libs\armeabi-v7a\libcontrols.so: Successo
Building APK (Gradle)... : Successo
Starting APK (Gradle)... : Successo
 Get CPU Abilist: Successo
 Get Build Version Sdk: Successo
Scan org.lamw.applamwproject2 PID...: Successo
 Pull /system/bin/app_process32 to C:/lamw/test/canccanc/AppLAMWProject2/gdb: Successo
 Pull /system/bin/linker to C:/lamw/test/canccanc/AppLAMWProject2/gdb: Successo
 Pull /system/lib/libc.so to C:/lamw/test/canccanc/AppLAMWProject2/gdb: Successo
Adb forward tcp:2021 tcp:2021: Successo
2021
Start(run-as org.lamw.applamwproject2 lib/gdbserver --multi :2021): Codice di uscita 234, Errori: 1
run-as: Package 'org.lamw.applamwproject2' has corrupt installation
Panic: lo strumento ha terminato con codice di uscita 234. Usare il menu contestuale per maggiori informazioni.
Exception, Errori: 1
Fatal: [Exception] Failed: Cannot start(run-as org.lamw.applamwproject2 lib/gdbserver --multi :2021)


Is it possible to debug on a physical device?
Title: Re: [LAMW] Debug Apk From IDE
Post by: Leopreo on April 13, 2021, 08:21:14 am
Yes. It is possible.

1. Check device debug permissions
2. Android 8 (Android 8.1) has system bug - problem start gdbserver
3 Change NDK version (android-ndk-r10e tested)
Title: Re: [LAMW] Debug Apk From IDE
Post by: Tomi on April 16, 2021, 12:45:04 pm
Hello everybody!

Yesterday I installed some android packages into Lazarus based on this video: https://youtu.be/1BH460c9_Aw
Everything works, except that when I launch a new android project, Lazarus can't build APK, because of fpc.exe doesn't support arm-android (it is an error message).
What should I do? Maybe can I install arm-android with fpcupdeluxe program?
Title: Re: [LAMW] Debug Apk From IDE
Post by: rsu333 on April 18, 2021, 08:25:29 am
This is also good , example video ,But I suggest to upgrade it by LAMW manager.
TinyPortal © 2005-2018