Note:

If you want to create a new page for developers, you should create it on the Moodle Developer Resource site.

Moodle Mobile Automatic Building System: Difference between revisions

From MoodleDocs
(Created page with "== Introduction == == Requirements == == Steps == 1 Build the .apk file using the Android SDK with all the plugins we need (WebIntent, Notificacions, Childbrowser, etc..) 2 ...")
 
No edit summary
Line 1: Line 1:
== Introduction ==
== Introduction ==


== Requirements ==
An automatic building system helps a lots to developer, they can focus on writing good code and forget all about building/compiling and all the bored stuff.


== Steps ==
Phonegap Build is an example of a powerful build system, but it has a big limitation for Moodle Mobile. It doesn't support some Phonegap plugins we use for the Android app.


Implementing an automatic building system for Android is quite simple using 3er party applications as described bellow:


1 Build the .apk file using the Android SDK with all the plugins we need (WebIntent, Notificacions, Childbrowser, etc..)
== Automatic Build System for Android ==


2 Use this apk as a template for future builds
=== Requirements ===


3 Make an automatic build process that does something like (can be a cron job)
* The MoodleMobile .apk file or your custom app .apk file. You need to perform an initial build on Android. See [[Moodle Mobile Building the app for Android]] for more info.


Extract our .apk file template in a directory (apktool d path/to/yourApp.apk path/to/output-folder)
* android-apktool - http://code.google.com/p/android-apktool/


Download from moodlehq/moodlemobile repository the last files to -> apkdirectory/assets/www directory (where all the html, css, js files are stored)
* jarsigner - Part of the Java JDK


Re-build the .apk file (apktool b path/to/output-folder path/to/yourAppV2.apk )
=== Steps ===


Re-sign the .apk file (jarsigner -verbose -keystore ~/.android/debug.keystore path/to/yourAppV2.apk androiddebugkey)
1 Extract your .apk file template in a directory (apktool d path/to/yourApp.apk path/to/output-folder)
 
2 Download from moodlehq/moodlemobile repository the last files to -> path/to/output-folder/assets/www directory (where all the html, css, js files are stored)
 
3 Re-build the .apk file (apktool b path/to/output-folder path/to/yourAppV2.apk )
 
4 Re-sign the .apk file (jarsigner -verbose -keystore ~/.android/debug.keystore path/to/yourAppV2.apk androiddebugkey)
 
That's all, as you can see once you haven an original .apk file, extract, add your modifications and re-package is very simple
 
=== Automatic script ===
 
Say you have:
 
1 /opt/moodlemobile/repository/...
2 /opt/moodlemobile/apk-templates/myapp.apk
3 /opt/moodlemobile/tmpdir
 
1 A cloned git repository of your code
 
2 Your original .apk file built with Android SDK
 
3 An empty dir
 
cd /opt/moodlemobile
rm -rf tmpdir/*
cd repository
git pull
cd ../
apktool d apk-templates/myapp.apk tmpdir/
cp -r repository/* tmpdir/assets/www/
apktool b tmpdir mynewapp.apk
jarsigner -verbose -keystore ~/.android/debug.keystore path/to/yourAppV2.apk androiddebugkey

Revision as of 15:56, 20 March 2013

Introduction

An automatic building system helps a lots to developer, they can focus on writing good code and forget all about building/compiling and all the bored stuff.

Phonegap Build is an example of a powerful build system, but it has a big limitation for Moodle Mobile. It doesn't support some Phonegap plugins we use for the Android app.

Implementing an automatic building system for Android is quite simple using 3er party applications as described bellow:

Automatic Build System for Android

Requirements

  • jarsigner - Part of the Java JDK

Steps

1 Extract your .apk file template in a directory (apktool d path/to/yourApp.apk path/to/output-folder)

2 Download from moodlehq/moodlemobile repository the last files to -> path/to/output-folder/assets/www directory (where all the html, css, js files are stored)

3 Re-build the .apk file (apktool b path/to/output-folder path/to/yourAppV2.apk )

4 Re-sign the .apk file (jarsigner -verbose -keystore ~/.android/debug.keystore path/to/yourAppV2.apk androiddebugkey)

That's all, as you can see once you haven an original .apk file, extract, add your modifications and re-package is very simple

Automatic script

Say you have:

1 /opt/moodlemobile/repository/...
2 /opt/moodlemobile/apk-templates/myapp.apk
3 /opt/moodlemobile/tmpdir

1 A cloned git repository of your code

2 Your original .apk file built with Android SDK

3 An empty dir

cd /opt/moodlemobile
rm -rf tmpdir/*
cd repository
git pull
cd ../
apktool d apk-templates/myapp.apk tmpdir/
cp -r repository/* tmpdir/assets/www/
apktool b tmpdir mynewapp.apk
jarsigner -verbose -keystore ~/.android/debug.keystore path/to/yourAppV2.apk androiddebugkey