-
Notifications
You must be signed in to change notification settings - Fork 184
Android Development
uProxy can now be built for Android using the Cordova Chrome Apps (CCA) tool, a.k.a. Chrome Apps for Mobile Toolchain.
Use our Android Docker image:
./tools/build_env/build_env.sh -v android yarn run grunt android_debug
Note: Subsequent builds can be sped up with grunt android_debug_lite
. Use this if you've only changed HTML and TypeScript.
- You need Xcode 6.4 (7 will not work!).
- Things are easy for Homebrew users:
brew install android-sdk android-ndk
- If you don't have Homebrew, you will need to:
- install the Android SDK
- set the
ANDROID_HOME
environment variable to Android SDK's path, e.g.export ANDROID_HOME=/usr/local/opt/android-sdk
(you may want to persist this in your.bashrc
) - install the Android NDK
- Install the Android SDK:
- Open the downloads page and search for "just the command line tools".
- Download the
.tgz
. - Extract the
.tgz
, e.g.cd ~/Downloads && tar xvzf android-sdk*.tgz
- Set
ANDROID_HOME
, e.g.export ANDROID_HOME=~/Downloads/android-sdk-linux
- Install the Android NDK:
- Open the downloads page.
- Download the
.zip
. - Extract the
.zip
, e.g.cd ~/Downloads && tar xvzf android-ndk*.zip
- Add
ndk-build
to yourPATH
, e.g.export PATH=~/Downloads/android-ndk-r13:$PATH
We need to install some Android libraries:
- Open Android SDK Manager:
$ANDROID_HOME/tools/android update sdk
- Install these libraries:
- Android 6.0 (API 23)
- SDK Platform
- Extras
- Android Support Repository
- Google Play services
- Google Repository
- Android 6.0 (API 23)
Now, you can build the app with grunt android_debug
.
- Confirm that your
cca
package is ready by runningnode_modules/.bin/cca checkenv
from your git clone root directory. - Confirm that
ndk-build
is in yourPATH
withwhich ndk-build
.
The built output should be in build/src/android/platforms/android/build/outputs/apk/
.
You'll need the adb
tool. On OSX, it's included with the Android SDK; on Linux, try apt-get install android-tools-adb
.
- On your phone, enable USB debugging.
- Connect your phone to your computer, accepting the connection if necessary.
- On your computer, upload the app to the phone using a command like
adb install -r build/src/android/platforms/android/build/outputs/apk/android-armv7-debug.apk
.
You may see an error if uProxy is already installed. If so, try first uninstalling it.
- Create a virtual device using the Android Virtual Device Manager with an API of 23 (Marshmallow) or higher. Choosing the same architecture as your host system for the CPU/ABI (e.g. x86_64) will result in faster emulation, but obfuscation will fail silently, and in one recent case uProxy wouldn't even start, so you may have to choose ARM and suffer with 10x slower emulation.
- Launch the emulator and check
adb devices
at the command line to make sure an emulator is running. - Install the app from the command line with e.g.
adb install -r build/src/android/platforms/android/build/outputs/apk/android-armv7-debug.apk
. You should seesuccess
if the app is installed. - You may then launch the app from the emulator. If after the uProxy splash screen is shown, you get "Application Error: The connection to the server was unsuccessful. (file:///android_asset/www/plugins/cordova-plugin-chrome-apps-bootstrap/chromeapp.html)", just try opening uProxy again. Apparently there is a race condition that sometimes causes this error.
You can remotely debug the uProxy instance running on your Android device using the Chrome Developer Tools on your desktop Chrome. Just go to chrome://inspect in Chrome, and click the "inspect" link corresponding to the uProxy app on your connected Android device:
Android app release builds must be signed. To create a release build:
- Get the appropriate
play_store_keys.p12
andandroid-release-keys.properties
files and symlink them into akeys
directory in the git repo's root.
- The uProxy team's release keys are stored in a secure location, not in the public git repository. Symlinking ensures that you do not accidentally copy the keys into insecure storage.
- Run
grunt android_release
- From the
build/src/android/platforms/android/build/outputs/apk/
directory, uploadandroid-armv7-release.apk
to the Play Store.