Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Classic Chat / One-click Android build!

Author
Message
JimHawkins
15
Years of Service
User Offline
Joined: 26th Jul 2009
Location: Hull - UK
Posted: 6th Jan 2013 00:20
I've succeeded in getting AppGameKit Pascal to build and deploy an APK file with one click (or key-press) - namely Build in Lazarus.

This is using only scripted calls to the android SDK and NDK.

Neither Eclipse nor Cygwin are required at all. This massively simplifies the installation process and all the Cygwin nonsense, and is heading towards the kind of transparency that many people have been wanting.

There are some things I need to do to automate this fully in terms of code-signing and project naming replacements etc., but we are talking days, not weeks!

For example, I loaded the SmackIt project, and it built a working debug APK in 15 seconds. Joy.

-- Jim DO IT FASTER, EASIER AND BETTER WITH AppGameKit FOR PASCAL
xCept
21
Years of Service
User Offline
Joined: 15th Dec 2002
Location:
Posted: 6th Jan 2013 00:36
Sounds awesome! I remember it being painful trying to get everything setup and configured for Android when I last tried. Congrats
JimHawkins
15
Years of Service
User Offline
Joined: 26th Jul 2009
Location: Hull - UK
Posted: 6th Jan 2013 01:03
It's very confusing for everybody, not just people new to it, isn't it? Eliminating several labour-intensive steps at install and develop time has to be good news!

It's not my province, but I see so many problems with C/C++ templates etc that I think that whole T2 area needs be re-examined. I certainly don't see any need for Cygwin. The Pascal templates contain the output folders for all platform builds. Why don't the C++ templates work like that?

Eclipse is simply a GUI over the SDK/NDK calls anyway, so what not just use them?

-- Jim DO IT FASTER, EASIER AND BETTER WITH AppGameKit FOR PASCAL
Daniel TGC
Retired Moderator
17
Years of Service
User Offline
Joined: 19th Feb 2007
Location: TGC
Posted: 6th Jan 2013 10:59
Does this include icons, zipaligning the apk and signing it with your digital certificate? Or is it a debug build?
Hodgey
15
Years of Service
User Offline
Joined: 10th Oct 2009
Location: Australia
Posted: 6th Jan 2013 11:06
Quote: "I see so many problems with C/C++ templates etc that I think that whole T2 area needs be re-examined. "

Most of the templates (for 1076 at least) I've been able to handle however the Android template on my mac was giving me a lot of strife. Turns out that most of the problems were within Eclipse/SDK/NDK. All I can say is that I'm very grateful for google.

Nice job on the one click build!

JimHawkins
15
Years of Service
User Offline
Joined: 26th Jul 2009
Location: Hull - UK
Posted: 6th Jan 2013 12:36
@daniel - Everything, debug or release if you have a certificate. It's only using the same tools that Eclipse uses. This is the technique that Monkey uses.

I'll do what I need to do and make a demo video later this week.

-- Jim DO IT FASTER, EASIER AND BETTER WITH AppGameKit FOR PASCAL
lilpissywilly
AGK Developer
14
Years of Service
User Offline
Joined: 10th Sep 2010
Location: Office Chair
Posted: 6th Jan 2013 12:55
This would be excellent. Great job!

My hovercraft is full of eels
bjadams
AGK Backer
16
Years of Service
User Offline
Joined: 29th Mar 2008
Location:
Posted: 6th Jan 2013 14:37
I don't use Cygwin, I had posted info last year, but TGC were not that much interested, and kept the official GUIDE with the unnecessary Cygwin system
JimHawkins
15
Years of Service
User Offline
Joined: 26th Jul 2009
Location: Hull - UK
Posted: 6th Jan 2013 18:15
@bj - As far as I can understand the only purpose of installing and messing with Cygwin is to create a few folders and set privileges that could be automatic in Windows with about two seconds' work in template design.

It takes THREE calls to SDK/NDK functions to build an entire app (assuming that the front-end compiler has generated the necessary .o files and the template has sensible manifests). The well-designed Pascal templates include the necessary folders for all platforms, most XML and other files. This seems to me to be a good model, which I assume could be applied to the C++ templates with a bit of thought.

In Lazarus (the Free Pascal IDE) the template contains all the instructions to build and (potentially) link the source and library code. When the build is finished it will run a post-build batch file. Normally this just copies materials into the assets folder for android, but it can call whatever you want.

Much as I think C++ is about the ugliest computer language ever bolted on to a slightly less ugly language, and much as I would prefer people to see the light and use Object Pascal, these simplifications may be vital for the future of AGK. I suspect that about an hour's informed work could commit Cygwin and Eclipse to the dustbin of over-complication for all levels.

-- Jim DO IT FASTER, EASIER AND BETTER WITH AppGameKit FOR PASCAL
Paul Johnston
TGC Developer
22
Years of Service
User Offline
Joined: 16th Nov 2002
Location: United Kingdom
Posted: 6th Jan 2013 20:26
I did some work on building APKs from tier 1 code for Freedom Engine, and I would like to include this in AppGameKit probably as part of the new IDE.

I managed to avoid having the Android SDK installed as I could just replace the assets folder of an existing APK and zip it up to produce a new APK. It still requires the Java JDK installed in order to sign it though, does your method require the JDK also?
MrValentine
AGK Backer
13
Years of Service
User Offline
Joined: 5th Dec 2010
Playing: FFVII
Posted: 6th Jan 2013 21:22
Hopefully this will make sense to me soon...

Ancient Lady
Valued Member
20
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 6th Jan 2013 23:43
It would be nice to do something for Tier 2 as well.

Cheers,
Ancient Lady
AGK Community Tester and AppGameKit Master
JimHawkins
15
Years of Service
User Offline
Joined: 26th Jul 2009
Location: Hull - UK
Posted: 6th Jan 2013 23:59
@Paul - As far as I can see without a lot of checking, the main tools are all in the SDK. The key one is ant. This requires the usual folders of project and XML files, together with assets, but, additionally, Build.xml - from which it gets instructions.

The SDK tools folder contains a batch file called android.bat which contains commands to refresh, scan and create the Build.XML file. After this the command "ant debug" will create zip-aligned and non-aligned APK files. Given the addition of a key-store file, the command "ant release" will build a release APK.

Fundamentally, all this Java stuff is doing is creating a special zip file with .APK extension and various manifests and Java run-time bits. I'd personally let the SDK do the heavy lifting on this rather roll my own, because we don't know what changes will be made in the future, and updating the SDK is easier than modifying our own code.

@MrValentine - all it means is that Cygwin and Eclipse are not actually needed to produce an Android APK file!

-- Jim DO IT FASTER, EASIER AND BETTER WITH AppGameKit FOR PASCAL
MrValentine
AGK Backer
13
Years of Service
User Offline
Joined: 5th Dec 2010
Playing: FFVII
Posted: 7th Jan 2013 00:44
Thanks JimHawkins, my point was that I am yet to attempt this process

BatVink
Moderator
21
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 7th Jan 2013 15:20
This is good news. The last time I built for Android I decided it wasn't too bad, and 60% of was a one-off, and could be reused for other projects.

Then versions were updated, which meant the 60% reusable stuff was no longer reusable.

Then time passed, and I forgot what I had done previously, so the stepped instructions came back out.

I look forward to seeing your simplified solution.

bjadams
AGK Backer
16
Years of Service
User Offline
Joined: 29th Mar 2008
Location:
Posted: 9th Jan 2013 14:35
Same here, I forgot what I did last year, on agk 1076, but all was working fine
JimHawkins
15
Years of Service
User Offline
Joined: 26th Jul 2009
Location: Hull - UK
Posted: 9th Jan 2013 15:01 Edited at: 9th Jan 2013 17:04
I may be a bit longer than I thought. My teenage grandson' staying and poured boiling water all over his arm. (Note: that's the bit between shoulder and hand, not the ARM). Much time spent hanging about in medical places.

-- Jim DO IT FASTER, EASIER AND BETTER WITH AppGameKit FOR PASCAL
BatVink
Moderator
21
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 9th Jan 2013 16:33
ouch, that's not good, hope he's okay.

Of course I have to follow up on your other comment. I can imagine geeks everywhere reading your post saying "Noooo! He destroyed his tablet, poor guy!"

JimHawkins
15
Years of Service
User Offline
Joined: 26th Jul 2009
Location: Hull - UK
Posted: 9th Jan 2013 17:10
You would think that at 17.5 years one would know that turning around to speak to a girlfriend whilst pouring boiling water into a mug was dumb behaviour, wouldn't you? Oh - OK.

He's fine. Sore. Blistered. Teenage. Daft.

-- Jim DO IT FASTER, EASIER AND BETTER WITH AppGameKit FOR PASCAL
bjadams
AGK Backer
16
Years of Service
User Offline
Joined: 29th Mar 2008
Location:
Posted: 10th Jan 2013 00:15
Jim, Tea Tree Essential oil works wonders for burns
easter bunny
12
Years of Service
User Offline
Joined: 20th Nov 2012
Playing: Dota 2
Posted: 11th Jan 2013 09:04
Wonderful, now i just need one that will work with T1

There are 10 types of people, those who understand binary and those who don't
JimHawkins
15
Years of Service
User Offline
Joined: 26th Jul 2009
Location: Hull - UK
Posted: 13th Jan 2013 12:09
I've been a bit stalled on this for family and work reasons, so I'm afraid it will be a few days before I can complete it. But not years or even weeks!

-- Jim DO IT FASTER, EASIER AND BETTER WITH AppGameKit FOR PASCAL
Lavaflyer
12
Years of Service
User Offline
Joined: 2nd Jul 2012
Location: Wisconsin, U.S.
Posted: 20th Jan 2013 20:29 Edited at: 20th Jan 2013 20:32
Anything new on this? cuz I've been w8in to port my game Block Ooo (https://itunes.apple.com/us/app/block-ooo/id581706286?mt=8) over to android because I saw this. Just curious on your progress, thanks!
JimHawkins
15
Years of Service
User Offline
Joined: 26th Jul 2009
Location: Hull - UK
Posted: 20th Jan 2013 23:08
As I said earlier, I've been tied up with a whole heap of other things to do. But I have managed to get a few hours in, and hope to have at least an alpha project management system that will automatically build the necessary scripts. I've been doing that by hand for testing.

You will need to have installed:

*Jave RTE
*Android SDK
*Android NDK

but you will not need to mess with them at all ))

Sorry for the delay. Apart from my grandson badly scalding his arm, my buddy and company co-director has been quite ill and needs a heart valve replacement, so we've had to pull some things forward on our schedule because he'll be out of action for a couple of months.

-- Jim DO IT FASTER, EASIER AND BETTER WITH AppGameKit FOR PASCAL
JimHawkins
15
Years of Service
User Offline
Joined: 26th Jul 2009
Location: Hull - UK
Posted: 21st Jan 2013 13:55
I promised a quick video, and here it is:

http://youtu.be/-pfJvHwoLVk

There is still work to do to generate the .BAT and a few other files automatically, but that's just ordinary run-of-the mill programming.

I'll put the actual batch file up here for you to modify if you're desparate - but be warned that several other files are needed for a full build!



You will need to substitute paths to android tools with your own, unless you have added it to %PATH%

For automatic signing you will need to have created a keystore using keytool, created a text file called ant.properties, and included the relevant information:



It's not regarded as good practice to put keystore passwords into a file - but here I have used the defaults in the android documentation.

As you will have seen, there is no need to mess about with cygwin or Eclipse - just alter your source as you develop and a few seconds later you're up and running. The batch file only needs to be created once for a project (well, maybe twice for debug and release versions).

-- Jim DO IT FASTER, EASIER AND BETTER WITH AppGameKit FOR PASCAL
Ancient Lady
Valued Member
20
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 21st Jan 2013 17:00
JimHawkins, would you be willing to share the complete set of batch files and scripts (like android.bat) with me? I would then try to make something that could be used for Tier 2 users. (Maybe not one-click from Visual Studio, but something that could do the full build and export to Android device without using Eclipse.)

Cheers,
Ancient Lady
AGK Community Tester and AppGameKit Master
JimHawkins
15
Years of Service
User Offline
Joined: 26th Jul 2009
Location: Hull - UK
Posted: 21st Jan 2013 19:30
Actually - all I've done here is make some additions to Erik's already existing .BAT file to use ant.

The android tool is in ($SDK)/tools
The ant tool is available here:

http://ant.apache.org/bindownload.cgi

To make a debug run, simply change:

ant release

to

ant debug

The ant.properties file is only needed for release.

So all I've really done is to read a LOT of obscure documentation and whittle it down to the bare bones! I'll take a look at the Tier 2 files later tonight and see if I can advise.

-- Jim DO IT FASTER, EASIER AND BETTER WITH AppGameKit FOR PASCAL
Ancient Lady
Valued Member
20
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 21st Jan 2013 19:50
When I do Tier 2 Android, I use cygwin shell scripts (in a cygwin window) to copy all of the .cpp/.h and media files from the VS project directory. Then it deletes ones specific to VS and does a clean and build.

But I don't have it set up to do the apk build, I suppose that is the ant process. I currently use Eclipse for that. And Eclipse does come in handy when there are things that don't work right (like anything in initial builds for the 108 beta, especially v1085+ with Facebook).

I'd love to be able to build a simple batch file that handled it all without ever getting into cygwin and Eclipse. Simple means allowing entering source and target directories.

(Installing ant now.)

Cheers,
Ancient Lady
AGK Community Tester and AppGameKit Master
bjadams
AGK Backer
16
Years of Service
User Offline
Joined: 29th Mar 2008
Location:
Posted: 21st Jan 2013 20:44 Edited at: 21st Jan 2013 20:44
AL for T2 you don't need to use any scripts.

just use this: http://mobilepearls.com/labs/ndk-builder-in-eclipse/

compile and run, it's just 1 keypress!
Ancient Lady
Valued Member
20
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 21st Jan 2013 21:09
Thanks, that looks like it will help a lot. Then I just need a script to copy the updated files from my VS project directory and I'm all set.

It will save a few clicks and window switches and things.

Cheers,
Ancient Lady
AGK Community Tester and AppGameKit Master
JimHawkins
15
Years of Service
User Offline
Joined: 26th Jul 2009
Location: Hull - UK
Posted: 21st Jan 2013 22:32
bj - that still needs Eclipse. My target was NOT to have more than one IDE in the process. Android builds are massively more complex than the other platforms, so streamlining it would help everybody - especially me!

-- Jim DO IT FASTER, EASIER AND BETTER WITH AppGameKit FOR PASCAL
bjadams
AGK Backer
16
Years of Service
User Offline
Joined: 29th Mar 2008
Location:
Posted: 22nd Jan 2013 13:06
Jim yes I know you need Eclipse, but eclipse is handy if you want to edit the xml config files that come with Android. At least we got rid of cygwin and line command typing
JimHawkins
15
Years of Service
User Offline
Joined: 26th Jul 2009
Location: Hull - UK
Posted: 22nd Jan 2013 14:00
Hi - that's why the project manager will make all needed alterations to the xml files automatically.

-- Jim DO IT FASTER, EASIER AND BETTER WITH AppGameKit FOR PASCAL

Login to post a reply

Server time is: 2024-11-24 05:57:31
Your offset time is: 2024-11-24 05:57:31