Recent

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

MarkMLl

  • Hero Member
  • *****
  • Posts: 3460
Re: [HowTo] Android Development Environment on Linux (FPCUPdeluxe + LAMW)
« Reply #45 on: June 06, 2020, 01:08:13 pm »
I recommend you a Samsung phone, even the cheap ones are good. I have one with only 16gb of disk space (Samsung j5 prime, 2016 model) and I can install everything, except big games, but everything else works. With one of 32gb of space will be enough for everything else.

A friend sent me a Chinese large-screen 'phone a few months ago, and I ended up doing repeated Android reinstalls. I'm not saying that the 'phone is particularly good or bad, but the experience highlighted the necessity of (a) selecting a 'phone for which firmware images are available and (b) making sure that the processor can always be put into a "coldstart" mode where it will accept a new firmware image (none of this "locked for your own protection" lark) and that a suitable upload program for your chosen PC OS is available.

In this particular case the Phone was a King PPTV PP6000, the chip was Mediatek which has a low-level USB upload protocol baked in, and an uploader was available which ran on Linux provided that ModemManager was disabled.

MarkMLl
MT+86 & Turbo Pascal v1 on CCP/M-86, multitasking with LAN & graphics in 128Kb.
Pet hate: people who boast about the size and sophistication of their computer.
GitHub repositories: https://github.com/MarkMLl?tab=repositories

WayneSherman

  • Full Member
  • ***
  • Posts: 119
Re: [HowTo] Android Development Environment on Linux (FPCUPdeluxe + LAMW)
« Reply #46 on: June 05, 2021, 07:07:58 am »
Updated installation procedure to 2021-Jun-04 ver 1.4
(see first post)

Changes:
Code: Text  [Select][+][-]
  1. Simplified folder structure so everything is self-contained in one folder. ($HOME/android)
  2. Using one-button LAMW install from FPCUPdeluxe. (works great, thanks DonAlfredo!)
  3. Removed old work-arounds which are no longer required.
  4. Add a new work-around for LAMW with NDK r22 and higher.
  5. Tested on newer OS (Xubuntu 20.04 64-bit)
  6. Using OpenJDK 11 (previously was using ver 8)
  7. All dev tools and utilities have been updated to more recent versions.
  8. No longer need FPC/Lazarus trunk, so using stable builds of both.
  9. Logout is no longer needed to set environment variables.
  10. Added optional script to setup environment for command line work.
« Last Edit: June 05, 2021, 02:53:25 pm by WayneSherman »

WayneSherman

  • Full Member
  • ***
  • Posts: 119
Re: [HowTo] Android Development Environment on Linux (FPCUPdeluxe + LAMW)
« Reply #47 on: June 05, 2021, 04:39:07 pm »
Updated installation procedure to 2021-Jun-05 ver 1.5
(see first post)

Changes:
Code: Text  [Select][+][-]
  1. Removed work-around for LAMW when using NDK revision >= 22.
  2. This has been fixed in the latest LAMW git code.
  3. (Work around was incorrect anyway since the API level was needed by LAMW, not the NDK revision)
  4.  

jmpessoa

  • Hero Member
  • *****
  • Posts: 1980
Re: [HowTo] Android Development Environment on Linux (FPCUPdeluxe + LAMW)
« Reply #48 on: June 05, 2021, 05:51:47 pm »

Uptaded LAMW github!

Thank you!!
Lamw: Lazarus Android Module Wizard
https://github.com/jmpessoa/lazandroidmodulewizard

Windsurfer

  • Sr. Member
  • ****
  • Posts: 368
    • Windsurfer
Re: [HowTo] Android Development Environment on Linux (FPCUPdeluxe + LAMW)
« Reply #49 on: October 08, 2021, 03:42:07 pm »
Thanks for this guidance. Without it I would have spent weeks or months getting this far.

I used fpcupdeluxe to install fpc + Lazarus + LAMW into an Android folder in my user folder. I could not compile without an error so followed these instructions.
When I got to the point below, fpcupdeluxe had already created a tools folder.
My question is: should there be a tools/cmdline-tools folder or a cmdline-tools/tools folder or both?

Code: Pascal  [Select][+][-]
  1. # download and extract Android SDK Command Line Tools for Linux
  2. # from https://developer.android.com/studio/#downloads
  3. mkdir -p "$HOME/android/sdk/cmdline-tools"
  4. cd "$HOME/android/sdk/cmdline-tools"
  5. wget "https://dl.google.com/android/repository/commandlinetools-linux-7302050_latest.zip"
  6. unzip "commandlinetools-linux-7302050_latest.zip"
  7. rm "commandlinetools-linux-7302050_latest.zip"
  8. mv cmdline-tools tools

WayneSherman

  • Full Member
  • ***
  • Posts: 119
Re: [HowTo] Android Development Environment on Linux (FPCUPdeluxe + LAMW)
« Reply #50 on: October 08, 2021, 04:50:53 pm »
When I got to the point below, fpcupdeluxe had already created a tools folder.
My question is: should there be a tools/cmdline-tools folder or a cmdline-tools/tools folder or both?

It should be:  .../cmdline-tools/tools/

This can be seen from the next step (line 21):
cd "$HOME/android/sdk/cmdline-tools/tools/bin"

The tutorial assumes you are starting with an empty $HOME/android/ directory.  fpcupdeluxe is not used until after the command line tools have been installed.

Windsurfer

  • Sr. Member
  • ****
  • Posts: 368
    • Windsurfer
Re: [HowTo] Android Development Environment on Linux (FPCUPdeluxe + LAMW)
« Reply #51 on: October 09, 2021, 08:59:15 am »
Thanks very much. It is all working perfectly.

guaracy

  • New Member
  • *
  • Posts: 13
Re: [HowTo] Android Development Environment on Linux (FPCUPdeluxe + LAMW)
« Reply #52 on: October 14, 2021, 07:47:47 pm »
Maybe is better to use  xdg-user-dir than hardcoding "$HOME/Desktop/" directory. It handles localization of the filenames.

Something like this:

Code: Bash  [Select][+][-]
  1. # note: the following lines must be copy/pasted as one line, starting at "cat" and ending at "EOF"
  2. cat <<EOF > "`xdg-user-dir DESKTOP`/Android-Command-Line.desktop"
  3. [Desktop Entry]
  4. Type=Application
  5. Icon=utilities-terminal
  6. Exec=$HOME/android/set_dev_environment
  7. Name=Android-Command-Line
  8. Terminal=true
  9. StartupNotify=false
  10. EOF
  11. chmod +x "`xdg-user-dir DESKTOP`/Android-Command-Line.desktop"
  12.  

WayneSherman

  • Full Member
  • ***
  • Posts: 119
Re: [HowTo] Android Development Environment on Linux (FPCUPdeluxe + LAMW)
« Reply #53 on: October 18, 2021, 06:30:39 pm »
Maybe is better to use  xdg-user-dir than hardcoding "$HOME/Desktop/" directory. It handles localization of the filenames.

I like it.  Fixed.  Thank you.

laguna

  • Sr. Member
  • ****
  • Posts: 313
Re: [HowTo] Android Development Environment on Linux (FPCUPdeluxe + LAMW)
« Reply #54 on: October 19, 2021, 09:17:33 am »
AVD not start in ubuntu 18.04 help me

Thanks
Vincenzo

WayneSherman

  • Full Member
  • ***
  • Posts: 119
Re: [HowTo] Android Development Environment on Linux (FPCUPdeluxe + LAMW)
« Reply #55 on: October 19, 2021, 05:09:18 pm »
AVD not start in ubuntu 18.04 help me

I have not tested the emulator recently, but there are some instructions in the older "archived" how-to.  See post #3 in this same thread under the subheading "Installing and Using the Android Emulator".
« Last Edit: October 19, 2021, 05:11:35 pm by WayneSherman »

guaracy

  • New Member
  • *
  • Posts: 13
Re: [HowTo] Android Development Environment on Linux (FPCUPdeluxe + LAMW)
« Reply #56 on: October 20, 2021, 02:03:01 am »
Tested on Manjaro KDE 21.1.5  (Arch based distro) . Fresh install using VirtualBox.

Just change apt install lines #7-#9 by

Code: Bash  [Select][+][-]
  1. sudo pacman -S gtk2 jdk11-openjdk binutils make unzip gdb xterm

Everything else remains the same. :D


Line #29 to use fpcupdeluxe version v2.2.0c

Code: Bash  [Select][+][-]
  1. wget "https://github.com/LongDirtyAnimAlf/fpcupdeluxe/releases/download/v2.2.0c/fpcupdeluxe-x86_64-linux"

Better use xdg-user-dir in lines #47 and #48

Code: Bash  [Select][+][-]
  1. mv "$(xdg-user-dir DESKTOP)/fpcup-Lazarus_fpc-lazarus.desktop" "$(xdg-user-dir DESKTOP)/Lazarus-LAMW.desktop"
  2. sed -i "/^Name=/c\Name=Lazarus-LAMW" "$(xdg-user-dir DESKTOP)/Lazarus-LAMW.desktop"

laguna

  • Sr. Member
  • ****
  • Posts: 313
Re: [HowTo] Android Development Environment on Linux (FPCUPdeluxe + LAMW)
« Reply #57 on: October 20, 2021, 07:16:38 pm »
Not run Avdmanager, please help me.

Code: Pascal  [Select][+][-]
  1. Exception in thread "main" java.lang.NoClassDefFoundError: javax/xml/bind/annotation/XmlSchema
  2.         at com.android.repository.api.SchemaModule$SchemaModuleVersion.<init>(SchemaModule.java:156)
  3.         at com.android.repository.api.SchemaModule.<init>(SchemaModule.java:75)
  4.         at com.android.sdklib.repository.AndroidSdkHandler.<clinit>(AndroidSdkHandler.java:81)
  5.         at com.android.sdklib.tool.AvdManagerCli.run(AvdManagerCli.java:213)
  6.         at com.android.sdklib.tool.AvdManagerCli.main(AvdManagerCli.java:200)
  7. Caused by: java.lang.ClassNotFoundException: javax.xml.bind.annotation.XmlSchema
  8.         at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:581)
  9.         at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
  10.         at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:522)
  11.         ... 5 more
  12.  

thanks
Vincenzo



jmpessoa

  • Hero Member
  • *****
  • Posts: 1980
Re: [HowTo] Android Development Environment on Linux (FPCUPdeluxe + LAMW)
« Reply #58 on: October 20, 2021, 09:01:00 pm »
Quote
Not run Avdmanager, please help me.

Can you run in "real" device?
Lamw: Lazarus Android Module Wizard
https://github.com/jmpessoa/lazandroidmodulewizard

laguna

  • Sr. Member
  • ****
  • Posts: 313
Re: [HowTo] Android Development Environment on Linux (FPCUPdeluxe + LAMW)
« Reply #59 on: October 21, 2021, 08:18:29 am »
I have remove java 11 now

Run  on device  before remove java 11



the error not show

but lazarus after run app show form for create avd but not open interface of create

Thanks
« Last Edit: October 21, 2021, 08:34:15 am by laguna »

 

TinyPortal © 2005-2018