Recent

Author Topic: laz4android .apk package build problem  (Read 10661 times)

BlueWings

  • Newbie
  • Posts: 5
laz4android .apk package build problem
« on: March 10, 2017, 11:37:29 am »
Hello Lazarus fans,

I've been devoded to pascal since mid-high school years (more than 20 ago today), has been payed for working as a developer for 8 years under Delphi, and now I'm looking for a suitable platform for object pascal on Android.
I hopefully found that Lazarus is capable of that.

I started here in the Wiki :
http://wiki.lazarus.freepascal.org/Android_tutorial

Everything went OK, except the following :
In section Deployment running "build_debug_apk.bat" failed, cos it couldn't find any program named "aapt.*" neither in c:\Android nor anywhere else on the whole C: drive. Error message :

Code: Pascal  [Select][+][-]
  1. c:\Android\Projects\androidlcl\android>REM Resource compilation
  2.  
  3. c:\Android\Projects\androidlcl\android>call aapt p -v -f -M AndroidManifest.xml
  4. -F bin\androidlcl.ap_ -I C:\Android\android-sdk\platforms\android-8\android.jar
  5. -S res -m -J gen raw
  6. 'aapt' is not recognized as an internal or external command,
  7. operable program or batch file.


Where can I find the "aapt" program ?

Thanks, Peter  ;D
« Last Edit: March 10, 2017, 11:44:08 am by BlueWings »

majid.ebru

  • Sr. Member
  • ****
  • Posts: 494
Re: laz4android .apk package build problem
« Reply #1 on: March 10, 2017, 12:19:59 pm »
i don't know what appt is??!?
.
.
.
i tried that and don;t answer it?!?!
.
.
.
i suggested use "LAMW"
http://wiki.lazarus.freepascal.org/LAMW

BlueWings

  • Newbie
  • Posts: 5
Re: laz4android .apk package build problem
« Reply #2 on: March 10, 2017, 12:48:57 pm »

Handoko

  • Hero Member
  • *****
  • Posts: 5122
  • My goal: build my own game engine using Lazarus
Re: laz4android .apk package build problem
« Reply #3 on: March 10, 2017, 02:33:31 pm »
Actually there are several different ways to build Android APKs using Lazarus. But as majid.ebru suggested, I also agree you should try LAMW, which I think is the most easiest and well-supported.

It's no harm if you want to try the other options. If you want to try Laz4Android, I would recommend you to use LazToApk. It will help you install and configure Laz4Android also other necessaries things automatically.

I guess you will interested to know all the available options which I knew. Here is the list I posted some months ago:
http://forum.lazarus.freepascal.org/index.php/topic,33487.msg217112.html#msg217112

Lazarus for Android development is still not good enough for serious production usage, many features are incomplete. It needs volunteers, testers and developers. Please share your experience, bug reports and whatever you know to help to improve it. I am a bit busy at the moment, I will be back to do more support for Lazarus Android development later.

BlueWings

  • Newbie
  • Posts: 5
Re: laz4android .apk package build problem
« Reply #4 on: March 12, 2017, 08:02:55 pm »
I've installed LAMW successfully, .apk files generating fine, two minor drawbacks are :

- It's not clear how the Android system calculates the placement of controls on the Form. Either it looks OK in the IDE and not on the phone, or vice versa, but I couldn't manage both. I'm almost sure I need to understand the exact working mechanism of properties LayoutParamHeigh, LayoutParamWidth, PosRelativeToAnchor, PosRelativeToParent. But I couldn't find help files for them.

- I saw there are plenty of available fine (looking) components in LAMW, but I couldn't find help files for them. As far as I experienced, it's way faster coding if you have the author's descriptions for method parameters, property meanings, etc. Identifiers are speaking as usual but not consistently enough - which is the result of community coworking.
It would be great help to have help :D
Does anyone know whether it even exists ?

Maybe tomorrow I will checkout the other tools you collected in the topic linked.

Thanks a lot Handoko, your post was really worthy !  :) ::)

Cheers, Peter

Handoko

  • Hero Member
  • *****
  • Posts: 5122
  • My goal: build my own game engine using Lazarus
Re: laz4android .apk package build problem
« Reply #5 on: March 12, 2017, 08:24:22 pm »
The developer of LAMW currently lacks of volunteers.

I wanted to build OpenGL ES app using LAMW, unfortunately I found a serious bug in the 3D camera. I tried to go in to code trying to fix it, but my knowledge about OpenGL is not sufficient.

LAMW has lots of useful components, but I agree it would be nice if it has documentation explaining their usage. About the layout and positioning, they also confusing me. Here are some posts, perhaps you can learn something from them:
http://forum.lazarus.freepascal.org/index.php/topic,33954.msg221298.html#msg221298
http://forum.lazarus.freepascal.org/index.php/topic,27913.msg173279.html#msg173279
https://developer.android.com/guide/topics/ui/layout/relative.html

Hope there will be more people join in this Android development, more users mean more bugs reported, faster improvement and bugfixes.

jmpessoa

  • Hero Member
  • *****
  • Posts: 2296
Re: laz4android .apk package build problem
« Reply #6 on: March 13, 2017, 03:40:12 am »

Hi BlueWings!


Here is some hints from "readme_get_start.txt"

Quote
FAQ: [Thanks to @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".

And, please,  go to "demos/GUI"  folder, open some
example to learn more about layout settings....
Lamw: Lazarus Android Module Wizard
https://github.com/jmpessoa/lazandroidmodulewizard

BlueWings

  • Newbie
  • Posts: 5
Re: laz4android .apk package build problem
« Reply #7 on: March 15, 2017, 12:41:10 am »
WoWWW, I haven't ever expected that the author himself will react to my post ...  :D  :D  :D

I will checkout everything posted here asap I had enough time.
This week I'm quite busy.

Thanks a lot for Everyone !  :D

Cheers, Peter

FerCastro

  • New member
  • *
  • Posts: 8
Re: laz4android .apk package build problem
« Reply #8 on: April 21, 2017, 06:35:41 pm »
Hello EveryBody

I just installed and configured LazToApk v0.9.0.37 and after a while and following all the steps described in the PDF guide I could create my first apk.

But i guess there is something I am missing because after the apk is deployed in my mobile device, I start  the app but I get the message "The application has stopped".

Updated, 11:42 am >> Well, the application starts, goes to black screen and after 10 senconds ends. But I can not see the controls in the screen.

What could be wrong? My app is only one button and one label.

Best regards and thanks in advance

FerCastro
« Last Edit: April 21, 2017, 06:43:03 pm by FerCastro »

Handoko

  • Hero Member
  • *****
  • Posts: 5122
  • My goal: build my own game engine using Lazarus
Re: laz4android .apk package build problem
« Reply #9 on: April 21, 2017, 06:49:50 pm »
Hello FerCastro,
Welcome to this forum.

I just installed and configured LazToApk v0.9.0.37 and after a while and following all the steps described in the PDF guide I could create my first apk.

Congratulation! You've managed to create your first apk.

What could be wrong? My app is only one button and one label.

I'm sorry to tell you there is a bug in Laz4Android (or maybe CustomDrawn). This bug has been reported a year ago, unfortunately it's still unfixed. AFAIK, the bug only affects on Android 5 and above. You may try to run that apk on Android 4 to see if it works correctly.

If you're interested in Android programming using Pascal, I recommend you to read more info here:
http://forum.lazarus.freepascal.org/index.php/topic,33487.msg217112.html#msg217112

FerCastro

  • New member
  • *
  • Posts: 8
Re: laz4android .apk package build problem
« Reply #10 on: April 21, 2017, 07:00:12 pm »
Hello Handoko, and thank You very much for Your quick response.

I have been trying several tools in order to create apk's using Pascal. It seems to be LaztoAPK is a good tool, congrats for this work.

So, about he bug, I can understand the tool is not able to build apks for Android 5 and above, right? Do You have any clue if the bug will be fixed?

Thanks in advance and thanks a lot for Your support.

FerCastro

Handoko

  • Hero Member
  • *****
  • Posts: 5122
  • My goal: build my own game engine using Lazarus
Re: laz4android .apk package build problem
« Reply #11 on: April 21, 2017, 07:15:41 pm »
I've been monitoring LazToApk and other potential Android programming tools in the forum more than a year ago. If I remember correctly, the bug is the in CustomDrawn widgetset, which has issue with the new Android API.

I would say LazToApk is the best if this bug already fixed. But for now, it's (almost) useless, nobody want to buy a new phone with Android less than 5.

Luckily you can try LAMW. It is actively developed and the developer is very nice. He always tries to answer any questions asked and willing to adopt any good feature requested. Give it a try, you won't regret.

Alternatively you may interest to know Pandroid. An user regulary updates his Pandroid development using Android-JVM in this forum:
http://forum.lazarus.freepascal.org/index.php/board,56.0.html

Handoko

  • Hero Member
  • *****
  • Posts: 5122
  • My goal: build my own game engine using Lazarus
Re: laz4android .apk package build problem
« Reply #12 on: April 21, 2017, 07:20:22 pm »
Do You have any clue if the bug will be fixed?

The bug has been reported. Some comments already added. But no one seems to be interested to fix it. Or perhaps it's really too hard to fix.

FerCastro

  • New member
  • *
  • Posts: 8
Re: laz4android .apk package build problem
« Reply #13 on: April 21, 2017, 07:27:00 pm »
Handoko

So, do You recommend LAMW?

Handoko

  • Hero Member
  • *****
  • Posts: 5122
  • My goal: build my own game engine using Lazarus
Re: laz4android .apk package build problem
« Reply #14 on: April 21, 2017, 07:31:02 pm »
Yep. I tried and love it. I don't use it not because it's bad but because it has some problems with the OpenGL features that I need.

 

TinyPortal © 2005-2018