Lazarus

Programming => Operating Systems => Android => Topic started by: grl on November 24, 2019, 10:53:46 am

Title: Android - recommendations
Post by: grl on November 24, 2019, 10:53:46 am
Hi @all!

I'm planning on porting a small part of our code to android (mostly special calculations, no external references). To make it usable I need some sort of GUI and a possibility to communicate via network (preferrable TCP).

There's a lot of information about Lazarus and Android on the net - but most of the howtos around some years old.
Then there is that dual way of doing android directly and via JVM.

So I'm asking for help here:
Has someone recently done a successful project using Lazarus to produce a GUI and communication via TCP?
What technology did you use?
Any tips where to start?

We develop mainly on Linux. So I'd prefer to use that for creating the apks as well - but most of the tutorials use Windows als OS. Any recommendations on that topic as well?

Thanks
Lukas
Title: Re: Android - recommendations
Post by: Handoko on December 06, 2019, 10:57:32 am
There are several options for creating apk using Lazarus. You should try Lazarus Android Module Wizard first, it is the most features-rich and easiest.

https://wiki.lazarus.freepascal.org/LAMW

I'm not good in network programming. But I managed to write a simple demo android app to communicate with my Linux desktop PC using UDP socket. LAMW has a lot of ready to use components.
Title: Re: Android - recommendations
Post by: xinyiman on December 06, 2019, 12:17:35 pm
I recently created an android app from linux and to configure the environment I used LAMW_Manager. It made the installation very easy. Look here about it.

https://forum.lazarus.freepascal.org/index.php?topic=45361.0
Title: Re: Android - recommendations
Post by: Tomi on April 16, 2021, 05:27:16 pm
Hello! :)

I have installed LAMW packages into Lazarus to make Android apps, but when I try make a new Android project, Lazarus shows me that it doesn't support arm-android.
How can I solve this problem? Should I install arm CPU with Android OS by fpcupdeluxe?
Title: Re: Android - recommendations
Post by: Handoko on April 16, 2021, 05:52:20 pm
Most users fail at the installation process, make sure you really installed LAMW correctly. To test it, open a demo that bundled with the LAMW source code, compile and generate the apk, send it to your mobile phone and test it. You should be able to install and run the apk on your mobile phone. If not, probably you haven't installed LAMW correctly.
Title: Re: Android - recommendations
Post by: DonAlfredo on April 16, 2021, 06:15:27 pm
As there were many request about Android and LAMW, I have added a speed-install option into fpcupdeluxe.
This speedbutton will install:
FPC + Lazarus stable.
LAMW.
Android cross-compilers to armv7 and arm64.

Just set the install-directory towards an empty directory on your system.
Press the Android speedbutton.
Sit back and keep fingers crossed.

https://github.com/LongDirtyAnimAlf/fpcupdeluxe/releases/tag/1.8.2s
Title: Re: Android - recommendations
Post by: ASBzone on April 16, 2021, 06:20:58 pm
Sit back and keep fingers crossed.

Excellent work, Don.   

I must say, though, you had me going.  :D   Just when I thought you were about to say "sit back and relax"...  you take me for a ride instead.  LOL
Title: Re: Android - recommendations
Post by: Tomi on April 17, 2021, 09:42:12 am
Most users fail at the installation process, make sure you really installed LAMW correctly. To test it, open a demo that bundled with the LAMW source code, compile and generate the apk, send it to your mobile phone and test it. You should be able to install and run the apk on your mobile phone. If not, probably you haven't installed LAMW correctly.
Hello Handoko!

I did it on the basis of this video: https://youtu.be/1BH460c9_Aw
It seems everything is OK: groups "Android Bridges", "Android Bridges Extra", etc. are appeared, but when I tried make a new LAMW [GUI] Android Module, Lazarus warned me that fpc.exe compiler doesn't support target: arm-android.
Therefore I thought that still required to install arm CPU with Android OS by fpcupdeluxe. Although I don't know whether fpcupdeluxe can find automatically the path of Lazarus or I have to type it somewhere?
Title: Re: Android - recommendations
Post by: Tomi on April 17, 2021, 09:47:20 am
As there were many request about Android and LAMW, I have added a speed-install option into fpcupdeluxe.
This speedbutton will install:
FPC + Lazarus stable.
LAMW.
Android cross-compilers to armv7 and arm64.

Just set the install-directory towards an empty directory on your system.
Press the Android speedbutton.
Sit back and keep fingers crossed.
Hello DonAlfredo!

It seems great! But is there a way to install only the required cross-compilers in fpcupdeluxe? I think, FPC, Lazarus and LAMW are not require for me, because these are installed on my system.
Title: Re: Android - recommendations
Post by: DonAlfredo on April 17, 2021, 09:55:15 am
Nop. Fpcupdeluxe only works correct for an install made by fpcupdeluxe itself. So, you cannot use it for an install by other means.
However.
You can use the same tools as those being used by fpcupdeluxe.
Binary tools:
https://github.com/LongDirtyAnimAlf/fpcupdeluxe/releases/download/wincrossbins_v1.1/WinCrossBinsAndroidAll.zip
https://github.com/LongDirtyAnimAlf/fpcupdeluxe/releases/download/linuxx64crossbins_v1.1/CrossBinsAndroidAll.zip
Libraries:
https://github.com/LongDirtyAnimAlf/fpcupdeluxe/releases/download/crosslibs_v1.1/CrossLibsAndroidAarch64.zip
https://github.com/LongDirtyAnimAlf/fpcupdeluxe/releases/download/crosslibs_v1.1/CrossLibsAndroidARM.zip
Title: Re: Android - recommendations
Post by: rsu333 on April 18, 2021, 08:35:19 am
For beginner Laz4android old version is best with example  [2.0.0.0] . Once you get technic of language then use new upgraded which is BEST.
Title: Re: Android - recommendations
Post by: shyub on April 18, 2021, 08:40:57 am
If I install "lazarus-2.0.12-fpc-3.2.0-win32.exe" and "lazandroidmodulewizard-master.zip", do I still need to install the compilator for Android and how can I do it?
If I want to update "lazandroidmodulewizard-master.zip", do I need to remove the installed LAMW packages or reinstall Lazarus first?
Title: Re: Android - recommendations
Post by: rsu333 on April 18, 2021, 09:31:03 am
Configuration Lazarus to android is part of experts, As a jr and want to devolop andr. app , I prefer to install Laz4android ,through LAMW manager,
Title: Re: Android - recommendations
Post by: Tomi on April 18, 2021, 03:19:32 pm
As there were many request about Android and LAMW, I have added a speed-install option into fpcupdeluxe.
I have download it and install these programs (previously I removed my old Lazarus), and everything seems to be good, but when I try to run my Lazarus program, it warns me that "cannot build APK!" and "Exit code 1". What is wrong with it? Maybe need it an Android emulator too? I have no idea...
Title: Re: Android - recommendations
Post by: dseligo on April 18, 2021, 04:08:39 pm
As there were many request about Android and LAMW, I have added a speed-install option into fpcupdeluxe.
This speedbutton will install:
FPC + Lazarus stable.
LAMW.
Android cross-compilers to armv7 and arm64.

Just set the install-directory towards an empty directory on your system.
Press the Android speedbutton.
Sit back and keep fingers crossed.

https://github.com/LongDirtyAnimAlf/fpcupdeluxe/releases/tag/1.8.2s

I tried 1.8.2s and installation failes:
Code: Text  [Select][+][-]
  1. echo '45643' > revision.inc
  2. C:/LAMW/fpc/bin/x86_64-win64/fpc.exe -Ur -Xs -O2 -n -Fux86_64 -Fusystems -FuC:/LAMW/fpcsrc/rtl/units/x86_64-win64 -Fix86_64 -FE. -FUx86_64/units/x86_64-win64 -dRELEASE -vw-n-h-l-d-u-t-p-c-    -dREVINC -dx86_64 -dGDB -dBROWSERLOG -Fux86 -Sew version.pas
  3. version.pas(94,8) Error: Operator is not overloaded: "ShortString" + "Word"
  4. version.pas(100) Fatal: There were 1 errors compiling module, stopping
  5. Fatal: Compilation aborted
  6. Error: C:\LAMW\fpc\bin\x86_64-win64\ppcx64.exe returned an error exitcode
  7. make.exe[1]: *** [cycle] Error 2
  8. C:\LAMW\fpcbootstrap\make.exe: *** [compiler_cycle] Error 2
  9. fpcupdeluxe: ERROR: FPCCrossInstaller (BuildModuleCustom: FPC): Running cross compiler fpc C:\LAMW\fpcbootstrap\make.exe for aarch64-android failed with an error code.
  10. fpcupdeluxe: ERROR: FPCCrossInstaller (BuildModuleCustom: FPC): Removing all aarch64-android compiler settings from fpc.cfg.
  11. fpcupdeluxe: info: FPCCrossInstaller (InsertFPCCFGSnippet: fpc.cfg): Inserting snippet in C:\LAMW\fpc\bin\x86_64-win64\fpc.cfg done.
  12.  
  13.  
  14. ERROR: Fpcupdeluxe fatal error !
  15. Sequencer (FPCCleanBuildOnly): Failure running fpcupdeluxe: error executing sequence FPCCleanBuildOnly
  16. Sequencer (Only): Failure running fpcupdeluxe: error executing sequence Only

Error is here:
Code: Pascal  [Select][+][-]
  1. function full_version_string:string;
  2. begin
  3.   full_version_string := version_nr+'.'+release_nr+'.'+patch_nr+minorpatch
  4. {$ifdef REVINC}
  5.   +'-r'+{$i revision.inc} // <--- error - revision.inc is 45643
  6. {$endif REVINC}
  7.   ;
  8. end;
  9.  

IntToStr missing?

I am on Windows 10.
Title: Re: Android - recommendations
Post by: Tomi on April 19, 2021, 10:01:35 am
Now I reinstall Lazarus and after I installed arm-android with fpcupdeluxe, it show me the following error message:
Title: Re: Android - recommendations
Post by: DonAlfredo on April 19, 2021, 10:23:16 am
@Tomi
Your screenshot shows me that you are using the win64 version of fpcupdeluxe.
This is perfectly fine if you want to use it solely for compilation of win64 apps.
However, it is NOT recommended when cross-compiling !!
So, please perform a NEW install as described previously, in a directory called e.g. win32fpclazlamw.
Sorry about this, I should have told you.

https://github.com/LongDirtyAnimAlf/fpcupdeluxe/releases/download/1.8.2s/fpcupdeluxe-i386-win32.exe
Title: Re: Android - recommendations
Post by: Tomi on April 19, 2021, 11:18:14 am
Okay; thanks, DonAlfredo, I will download and try that version of Fpcupdeluxe.
Otherwise, somebody know this program? fpc-3.0.0.i386-win32.cross.android
I installed it just now, and it made three directory in default c:\FPC folder. In this in the "units" folder there are:
arm-android
i386-android
mipsel-android directories. Is it possible to I would have to copy these into c:\lazarus\units folder to make Lazarus able to support arm-android? Or do I have to compile these somehow after I replaced these folders?
Title: Re: Android - recommendations
Post by: Tomi on April 19, 2021, 03:00:00 pm
I have download that fpcupdeluxe and install Android LAMW with it, but the situation is the same: it exits during build Android APK with exit code 1...  :(
TinyPortal © 2005-2018