Tutorial: Build APK with Castle Game Engine lazarus / 43-Android ---------------------------------------------------------------------- lainz · 2018-08-11 15:31 Hi, I want to share my first experience compiling an APK with Castle Game Engine, and is really good =) I'm on Windows. I have installed Java, Android Studio, and succesfully ran an app with that IDE, so be sure that you can do this first, is a good way to see if your device can be connected to your PC. 1) Installing Lazarus: I used fpcupdeluxe to install trunk-trunk, then I installed the cross compiler arm-android with the same tool. 2) Install castle engine packages as described in his website https://castle-engine.io/documentation.php Basically is opening some lpk files, is easy. 3) Compile the build tool https://github.com/castle-engine/castle-engine/wiki/Build-Tool 4) Set some environment variables: ANDROID_HOME = where is installed android SDK ANDROID_NDK_HOME = where is extracted the android NDK CASTLE_ENGINE_PATH = where is the git repository of Castle Game Engine in PATH add your fpc binary, I have like this: C:\fpcupdeluxe\fpc\bin\i386-win32\ I have as well the variable JAVA_HOME. JDK added in path as well. Maybe these last two are not needed, and I had them because any other tool I tried in the past, I'm not sure. 5) Go to the folder where is some demo, I used the mobile folder, and then run this command: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i castle- engine.exe package --os=android --cpu=arm And then I got the apk built. 6) That apk can be installed by the same command line app, but I copy- paste it to my device. In order to install it with the command line tool, you need to sign the apk, seems that it's easy using just a plain text file, but I will try that the next time. Here a screenshot of the drawing app on my Android 7 device. Well, that's all, I covered just my experience, is well documented so you will not have problems I think... ---------------------------------------------------------------------- lucamar · 2018-08-11 15:36 Nice tut (if a little sparse ). Have you considered adding it to the wiki? ---------------------------------------------------------------------- lainz · 2018-08-11 15:41 Quote from: lucamar on August 11, 2018, 05:36:52 pmNice tut (if a little sparse ). Have you considered adding it to the wiki? Hi, yes is simple. I think it only can be usefull if is converted into a better tool. Like an already 'everything included' setup like Delphi does, so you don't need to do anything of this and just hitting the play button inside Lazarus. ---------------------------------------------------------------------- lucamar · 2018-08-11 15:51 Quote from: lainz on August 11, 2018, 05:41:31 pm[...] so you don't need to do anything of this and just hitting the play button inside Lazarus. Well, think that about 75% of your tut is basically the same as setting up Lazarus for Android development, so it's not that much. And you can run the tool by adding it as an external tool, so there goes another 20%. Not too much work, eh? ---------------------------------------------------------------------- lainz · 2018-08-11 16:22 Yes. But it can be better like a single setup, no path variables at all, a single download... But I know not all like that, is just my personal preference. ---------------------------------------------------------------------- lucamar · 2018-08-11 20:16 Quote from: lainz on August 11, 2018, 06:22:09 pmYes. But it can be better like a single setup, no path variables at all, a single download... But I know not all like that, is just my personal preference. I like "click-here-and-all-will-be-done"(tm) solutions, too ... provided that what happens after the click is configurable enough  I've been bitten too many times by "all-automatic-whatever"s that work in 90% of cases ... and let you naked in the sun as soon as you have an even slightly tricky install (or whatever else) to perform. Re "no path variables at all", I'm sure that it's easily doable reading the values from elsewhere: Lazarus/FPC config files, the registry in Windows, ... or taking them on the command line. Anyway, we are programmers: applications are never done! ---------------------------------------------------------------------- lainz · 2018-08-11 23:02 Indeed if these tools are made with no caution is worst than the tricky way. I'm not an IDE plugin builder. But they already had some integration like project templates. Maybe a better integration will be enough. And yes, there's no need to use path variables as you explained very well. And of course, that will only save me some minutes. The real work must be done anyways. ---------------------------------------------------------------------- Handoko · 2018-09-05 14:29 Quote from: lainz on August 11, 2018, 05:31:41 pmI'm on Windows. I need the tutorial for Linux. Can you please write it? ---------------------------------------------------------------------- lainz · 2018-10-01 20:12 Quote from: Handoko on September 05, 2018, 04:29:48 pmQuote from: lainz on August 11, 2018, 05:31:41 pmI'm on Windows. I need the tutorial for Linux. Can you please write it? I'm on Windows. Sure you can write it since you use Linux every day. ---------------------------------------------------------------------- cpicanco · 2018-10-07 19:28 Quote from: Handoko on September 05, 2018, 04:29:48 pmQuote from: lainz on August 11, 2018, 05:31:41 pmI'm on Windows. I need the tutorial for Linux. Can you please write it? It is already written. See: https://github.com/castle-engine/castle- engine/wiki/Android ---------------------------------------------------------------------- Handoko · 2018-10-08 01:54 Thank you for the link. I'll try it when I have time. ---------------------------------------------------------------------- castleapp · 2024-12-26 05:35 To build an APK with Castle Game Engine, use the engine's integration with Android Studio or Lazarus. Ensure you have the Android SDK/NDK set up, then compile your game project for Android, and package it into an APK through the engine’s tools or IDE settings.