Recent

Author Topic: APK creation on mac  (Read 10943 times)

saashapont

  • New member
  • *
  • Posts: 39
APK creation on mac
« on: July 26, 2016, 03:00:45 pm »
Are there any tutorial about creation of apk files from Lazarus on Mac computer. I read about this for linux and windows^ but this solutions is not work :(

skalogryz

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2103
    • havefunsoft.com
Re: APK creation on mac
« Reply #1 on: July 26, 2016, 03:05:30 pm »
how come linux solution doesn't work? (what linux instructions did you follow?)
Patron Cocoa Widgetset development https://www.patreon.com/skalogryz

saashapont

  • New member
  • *
  • Posts: 39
Re: APK creation on mac
« Reply #2 on: July 26, 2016, 03:12:48 pm »
I try to use this
http://wiki.lazarus.freepascal.org/Android_Interface#Configuring_the_Free_Pascal_Compiler_for_Android

And I cannot do part
Compiling the example LCL Android Application

skalogryz

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2103
    • havefunsoft.com
Re: APK creation on mac
« Reply #3 on: July 26, 2016, 03:17:14 pm »
And I cannot do part
Compiling the example LCL Android Application
is there a particular error message shown? what exactly stops you?
Patron Cocoa Widgetset development https://www.patreon.com/skalogryz

saashapont

  • New member
  • *
  • Posts: 39
Re: APK creation on mac
« Reply #4 on: July 26, 2016, 03:21:25 pm »
I compile well for other linux arm device^ but when i add folder /Volumes/MacHD2/Android/android-ndk-r10e/platforms/android-21/arch-arm  to the library i have errors
Compile Project, OS: linux, CPU: arm, Target: project1: Exit code 256, Errors: 1
/sw/bin/arm-linux-ld: warning: link.res contains output sections; did you forget -T?
/Volumes/MacHD2/Android/android-ndk-r10e/platforms/android-21/arch-arm/usr/lib//libc.so: warning: the use of `pthread_attr_getstackaddr' is deprecated, use `pthread_attr_getstack'
/Volumes/MacHD2/Android/android-ndk-r10e/platforms/android-21/arch-arm/usr/lib//libc.so: warning: the use of `pthread_attr_setstackaddr' is deprecated, use `pthread_attr_setstack'
/sw/bin/arm-linux-ld: /sw/lib/fpc/3.0.0/units/arm-linux/rtl/cwstring.o: undefined reference to symbol 'nl_langinfo@@GLIBC_2.4'
/sw/bin/arm-linux//libc.so.6: error adding symbols: DSO missing from command line
project1.lpr(22,0) Error: Error while linking

skalogryz

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2103
    • havefunsoft.com
Re: APK creation on mac
« Reply #5 on: July 26, 2016, 05:04:53 pm »
Why are you using arm-linux as target? Should it be arm-android instead?

At least it appears like you're mixing arm-linux libs and arm-android (ndk) libs.

Android is more or less a fork of linux, thus mixing linux and android libs is undesirable.
« Last Edit: July 26, 2016, 05:06:44 pm by skalogryz »
Patron Cocoa Widgetset development https://www.patreon.com/skalogryz

saashapont

  • New member
  • *
  • Posts: 39
Re: APK creation on mac
« Reply #6 on: July 26, 2016, 05:23:03 pm »
Are there any precompile croscompilators for android on mac?

Handoko

  • Hero Member
  • *****
  • Posts: 3041
  • My goal: build my own game engine using Lazarus
Re: APK creation on mac
« Reply #7 on: July 27, 2016, 05:05:06 am »
There are several options to build APKs using Lazarus/FPC:

- FPC JVM
http://wiki.lazarus.freepascal.org/FPC_JVM_Android_Development

- Laz4Android
This package uses Custom Drawn Interface.
https://sourceforge.net/projects/laz4android/

- LazToApk
This tool will help you automatically download Laz4Android, Android SDK & NDK, configure and perform cross compiling.
https://sourceforge.net/projects/laztoapk/

- Lazarus Android Module Wizard (LAMW)
It has its own Form Designer and lots of ready to use components.
https://github.com/jmpessoa/lazandroidmodulewizard

- LazSDL2Design Package
Similar to LAMW, it has its own Form Designer and components.
http://forum.lazarus.freepascal.org/index.php/topic,33008.0.html

All of them are able to build simple Android apps, but I don't think they're mature enough for serious production use for now. And your chances for success are better if you use it on Windows or Linux environment. For Mac users, you can use VirtualBox:
https://www.virtualbox.org/wiki/Downloads

tintinux

  • Sr. Member
  • ****
  • Posts: 297
    • Gestinux
Re: APK creation on mac
« Reply #8 on: August 02, 2016, 08:14:02 am »
Quote from: handoko
- Laz4Android
This package uses Custom Drawn Interface.

Are you sure ?
AFAIK it's LazToApk which is using CD Interface. And unfortunately CD interface currently doesn't work on Android >= 5.
Or things have changed ?

Regards
Initiator of gestinux, open-source, multi-database and multilingual accounting and billing software made with LAZARUS.

You can help to develop, to make and improve translations, and to provide examples of legal charts and reports from more countries.

Handoko

  • Hero Member
  • *****
  • Posts: 3041
  • My goal: build my own game engine using Lazarus
Re: APK creation on mac
« Reply #9 on: August 02, 2016, 08:54:01 am »
Quote from: handoko
- Laz4Android
This package uses Custom Drawn Interface.

Are you sure ?

Perhaps, I was wrong.

I ever installed Laz4Android and LazToApk, and performed some simple tests only. Because as mentioned, Custom Drawn Interface has issue with Android 5, so I stopped to learn deeper.

After I installed Laz4Android, I got impression that Laz4Android was using Custom Drawn Interface because the tutorial told us to enable Custom Drawn package (in section: Rebuild Laz4Android IDE):
http://wiki.lazarus.freepascal.org/Android_tutorial

If I'm not wrong, although Laz4Android is using Custom Drawn by default, it  can support LAMW too.

saashapont

  • New member
  • *
  • Posts: 39
Re: APK creation on mac
« Reply #10 on: August 02, 2016, 03:50:40 pm »
OK now I make croscompiller from 3.1.1 for android and it is work from command line like
sudo /sw/bin/ppcrossarmAndroid -Tandroid -Parm -XS  -dANDROID -Xd -CpARMV6 -FLlibdl.so hello.pas

I want try to use Custom Drawn Interface controls.
1. I install this package
2. Create new project
3. set  Target OS android Target CPU arm Target processor default, Target file name : android\libs\armeabi\liblclapp.so,  Enable strip symbols (-Xs)

And has error
Hint: (11030) Start of reading config file /sw/etc/fpc.cfg
Hint: (11031) End of reading config file /sw/etc/fpc.cfg
Free Pascal Compiler version 3.1.1 [2016/08/02] for arm
Copyright (c) 1993-2016 by Florian Klaempfl and others
(1002) Target OS: Android for ARMEL
(3104) Compiling lcl.pas
(3104) Compiling ./gtk2/alllclintfunits.pas
(3104) Compiling ./gtk2/gtk2cellrenderer.pas
/sw/share/lazarus/lcl/interfaces/./gtk2/gtk2cellrenderer.pas(30,3) Fatal: (10022) Can't find unit gtk2 used by Gtk2CellRenderer
Fatal: (1018) Compilation aborted

How i can fix that?

Handoko

  • Hero Member
  • *****
  • Posts: 3041
  • My goal: build my own game engine using Lazarus
Re: APK creation on mac
« Reply #11 on: August 02, 2016, 04:05:14 pm »
Did you compiling it on Mac? Or Linux?

If you're using Mac, I will suggest you to use VirtualBox. Android development using Lazarus/FPC hasn't properly tested on Mac. I'm not a Mac user, nothing much I can help.

If you're a Windows user, I will recommend you to try Laz4Apk first which is much more beginner friendly.

If you're a Linux user, LAMW would be the best one. I specialize myself in using LAMW. It might be a bit challenging for newbies, but if you follow the documentation properly, there should be no problem.

Good luck!

edited:
I saw the error messages you provided. It seems you haven't properly install Custom Drawn package, because there are many "gtk" things found in the messages.
« Last Edit: August 02, 2016, 04:14:54 pm by Handoko »

saashapont

  • New member
  • *
  • Posts: 39
Re: APK creation on mac
« Reply #12 on: August 02, 2016, 04:09:47 pm »
Mac, i try to use it

Handoko

  • Hero Member
  • *****
  • Posts: 3041
  • My goal: build my own game engine using Lazarus
Re: APK creation on mac
« Reply #13 on: August 02, 2016, 04:14:11 pm »
I guess, what you've done is just Cross Compile to Android preparation. You still have to install Custom Drawn Interface. More info here:
http://wiki.lazarus.freepascal.org/Android_tutorial

Follow the link above and find the "Rebuild Lazarus IDE" topic (near the end of page).

Or follow this steps:
1. Goto Lazarus main menu
2. Package > Install/Uninstall Packages
3. On the right side, type "custom drawn", then select "customdrawn 0.0"
4. Click the "Install selection" button
5. Click the "Save and rebuild IDE" button
« Last Edit: August 02, 2016, 04:20:11 pm by Handoko »

saashapont

  • New member
  • *
  • Posts: 39
Re: APK creation on mac
« Reply #14 on: August 02, 2016, 05:19:10 pm »
i did it