ADP


Source link: https://github.com/Diolor/ADP

Android Distribution Platform

Android Distribution Platform (ADP) is a fullstack framework for storing, distributing and installing versionized apk files based (mostly for internal team or roll-back purposes) on each CI git commit.

The developer can access easily from all devices a full precompiled list of the application's versions per git commit. This saves valuable compilation and installation time both in examining old application behaviour or distributing directly a version via a git commit.

Technology behind

The logic is straightforward:

  • A CI tool (Travis / Jenkins) compiles the desired version(s) and uploads the file(s) with a PUT command such as:
$ curl -X PUT https://myadp.rhcloud.com/upload -H "Api-Token: aaa"  -F "f=@/app-debug.apk" -F "c=13c422d" -F "v=1.0" -F "b=productionRelease"
  • The server saves the file in Amazon S3 (also for manual access)
  • The app client lists the availiable apks or installs the desired apk using a token handshake

The backend is a Python Flask microframework able to run on a WSGI which supports persistence objects (e.g. Openshift). Heroku is not supporting it. An Amazon S3 bucket is needed to store the apks.

Instalation

Estimated installation time is <20 minutes.

It has 4 steps an requires basic knowledge to setup a server & CI tools.

1. Amazon S3

First you need a S3 bucket, a AWS_KEY and the AWS_SECRET to use it remotely. Have the name and the tokens in hand to use them later.

To see how to create a bucket see here. To see how to obtain the Key and the Secret see here.

2. Backend

Download the backend code locally:

$ svn export https://github.com/Diolor/ADP/trunk/backend

In config.cfg file change the AWS_KEY, AWS_SECRET, AWS_BUCKET and AWS_REGION (if required) with the desired ones you have acquired above. Also change the API_TOKEN which is required to authenticate with the client app.

For S3 region codes see here.

The code is ready to work with OpenShift's servers. You can use the awesome free gears that RedHat's OpenShift servers provide with ssl wrapping (create a simple python-2.7 gear). If you use OpenShift your server ip will look like: https://myadp-user.rhcloud.com.

Alternatively use your own python server/host.

3. CI

First you need to expose the verion of your application in your CI tool. A simple way is the following snippet in gradle:

apply plugin: 'com.android.application'  String VERSION_NAME = "1.0.0"  android {

  defaultConfig {

versionName VERSION_NAME
  
}
 
}
  task version << {

  println VERSION_NAME 
}

Running the above you can expose the version in the bash like: ./gradlew -q version

An example of a Travis CI file is the following. Adjust the values as needed for your project. This will compile you and upload you 2 build variant apk files to the server:

language: android android:
components:
  - build-tools-21.1.2
  - android-21  env:
global:
  - ADP_TOKEN=my_very_complex_token1234  install:
- export JAVA7_HOME="/usr/lib/jvm/java-7-oracle"
- ./gradlew assembleDebug
- ./gradlew assembleRelease
- export APP_VERSION=`./gradlew -q version`  script:
# maybe run some tests here  
# upload to ADP
- COMMIT_SHORT=${
TRAVIS_COMMIT:0:7
}

- COMMIT_MESSAGE=$(git show -s --format=%B $TRAVIS_COMMIT | tr -d '\n')
 - > 
 curl -X PUT https://myadp-user.rhcloud.com/upload 
 -H "Api-Token: $ADP_TOKEN"
  -F f="@$TRAVIS_BUILD_DIR/app/app-debug.apk"
  -F v="$APP_VERSION"
  -F c="$COMMIT_SHORT"
  -F n="$COMMIT_MESSAGE"
  -F b=debug
 - > 
 curl -X PUT https://myadp-user.rhcloud.com/upload 
 -H "Api-Token: $ADP_TOKEN"
  -F f="@$TRAVIS_BUILD_DIR/app/app-release.apk"
  -F v="$APP_VERSION"
  -F c="$COMMIT_SHORT"
  -F n="$COMMIT_MESSAGE"
  -F b=release

The files should be uploaded to http(s)://MY_SERVER_IP/upload. The parameters are the following:

-F f="@pathto/file.apk" -F v="the_version" -F c="the_commit_id" -F n="the_commit_message"
# optional field -F b="the_relese_flavor" 

4. Client

You can install the latest client application from Google Play.

By default the application asks for the base api endpoint of your server and the token you choose. Upon saving the preferences you will simply see the list of the availiable apks that you have stored. Simply click one and it will be downloaded automatically.

Costs / alternatives

Assuming that your apk is 20MB and you upload two flavors it will cost you $1/1€ for 830 commits per month. Alternative open source solution: HockeyKit

Developed by

Licence

The MIT License (MIT)  Copyright (c) 2015 Dionysis Lorentzos  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:  The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 

Resources

Preference subclass that goes into your PreferenceFragment.

A robust native library loader for Android.

An AutoCompleteTextView with built-in Adapter with the emails in the device.

RecyclerNotifier informs your app's users about updates in RecyclerViews.

A simple android library that lets you easily query against the Proximity Beacon REST Api in a Reactive manner.

A simple android library that lets you easily get an authentication token for the Google Apis.

Topics


2D Engines   3D Engines   9-Patch   Action Bars   Activities   ADB   Advertisements   Analytics   Animations   ANR   AOP   API   APK   APT   Architecture   Audio   Autocomplete   Background Processing   Backward Compatibility   Badges   Bar Codes   Benchmarking   Bitmaps   Bluetooth   Blur Effects   Bread Crumbs   BRMS   Browser Extensions   Build Systems   Bundles   Buttons   Caching   Camera   Canvas   Cards   Carousels   Changelog   Checkboxes   Cloud Storages   Color Analysis   Color Pickers   Colors   Comet/Push   Compass Sensors   Conferences   Content Providers   Continuous Integration   Crash Reports   Credit Cards   Credits   CSV   Curl/Flip   Data Binding   Data Generators   Data Structures   Database   Database Browsers   Date &   Debugging   Decompilers   Deep Links   Dependency Injections   Design   Design Patterns   Dex   Dialogs   Distributed Computing   Distribution Platforms   Download Managers   Drawables   Emoji   Emulators   EPUB   Equalizers &   Event Buses   Exception Handling   Face Recognition   Feedback &   File System   File/Directory   Fingerprint   Floating Action   Fonts   Forms   Fragments   FRP   FSM   Functional Programming   Gamepads   Games   Geocaching   Gestures   GIF   Glow Pad   Gradle Plugins   Graphics   Grid Views   Highlighting   HTML   HTTP Mocking   Icons   IDE   IDE Plugins   Image Croppers   Image Loaders   Image Pickers   Image Processing   Image Views   Instrumentation   Intents   Job Schedulers   JSON   Keyboard   Kotlin   Layouts   Library Demos   List View   List Views   Localization   Location   Lock Patterns   Logcat   Logging   Mails   Maps   Markdown   Mathematics   Maven Plugins   MBaaS   Media   Menus   Messaging   MIME   Mobile Web   Native Image   Navigation   NDK   Networking   NFC   NoSQL   Number Pickers   OAuth   Object Mocking   OCR Engines   OpenGL   ORM   Other Pickers   Parallax List   Parcelables   Particle Systems   Password Inputs   PDF   Permissions   Physics Engines   Platforms   Plugin Frameworks   Preferences   Progress Indicators   ProGuard   Properties   Protocol Buffer   Pull To   Purchases   Push/Pull   QR Codes   Quick Return   Radio Buttons   Range Bars   Ratings   Recycler Views   Resources   REST   Ripple Effects   RSS   Screenshots   Scripting   Scroll Views   SDK   Search Inputs   Security   Sensors   Services   Showcase Views   Signatures   Sliding Panels   Snackbars   SOAP   Social Networks   Spannable   Spinners   Splash Screens   SSH   Static Analysis   Status Bars   Styling   SVG   System   Tags   Task Managers   TDD &   Template Engines   Testing   Testing Tools   Text Formatting   Text Views   Text Watchers   Text-to   Toasts   Toolkits For   Tools   Tooltips   Trainings   TV   Twitter   Updaters   USB   User Stories   Utils   Validation   Video   View Adapters   View Pagers   Views   Watch Face   Wearable Data   Wearables   Weather   Web Tools   Web Views   WebRTC   WebSockets   Wheel Widgets   Wi-Fi   Widgets   Windows   Wizards   XML   XMPP   YAML   ZIP Codes