-
Notifications
You must be signed in to change notification settings - Fork 182
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 npm run grunt build_android
Note: Subsequent builds can be sped up with grunt build_android_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_HOMEenvironment 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.
- Since the command-line tools are largely unmaintained, the easiest way to get them is as part of Android Studio. Download the installer and start Android Studio; on first run, it will prompt you to install the SDK.
- Install the Android NDK.
- Add
ndk-buildto yourPATH.
- Add
Lastly, we need to install version 23 of the API (at the time of writing, only the latest, i.e. 24, is included at install time). Open Android SDK Manager:
$ANDROID_HOME/tools/android update sdk
Ensure that "SDK Platform" is installed for Android 6.0 (API 23).
Now, you can build the app with grunt build_android.
- Confirm that your
ccapackage is ready by runningnode_modules/.bin/cca checkenvfrom your git clone root directory. - Confirm that
ndk-buildis in yourPATHwithwhich 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 removing it by via
Settings -> Apps -> uProxy.
- 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 devicesat 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 seesuccessif 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.p12andandroid-release-keys.propertiesfiles, and symlink them into akeysdirectory in the git repo 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 release_android - From the
build/dev/uproxy/android/platforms/android/build/outputs/apk/directory, uploadandroid-release.apk,android-x86-release.apk, andandroid-armv7-release.apkto the Play Store using the multiple APK upload procedure.
- This allows us to have a smaller build (~10 MB) for modern Android, and a larger build (~33 MB) for older Android versions that need Crosswalk because the system webview is too old to run uProxy.

