- File layout
Android::Build - Lint, compile, install, start an Android App using just the command line tools without using ant or gradle, just 100% Pure Perl
sudo apt-get install imagemagick zip openjdk-8-jdk sudo cpan install Data::Table::Text Data::Dump Carp POSIX File::Copy;
And a version of the Android Software Development Kit.
This file which can be found in the tar.gz file containing this module:
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->keyAlias = qq(xxx); # Alias of key to be used to sign this app $a->keyStoreFile = qq(~/keystore/release-key.keystore); # Key store 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:
to compile the sample app and load it into the emulator.
If you do not already have a signing key, you can create one with the supplied script:
If your Android build description is in file:
then the Java source and libs for your app should be in:
and the java package name for your app should be:
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 𝘀𝗿𝗰 and 𝗹𝗶𝗯 folders into an Android project created in the app build folder before starting the build of your 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 you to copy in any other files needed to build your app.
You can customize your build by assigning to or reading from the following methods:
Optional: Activity name, default is 'Activity'
REQUIRED: Name of the folder containing the build tools to be used to build the app
Optional: Name of a folder in which to build the app
Optional: Sub to copy additional files into the app before it is complied
Optional: Make app debuggable is specified and true
Optional: Device to run on, default is the only emulator
REQUIRED: Domain name for app
Optional: Jpg file containing a picture that will be scaled to make an icon for the app, default is 'icon.jpg'
REQUIRED: alias used in keytool to name the key to be used to sign this app
REQUIRED: file name of key store
REQUIRED: password of key store file
Output: message log
Optional: extra libraries
Optional: One word name of app, else the name of the folder: '../'
Optional: Parameter string to be placed in res for the app
Optional: Permissions, a standard useful set is applied
REQUIRED: Folder containing Android sdk
Optional: [minSdkVersion,targetSdkVersion], default is [15,25]
Optional: Source of app, default is everything in './src' folder
Optional: Number of android sdk to use as found via `android list targets`
Optional: Title of app, default is the name of app
Optional: Version of app, default is today's date
Standard Module::Build process for building and installing modules:
perl Build.PL ./Build ./Build test ./Build install
Copyright (c) 2017 Philip R Brenan.
This module is free software. It may be used, redistributed and/or modified under the same terms as Perl itself.