How to enable WebGL for Chrome Beta on Android without rooting your device

Update: as of February 2013 patching is not anymore necessary, official Chrome Beta now has flags accessible via chrome://flags and WebGL can be enabled from there.

A bit more detailed version of "patch-Chrome-APK" method by Fuji Daisuke posted as a comment on Toji's original blog post about getting WebGL working on rooted device.

How does it work?

Overview of the method:

Get the official Chrome Beta APK package. Patch this APK so that it runs with enabled WebGL command line flag. Replace the official Chrome Beta APK with your patched one.

A downside is that you will need to do this patching every time you want to get the updated version of Chrome Beta (updates come quite often so far).

If you are ok with running one particular version of patched Chrome Beta I made and you trust me, you can skip many steps of the process and just try installing the patched APK I made: Chrome Beta 25.0.1364.33 (WebGL patched APK) [21 MB] This APK worked for me on ASUS Transformer Pad 300 and Galaxy Nexus (on Android 4.1.1 and 4.2.1 respectively).

Usual common sense disclaimers apply: don't do these things if you don't understand the implications. It may or may not work on your particular Android device, you may mess up and break something.

If you are patient, you can just wait till some more sensible way of enabling WebGL in Chrome Beta will come via official channel (it's supposed to be in the works).

What will you need?

On your computer

All steps are optional if you already have set up Android development environment on your computer, just make sure you are up to date.

Download and install the latest JDK. Download and install the latest Android SDK. Download and install USB driver for your Android device. Here you may hit some troubles as for some Android devices USB drivers may be hidden in different software packages or be difficult to locate. For example I got ASUS Transformer Pad driver from ASUS Pad PC Suite and Galaxy Nexus driver from Samsung site. Download and install android-apktool. Have ready USB cable for connecting Android device to your computer.

On your Android device

Install official Chrome Beta application via Play Store. Install AppMonster application via Play Store (free version is enough). Enable USB debugging in Settings > Developer options. Settings > About phone > Build number (I'm not kidding, this is the If you don't see developer options in your Settings, you may need to enable them via tapping 7x on(I'm not kidding, this is the official way ). Connect your device to computer via USB cable. Make sure device is reachable from ADB tools. You should get something like this when querying for available devices: sdk\platform-tools>adb devices

List of devices attached

0A3G17F30D02F013 device If you don't see anything, verify your USB drivers work and you have USB debugging enabled (please note having device visible just as some media storage is not enough).

How to get original Chrome Beta APK to my computer?

On the device: start AppMonster, select Chrome Beta, select Backup. This will save a single APK file you need in a local folder on the Android device. Now you will need to locate this APK file and get it to your computer. For me it was in: /appmonster2/backup/com.chrome.beta/rev/1364033.apk This folder and the file wasn't visible from my PC (even after enabling showing hidden files) so I just used DropBox to get it out of the Android device.

How to create patched Chrome Beta APK package?

Use apktool to unpack the original Chrome Beta APK: >apktool d 1364033.apk Replace Chrome command line location strings in all "*.smali" files (which are in newly created unpacked folder): >find 1364033 -name "*.smali" -exec sed -i "" 's/\/data\/local\/chrome-command-line/\/data\/local\/tmp\/chrome-command-line/g' {} \; This didn't work for me (on Windows I didn't have properly set up command line tools), instead I had to manually search and replace strings, it was just in few places. You want to change these strings: /data/local/chrome-command-line Into these ones: /data/local/tmp/chrome-command-line Files for me were these: 1364033\smali\com\google\android\apps\chrome\ChromeBrowserProvider.smali 1364033\smali\com\google\android\apps\chrome\ChromeMobileApplication.smali 1364033\smali\com\google\android\apps\chrome\Main.smali 1364033\smali\com\google\android\apps\chrome\tests\ChromeTestActivity.smali Use apktool to pack newly patched files into a single new APK file: >apktool b 1364033 1364033_unaligned.apk Use keytool from JDK to optionally generate Android debug certificate (if you don't already have one): >keytool -genkey -v -keystore debug.keystore -storepass android -alias androiddebugkey -keypass android -dname "CN=Android Debug,O=Android,C=US" Use jarsigner from JDK to sign your patched APK with a debug certificate: >jarsigner -verbose -storepass android -keystore debug.keystore 1364033_unaligned.apk androiddebugkey Use zipalign from Android SDK to optimize your APK: >zipalign -f -v 4 1364033_unaligned.apk 1364033_fixed.apk You are almost there, you should have a file with patched Chrome Beta, now you just need to get it to your Android device.

How to install patched Chrome Beta APK package?