Recent

Author Topic: Android - recommendations  (Read 4191 times)

grl

  • New Member
  • *
  • Posts: 40
Android - recommendations
« 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

Handoko

  • Hero Member
  • *****
  • Posts: 5129
  • My goal: build my own game engine using Lazarus
Re: Android - recommendations
« Reply #1 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.

xinyiman

  • Hero Member
  • *****
  • Posts: 2256
    • Lazarus and Free Pascal italian community
Re: Android - recommendations
« Reply #2 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
Win10, Ubuntu and Mac
Lazarus: 2.1.0
FPC: 3.3.1

Tomi

  • Full Member
  • ***
  • Posts: 102
Re: Android - recommendations
« Reply #3 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?

Handoko

  • Hero Member
  • *****
  • Posts: 5129
  • My goal: build my own game engine using Lazarus
Re: Android - recommendations
« Reply #4 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.
« Last Edit: April 16, 2021, 05:54:48 pm by Handoko »

DonAlfredo

  • Hero Member
  • *****
  • Posts: 1739
Re: Android - recommendations
« Reply #5 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

ASBzone

  • Hero Member
  • *****
  • Posts: 678
  • Automation leads to relaxation...
    • Free Console Utilities for Windows (and a few for Linux) from BrainWaveCC
Re: Android - recommendations
« Reply #6 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
-ASB: https://www.BrainWaveCC.com/

Lazarus v2.2.7-ada7a90186 / FPC v3.2.3-706-gaadb53e72c
(Windows 64-bit install w/Win32 and Linux/Arm cross-compiles via FpcUpDeluxe on both instances)

My Systems: Windows 10/11 Pro x64 (Current)

Tomi

  • Full Member
  • ***
  • Posts: 102
Re: Android - recommendations
« Reply #7 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?

Tomi

  • Full Member
  • ***
  • Posts: 102
Re: Android - recommendations
« Reply #8 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.


rsu333

  • Full Member
  • ***
  • Posts: 110
Re: Android - recommendations
« Reply #10 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.

shyub

  • Full Member
  • ***
  • Posts: 124
Re: Android - recommendations
« Reply #11 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?

rsu333

  • Full Member
  • ***
  • Posts: 110
Re: Android - recommendations
« Reply #12 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,

Tomi

  • Full Member
  • ***
  • Posts: 102
Re: Android - recommendations
« Reply #13 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...

dseligo

  • Hero Member
  • *****
  • Posts: 1194
Re: Android - recommendations
« Reply #14 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.

 

TinyPortal © 2005-2018