Name

Android::Build - Lint, build, install, run an Android App using just the Android command line build tools

Prerequisites

sudo apt-get install imagemagick zip
sudo cpan install Data::Table::Text Data::Dump Carp POSIX File::Copy;

And a version of the Android Software Development Kit.

Synopsis

This file which can be found in the tar.gz file containing this module:

SampleApp/perl/makeWithperl.pl

contains:

use Android::Build;

my $a = &Android::Build::new();

$a->title        = qq(Generic App);                                            # Title of the app as seen under the icon
$a->domain       = qq(com.appaapps);                                           # Domain name in reverse order
$a->activity     = qq(Activity);                                               # Name of Activity = $activity.java file containing onCreate() for this app
$a->icon         = qq(~/images/Jets/EEL.jpg);                                  # Image that will be scaled to make an icon using Imagemagick
$a->sdk          = qq(~/Android/sdk/);                                         # Android SDK on the local machine
$a->sdkLevels    = [15,25];                                                    # Min sdk, target sdk for manifest
$a->androidJar   = $a->sdk."platforms/android-25/android.jar";                 # Android sdk jar
$a->keyStoreFile = qq(~/keystore/release-key.keystore);                        # Keystore file
$a->keyStorePwd  = qq(xxx);                                                    # Password for keystore

$a->build(qw(run));                                                            # Build, install and run the app on the only emulator

Modify the values above to reflect your local environment, then start an emulator and run:

perl SampleApp/perl/makeWithPerl.pl

to compile the sample app and load it into the emulator.

File layout

If your Android build description is in file:

/somewhere/$folder/perl/makeWithPerl.pl

then the Java source and libs for your app should be in:

/somewhere/$folder/src/*.java
/somewhere/$folder/libs/*.jar

and the java package name for your app should be:

package $domain.$folder

where:

$domain

is your reversed domain name written in lowercase. Executing:

use Android::Build;

my $a = &Android::Build::new();
...
$a->build(qw(run));

will copy the files in the b<src> and b<lib> folders into an Android project created in the b<tmp> before starting the build of the app.

If this does not meet your requirements, then provide a 𝘀𝘂𝗯

$a->copyFiles = sub ...

which will be called just before the build begins to allow yopu to copy in any other files needed to build the app.

Installation

Standard Module::Build process for building and installing modules:

perl Build.PL
./Build
./Build test
./Build install

Author

philiprbrenan@gmail.com

http://www.appaapps.com

Copyright

Copyright (c) 2016 Philip R Brenan.

This module is free software. It may be used, redistributed and/or modified under the same terms as Perl itself.