Recent

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

JackDca

  • New Member
  • *
  • Posts: 16
Re: [HowTo] Android Development Environment on Linux (FPCUPdeluxe + LAMW)
« Reply #30 on: January 27, 2020, 06:23:47 pm »
Hello Handoko,

OK, I studied the link that you pointed me at. I think there's some information missing.

You say to  configure LayoutParamHeight.

How? 

Is there a dialog to do this?

Do I edit a text file?

Is there an example somewhere?

Would really appreciate your guidance. I have searched through the wikis and I am not finding anything helpful.

Thanks

jmpessoa

  • Hero Member
  • *****
  • Posts: 2296
Re: [HowTo] Android Development Environment on Linux (FPCUPdeluxe + LAMW)
« Reply #31 on: January 27, 2020, 06:51:56 pm »

from:

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

Quote
[FAQ 2]: [Thanks to Ahmad Bohloolbandi (a.k.a. @developing) ]

#Question: How do we can design a layout that shown same in real device?

[Answer]: You should use the component properties:

      "Anchor",
      "PosRelativeToParent",
      "PosRelativeToAnchor",
      "LayoutParamHeight",
      "LayoutParamWhidth"
         
Example:

1-Put a "jTextView" component on your AndroidModule form:

   Set "PosRelativeToParent"
      "rpCenterHorizontal" [True]
      "rpTop" [True]

2-Put a "jButton" component on AndroidModule form:

   Set "Anchor" to "jTextView" (Because you should set position relative with "jTextView")
   set "PosRelativeToAnchor"
      "raBelow" [True]

3-Put a "jEditText" component on form:

   Set "Anchor" to "jButton".
   Set "PosRelativeToAnchor"
      "raBelow" [True]

NOTE:    Anchor setting is most important section of this design,
   because your component position depends on this property.
   And for change width and/or height of each components you should
   change/configure "LayoutParamWhidth" and/or "LayoutParamHeight".
Lamw: Lazarus Android Module Wizard
https://github.com/jmpessoa/lazandroidmodulewizard

Handoko

  • Hero Member
  • *****
  • Posts: 5122
  • My goal: build my own game engine using Lazarus
Re: [HowTo] Android Development Environment on Linux (FPCUPdeluxe + LAMW)
« Reply #32 on: January 27, 2020, 06:56:00 pm »
@JackDca

My computer has some some minor issues, I can't run my LAMW. I'm going to explain using what I can remember.

Try to click the component you want to set its layout, for example click your "JButton1". Then in the Object Inspector, you should able to find these properties:
- Anchor
- LayoutParamHeight
- LayoutParamWidth
- PosRelativeToAnchor
- PosRelativeToParent

LayoutParamHeight and LayoutParamWidth are used to configure the size of the component. PosRelativeToAnchor and PosRelativeToParent are needed to set the position of the component. For example you want the component to be set to the center its parent, you set PosRelativeToParent := rpCenterHorizontal; And to set the y position of the component, you need the set the Anchor.

Also, you may need to set the margins.

Because Android apps need to 'look' good on any screen resolution and allow users to freely change its orientation (landscape/portrait), you do not set the component's position values directly. Instead you have to set how the component is related to the others.
« Last Edit: January 27, 2020, 06:58:52 pm by Handoko »

JackDca

  • New Member
  • *
  • Posts: 16
Re: [HowTo] Android Development Environment on Linux (FPCUPdeluxe + LAMW)
« Reply #33 on: January 27, 2020, 07:36:57 pm »
@Handoko and @jmpessoa,

The fact that Object Inspector is used to set the parameters was the missing piece of information. Probably obvious to you, but not to this newbie!

Thanks again.

Handoko

  • Hero Member
  • *****
  • Posts: 5122
  • My goal: build my own game engine using Lazarus
Re: [HowTo] Android Development Environment on Linux (FPCUPdeluxe + LAMW)
« Reply #34 on: January 27, 2020, 07:43:49 pm »
You're right. I forgot to tell you where to find them.  :D

JackDca

  • New Member
  • *
  • Posts: 16
Re: [HowTo] Android Development Environment on Linux (FPCUPdeluxe + LAMW)
« Reply #35 on: January 29, 2020, 06:09:06 pm »
OK, sorry to be a pest, but ...

I am now getting the following error termination when I do a Lazarus Run-Build of the "simple test project" as per Reply #2:

Messages
Verbose: Selected chip architecture: armeabi-v7a
Verbose: Taking libraries from folder: /home/jack/Projects/TestAndroid2/libs/armeabi-v7a
Compile Project, OS: android, CPU: arm, Target: /home/jack/Projects/TestAndroid2/libs/armeabi-v7a/libcontrols.so: Exit code 1, Errors: 1
Fatal: Cannot find system used by controls. Make sure all ppu files of a package are in its output directory. ppu in wrong directory=/home/jack/fpcupdeluxe/fpc/units/arm-android/rtl/system.ppu..

This is very strange in that I have done successful builds before. Thinking that I had perhaps corrupted something in the Lazarus setup, I restored a copy of the virtual machine that I had saved immediately after installing Lazarus (including "Path Settings"), and before doing my first successful Lazarus build. The problem is still there. I think I am doing everything exactly the same way that I did it previously, but clearly I am not.

The only idea I have had is that the Build process is pulling something from the Internet that has changed in the last few days.

Any suggestions?

Thank you for your help.
« Last Edit: January 29, 2020, 06:13:43 pm by JackDca »

jmpessoa

  • Hero Member
  • *****
  • Posts: 2296
Re: [HowTo] Android Development Environment on Linux (FPCUPdeluxe + LAMW)
« Reply #36 on: January 29, 2020, 06:29:20 pm »

You can try a "New Project"   .... 
Lamw: Lazarus Android Module Wizard
https://github.com/jmpessoa/lazandroidmodulewizard

JackDca

  • New Member
  • *
  • Posts: 16
Re: [HowTo] Android Development Environment on Linux (FPCUPdeluxe + LAMW)
« Reply #37 on: January 31, 2020, 04:35:20 pm »
OK - problem solved - after some searching on the Internet and especially this post (thanks again to @jmpessoa and other posters):

https://forum.lazarus.freepascal.org/index.php?topic=41918.0

The "Fatal: Cannot find system used by controls." message appears to be caused by a mismatch between the chipset specified when setting up Lazarus with fpcupdeluxer and the chipset specified when doing Run-Build with Lazarus.

In my first setup these appear to have been configured to match, but later the chipset for the build had changed, perhaps unwittingly by me, or perhaps because it reverted to a default.

in any case, it was fixed in Lazarus by
Project-Project Optinos-LAMW Android Project Options-Build-Chipset
and selecting ArmV7APv3 (which apparently had been changed to ArmV7A+Soft).

While there you might want to turn off most of the permissions to be requested by the application. The default is to request all permissions, which seems a bit dangerous. This is at
Project-Project Optinos-LAMW Android Project Options-Android Manifest-Permissions.

circular

  • Hero Member
  • *****
  • Posts: 4181
    • Personal webpage
Those are great instructions, this is quite complex indeed.

I installed everything, made the test program, but when I run the emulator, the screen remains black, and at some point my computer freezes. Even the mouse cursor cannot move anymore. Then I have only the option of pressing the power buttons for 4 seconds to turn off the computer.
Conscience is the debugger of the mind

Seenkao

  • Hero Member
  • *****
  • Posts: 546
    • New ZenGL.
do not use emulator

Эмулятор не работает с JNI. (does not work with jni)
Rus: Стремлюсь к созданию минимальных и достаточно быстрых приложений.

Eng: I strive to create applications that are minimal and reasonably fast.
Working on ZenGL

circular

  • Hero Member
  • *****
  • Posts: 4181
    • Personal webpage
Ok. Hmm well then I would need to buy an Android phone.
Conscience is the debugger of the mind

lainz

  • Hero Member
  • *****
  • Posts: 4449
    • https://lainz.github.io/
Ok. Hmm well then I would need to buy an Android phone.

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.

This is a new model, cheap but good (i'm not sponsoring, just sharing my opinion)
https://www.amazon.es/s?k=Samsung+Galaxy+A10&rh=p_n_availability%3A-1&ascsubtag=64168&linkCode=osi&tag=choyfichas-21

My opinion is to start with it at least, but if you can buy a better one, better of course =)

circular

  • Hero Member
  • *****
  • Posts: 4181
    • Personal webpage
Cool, thanks for the tip!  :)
Conscience is the debugger of the mind

Thyphoon

  • New Member
  • *
  • Posts: 37
This is a bit old, but you can use memu or any other emulator, just need to connect it via adb:

https://forum.lazarus.freepascal.org/index.php/topic,49286.msg356821.html#msg356821

circular

  • Hero Member
  • *****
  • Posts: 4181
    • Personal webpage
Re: [HowTo] Android Development Environment on Linux (FPCUPdeluxe + LAMW)
« Reply #44 on: June 06, 2020, 11:33:04 am »
Memu seems to be for Windows only.
Conscience is the debugger of the mind

 

TinyPortal © 2005-2018