diff --git a/.gitignore b/.gitignore index c06d22ad4..4ff7cc8d4 100644 --- a/.gitignore +++ b/.gitignore @@ -45,3 +45,6 @@ webapp chrome-extension firefox-addon version.js + +android/package +android/*.apk diff --git a/android/README.md b/android/README.md new file mode 100644 index 000000000..c726875f3 --- /dev/null +++ b/android/README.md @@ -0,0 +1,23 @@ +System Requirements + +* Download [Android SDK](http://developer.android.com/sdk/index.html) +* Download [Crosswalk](https://crosswalk-project.org/#documentation/getting_started/linux_host_setup) and setup the environment + +Add to your ~/.bash_profile or ~/.bashrc + +``` +export CROSSWALK="" +``` + +To build the APK run the script: + +``` +sh android/build.sh +``` + +To install the APK in your device run: + +``` +adb install -r Copay_VERSION_arm.apk +``` + diff --git a/android/build.sh b/android/build.sh new file mode 100644 index 000000000..99fc65b82 --- /dev/null +++ b/android/build.sh @@ -0,0 +1,57 @@ +#! /bin/bash + +# Description: This script compiles and copy the needed files to later package the application for Android + +OpenColor="\033[" +Red="1;31m" +Yellow="1;33m" +Green="1;32m" +CloseColor="\033[0m" + +# Check function OK +checkOK() { + if [ $? != 0 ]; then + echo "${OpenColor}${Red}* ERROR. Exiting...${CloseColor}" + exit 1 + fi +} + +# Configs +BUILDDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" +APPDIR="$BUILDDIR/package" + +echo $BUILDDIR +echo $APPDIR + +# Move to the build directory +cd $BUILDDIR + +[ -z "$CROSSWALK" ] && { echo "${OpenColor}${Red}* Need to set CROSSWALK environment variable${CloseColor}"; exit 1; } + +# Create/Clean temp dir +echo "${OpenColor}${Green}* Checking temp dir...${CloseColor}" +if [ -d $APPDIR ]; then + rm -rf $APPDIR +fi + +mkdir -p $APPDIR + +# Re-compile copayBundle.js +echo "${OpenColor}${Green}* Generating copay bundle...${CloseColor}" +grunt --target=dev shell +checkOK + +# Copy all app files +echo "${OpenColor}${Green}* Copying all app files...${CloseColor}" +cd $BUILDDIR/.. +cp -af {css,font,img,js,lib,sound,config.js,version.js,index.html,./android/icon.png,./android/manifest.json} $APPDIR +checkOK + +# Building the APK +echo "${OpenColor}${Green}* Building APK file...${CloseColor}" +cd $CROSSWALK +python make_apk.py --manifest=$APPDIR/manifest.json --target-dir=$BUILDDIR --arch=arm +checkOK +cd $BUILDDIR + +echo "${OpenColor}${Yellow}\nAwesome! We have a brand new APK, enjoy it!${CloseColor}" diff --git a/android/icon.png b/android/icon.png new file mode 100644 index 000000000..2a2a9bda9 Binary files /dev/null and b/android/icon.png differ diff --git a/android/manifest.json b/android/manifest.json new file mode 100644 index 000000000..ad5062a03 --- /dev/null +++ b/android/manifest.json @@ -0,0 +1,12 @@ +{ + "name": "Copay", + "version": "0.0.0.1", + "app": { + "launch":{ + "local_path": "index.html" + } + }, + "icons": { + "128": "icon.png" + } +}