Recent

Author Topic: [HowTo] Android Development Environment on Linux (FPCUPdeluxe + LAMW)  (Read 30460 times)

laguna

  • Sr. Member
  • ****
  • Posts: 313
Re: [HowTo] Android Development Environment on Linux (FPCUPdeluxe + LAMW)
« Reply #60 on: October 21, 2021, 02:23:20 pm »
how do  clean installation?

I've gotten to the point that the emulator starts up but the program doesn't install.
The terminal window closes too quickly to read the error.

Thanks
« Last Edit: October 21, 2021, 02:29:08 pm by laguna »

WayneSherman

  • Full Member
  • ***
  • Posts: 119
Re: [HowTo] Android Development Environment on Linux (FPCUPdeluxe + LAMW)
« Reply #61 on: October 22, 2021, 07:10:16 am »
Line #29 to use fpcupdeluxe version v2.2.0c
Better use xdg-user-dir in lines #47 and #48

Got it.  Fixed.  Thank you.

WayneSherman

  • Full Member
  • ***
  • Posts: 119
Re: [HowTo] Android Development Environment on Linux (FPCUPdeluxe + LAMW)
« Reply #62 on: October 22, 2021, 07:17:33 am »
Updated installation procedure to 2021-Oct-21 ver 1.6
(see first post)

Changes:
Code: Text  [Select][+][-]
  1. use $(xdg-user-dir DESKTOP) instead of hard-coded user Desktop path (thank you guaracy)
  2. Use newer Android Command-Line Tools for Linux build 7583922 (previous was 7302050)
  3. Use new FPCUPdeluxe ver 2.2.0c (previous was 1.8.2u)
  4. Compiled and tested simple hello world gui on Pixel 4 / Andriod 12
  5.   (tested both ARMv7a + VFPv3 and Aarch64)
  6. Tested the 32-bit APK using AVD/Emulator - system-images;android-24;default;armeabi-v7a
« Last Edit: October 22, 2021, 08:27:08 am by WayneSherman »

laguna

  • Sr. Member
  • ****
  • Posts: 313
Re: [HowTo] Android Development Environment on Linux (FPCUPdeluxe + LAMW)
« Reply #63 on: October 22, 2021, 07:45:34 am »
Updated installation procedure to 2021-Oct-21 ver 1.6
(see first post)

Changes:
Code: Text  [Select][+][-]
  1. use $(xdg-user-dir DESKTOP) instead of hard-coded user Desktop path (thank you guaracy)
  2.  
  3. bash: /home/scozzaro/Desktop: Is a directory    is ok?
  4.  
  5.  
  6. Use newer Android Command-Line Tools for Linux build 7583922 (previous was 7302050)
  7.  
  8. Please link for download?
  9.  
  10. Use new FPCUPdeluxe ver 2.2.0c (previous was 1.8.2u)
  11.  
  12. I use this version (2.2.0c)
  13.  
  14. Compiled and tested simple hello world gui on Pixel 4 / Andriod 12
  15.   (tested both ARMv7a + VFPv3 and Aarch64)

but avd manager not start, run with command line
./sdkmanager "platforms;android-29" "build-tools;29.0.3" "tools" "ndk-bundle" "extras;android;m2repository"
path my command line: ~/android/sdk/cmdline-tools$
                                    ~/android/sdk/cmdline-tools/tools$

and run with  ./emulator -avd ndk-bundle


Thanks

« Last Edit: October 22, 2021, 07:47:12 am by laguna »

loaded

  • Sr. Member
  • ****
  • Posts: 375
Re: [HowTo] Android Development Environment on Linux (FPCUPdeluxe + LAMW)
« Reply #64 on: October 22, 2021, 07:50:41 am »
Why don't you use android studio emulator?
However, they are now very fast and stable...
If Ide=Lazarus 2.0.10 32 Bit and Os=Win 10 Home 64 Bit then Get up and do something useful! Because God is the helper of those who start again;

laguna

  • Sr. Member
  • ****
  • Posts: 313
Re: [HowTo] Android Development Environment on Linux (FPCUPdeluxe + LAMW)
« Reply #65 on: October 22, 2021, 08:07:46 am »
how link lazarus with android studio emulator?

how do to do? 

thanks

WayneSherman

  • Full Member
  • ***
  • Posts: 119
Re: [HowTo] Android Development Environment on Linux (FPCUPdeluxe + LAMW)
« Reply #66 on: October 22, 2021, 08:21:17 am »
Please link for download?

Please see the first post in this message thread.  It has been updated with the latest procedure.

but avd manager not start, run with command line

I just tested the following and it worked:

Installing and Using the Android Emulator:
(the method described here uses the command line, another method is to install Android Studio)

Code: Bash  [Select][+][-]
  1. #Install the emulator and a system image
  2. cd "$HOME/android/sdk/cmdline-tools/tools/bin"
  3. ./sdkmanager "emulator" "system-images;android-24;default;armeabi-v7a"
  4. #(to get a list of system images use ./sdkmanager --list)
  5.  
  6. #Create an android virtual devices (AVD)
  7. #(this particular device will work with 32-bit only)
  8. ./avdmanager create avd -n "my_test_device" -k "system-images;android-24;default;armeabi-v7a"
  9.  
  10. #(to get a list of devices use ./avdmanager list devices)
  11. #(after creation, AVD files are stored in:  ~/.android/avd/)
  12.  
  13. #Run the emulator
  14. cd "$HOME/android/sdk/emulator"
  15. ./emulator -avd "my_test_device"
  16.  
  17. # (to get a list of available AVDs, use ./emulator -list-avds)
  18.  

For my test, I ran the emulator first.  Once the emulator is running, then from the Lazarus IDE menu select Run | [LAMW] Build Android Apk and Run

Added notes on emulator testing:

Testing in VirtualBox (enabled nested virtualization and 3D video)
General Warning: Do not run the Android emulator as a "nested" virtual machine within another VM environment.  It can be done, but it has issues.

If running inside a virtual machine, software rendering may be required.  Run the emulator with -gpu swiftshader_indirect. More info here.

(Despite the warning above, this was tested in my VirtualBox AMD64 Linux VM)
This worked for testing 32-bit ARM APKs:
   system-images;android-24;default;armeabi-v7a
   ./emulator -avd "my_test_device"
  (in my current setup, this test did not require -gpu swiftshader_indirect)

Emulator images that are native arm64-v8a are so slow I haven't gotten them to boot.

For API 30 and later the x86 emulators emulate ARM when running on x86_64 host platform (reportedly 10 times faster than the native ARM emulators)
 
32-bit ARM APK works with system-images;android-30;google_apis;x86
32-bit and 64-bit APK works with system-images;android-30;google_apis;x86_64
./emulator -avd "api30-x86-device" -no-snapshot-load -gpu swiftshader_indirect
./emulator -avd "api30-x86_64-device" -no-snapshot-load -gpu swiftshader_indirect
For my testing with these two system images, the Android back and home buttons don't work and some system apps crash. (e.g. Settings)
« Last Edit: October 22, 2021, 09:57:12 pm by WayneSherman »

laguna

  • Sr. Member
  • ****
  • Posts: 313
Re: [HowTo] Android Development Environment on Linux (FPCUPdeluxe + LAMW)
« Reply #67 on: October 22, 2021, 08:39:54 am »
excuse me for bad english
I had start from this post, but emulator not started, I had remove java 11, and work only java 8
with only java 8 the installation working
I remove folder SDK and reinstall from you guide.

Please wait for installation

thanks a lot


laguna

  • Sr. Member
  • ****
  • Posts: 313
Re: [HowTo] Android Development Environment on Linux (FPCUPdeluxe + LAMW)
« Reply #68 on: October 22, 2021, 09:03:14 am »
I have create this script
Code: Pascal  [Select][+][-]
  1. # Install libraries and tools
  2. sudo apt install -y libx11-dev libgtk2.0-dev libgdk-pixbuf2.0-dev libcairo2-dev libpango1.0-dev libxtst-dev libatk1.0-dev libghc-x11-dev freeglut3 freeglut3-dev
  3. sudo apt install -y git subversion make build-essential gdb zip unzip unrar wget
  4. sudo apt install -y openjdk-11-jdk android-tools-adb
  5.  
  6. # download and extract Android SDK Command Line Tools for Linux
  7. # from https://developer.android.com/studio/#downloads
  8. mkdir -p "$HOME/android/sdk/cmdline-tools"
  9. cd "$HOME/android/sdk/cmdline-tools"
  10. wget "https://dl.google.com/android/repository/commandlinetools-linux-7583922_latest.zip"
  11. unzip "commandlinetools-linux-7583922_latest.zip"
  12. rm "commandlinetools-linux-7583922_latest.zip"
  13. mv cmdline-tools tools
  14.  
  15. # Install SDK packages and NDK (as of 2021-Oct-21 this pulls in NDK r22b)
  16. cd "$HOME/android/sdk/cmdline-tools/tools/bin"
  17. yes | ./sdkmanager --licenses
  18. ./sdkmanager "platforms;android-29" "build-tools;29.0.3" "tools" "ndk-bundle" "extras;android;m2repository"
  19.  
  20.  
  21. #Install the emulator and a system image
  22. cd "$HOME/android/sdk/cmdline-tools/tools/bin"
  23. ./sdkmanager "emulator" "system-images;android-24;default;armeabi-v7a"
  24. #(to get a list of system images use ./sdkmanager --list)
  25.  
  26. #Create an android virtual devices (AVD)
  27. ./avdmanager create avd -n "my_test_device" -k "system-images;android-24;default;armeabi-v7a"
  28.  
  29. #(to get a list of devices use ./avdmanager list devices)
  30. #(after creation, AVD files are stored in:  ~/.android/avd/)
  31.  
  32. #Run the emulator
  33. cd "$HOME/android/sdk/emulator"
  34. ./emulator -avd "my_test_device"
  35.  
  36. # (to get a list of available AVDs, use ./emulator -list-avds)

The emulator start after run script
run on port 5556 is correct?

but lazarus after complier not install app on emulator
terminal windows show message error but close ealry

 lazarus emulator window not show virtual machine create how image attachment


« Last Edit: October 22, 2021, 09:10:31 am by laguna »

loaded

  • Sr. Member
  • ****
  • Posts: 375
Re: [HowTo] Android Development Environment on Linux (FPCUPdeluxe + LAMW)
« Reply #69 on: October 22, 2021, 12:48:12 pm »
Don't tire yourself so much, windows doesn't need any of this, it should be the same in linux  ;D
1- Install Android Studio
2- Make sure you can run the emulator from within Android Studio or using the launcher!!! Run it and keep it running.
3- Run your Android project using Lazarus and LAMW
4- Goto 2
If Ide=Lazarus 2.0.10 32 Bit and Os=Win 10 Home 64 Bit then Get up and do something useful! Because God is the helper of those who start again;

laguna

  • Sr. Member
  • ****
  • Posts: 313
Re: [HowTo] Android Development Environment on Linux (FPCUPdeluxe + LAMW)
« Reply #70 on: October 22, 2021, 03:20:03 pm »
I copy Sdk the Android Studio in sdk the lazarus
I copy ndk-build in sdk
now run in real device but non run in emulator device


laguna

  • Sr. Member
  • ****
  • Posts: 313
Re: [HowTo] Android Development Environment on Linux (FPCUPdeluxe + LAMW)
« Reply #71 on: October 22, 2021, 03:30:32 pm »
Finally run

Start virtual machine emulator with Android Studio
Not start with form the lazarus

why are the controls not aligned as shown in the drawing?

loaded

  • Sr. Member
  • ****
  • Posts: 375
Re: [HowTo] Android Development Environment on Linux (FPCUPdeluxe + LAMW)
« Reply #72 on: October 22, 2021, 03:38:56 pm »
No, you should not copy.
SDKs used by LAMW and Android Studio should be separate.
So, Everyone should use their own SDK.
why are the controls not aligned as shown in the drawing?
On Android, the design is different. I recommend that you read it.
https://developer.android.com/guide/topics/ui/declaring-layout
If Ide=Lazarus 2.0.10 32 Bit and Os=Win 10 Home 64 Bit then Get up and do something useful! Because God is the helper of those who start again;

laguna

  • Sr. Member
  • ****
  • Posts: 313
Re: [HowTo] Android Development Environment on Linux (FPCUPdeluxe + LAMW)
« Reply #73 on: October 22, 2021, 03:45:31 pm »
Ok, no copy, but now run temporany
aspetto di correre come mi hai detto

Please post example alignment control

Thanks.

loaded

  • Sr. Member
  • ****
  • Posts: 375
Re: [HowTo] Android Development Environment on Linux (FPCUPdeluxe + LAMW)
« Reply #74 on: October 22, 2021, 03:55:55 pm »
OK,
I'm at work right now, I'll send you a sample when I get home (about 2 hours).
If Ide=Lazarus 2.0.10 32 Bit and Os=Win 10 Home 64 Bit then Get up and do something useful! Because God is the helper of those who start again;

 

TinyPortal © 2005-2018