How to install ARCore on all Android phones using ARCoreForAll

We all know what ARCore is and how interesting it is since it lets us enjoy augmented reality directly from our Android phones, as ARKit does with Apple phones. But we’re also very annoyed by the fact that ARCore can be used only with Samsung S8 and Pixel phones: what could be augmented reality for everyone has actually become augmented reality for few people. If you try to use ARCore on an unauthorized device, the answer you get is that it is not enabled for AR usage. But is there a way to install ARCore on every kind of Android phones? Actually, there is. Even if the results may not be as good as we may expect.

The problem

Google ARCore (Image by Google)

Google has locked ARCore installation only to certain devices for various reasons. The most important of them is that on these devices it has managed to find all the calibration parameters of the phone IMU sensors and the camera. This means that the tracking is very stable and effective. Furthermore, we’re talking about very recent devices, that have the computational power to handle AR tracking and rendering at the same time without the application becoming sloppy. So it has imposed these constraints to offer an optimal AR experience. Another reason is surely to incentivize people to buy its flagship phones or the ones of its partners, but I don’t want to talk about this, now.

The problem is that there are other phones that surely have the capability of performing AR, like for instance the Samsung S8+ or the Asus Zenfone AR, that are Daydream ready but are not ARCore ready. Developers would really love to try ARCore on these devices, even if the tracking is not perfect, to begin experimenting with this interesting framework, but they actually can not. The Zenfone is a Tango phone but can’t execute ARCore, that is a subset of Tango… this is absurd!

For sure Google is not blocking these phones based on features (otherwise the S8+ and Zenfone would be enabled) but by the phone model name. If we would be able to remove such kind of check… we could install ARCore everywhere!

UPDATE: ARCore has been released in v1.0 and 13 phones are actually now compatible with it. Some of them (like the S8+) were previously only activable through this hack, but now are officially compatible.. Read more on ARCore release on Google Blog.

The solution

A developer called Thomas “TomTheCarrot” Suarez had exactly this idea: why can’t we hack Google services and SDKs to remove all these checks? So he started digging into the code and created a modified version of ARCore that can run on all the phones, then he put it on GitHub. He did an awesome job and the fact that he put it on GitHub shows how it is willing to give all this knowledge to the community, helping all of us not only to experience AR on our phones but also to understand how he did create such a hack.

Really, Thomas deserves a huge medal (Image from quick meme)

Everyone can follow the link, access the repo and start using ARCore on every Android phone… maybe (more on this “maybe” later). I’ll guide you a bit on the installation process, to cover some things that are not that clear on the other online tutorials.

Just a note before beginning: while the GitHub repo page is the one that I linked above, actually you should use the most recent files and instructions that are present on its service-mod branch.

Service installation

ARCore to work needs the Tango Core service, that is a service that runs in background and that is able to extract the phone pose given IMU+camera data. Google in its official ARCore guides gives you the APK for this service, but if you try to install it on an unauthorized phone, it will launch saying that AR is not enabled on the phone. To make it work on your phone, you need to install the version modified by TomTheCarrot to remove the checks. You can find it on the service-mod branch page linked above or directly here.

Just install the apk in the same way you install any other service or app. I love using Android command line tools, so I open a console window and I type

adb install -r <path_to_arcore_apk>/arcore-preview-modified.apk

If you have Android 7.0+, this should work like a charm, otherwise, things have to become nerdier…

Service installation – Android 6.0 or lower

I tried installing the above service on my Samsung Note 4 with Android 6.0 and I failed miserably with adb returning INSTALL_FAILED_OLDER_SDK. On GitHub forums, there is a post about how to make it work with older version of Android and it also contains an APK made by a developer for that, but I didn’t like that approach because it was too Linux-like for my tastes. Anyway, it works, so you can follow it if you wish.

Otherwise, follow me. The idea to make it work on older phones is this one: since we’ve already removed the phone model checks, let’s go in a check-removing-spree and remove all the checks about the required SDK version for this service. To make this, we will need to enter into the manifest of the APK and change the required Android SDK version to the one installed on our phone. So bad that the APK is a compiled package, so this won’t be that easy. Luckily there’s Apktool ready to help us.

Notice that in the below instructions I assume that you already have Java runtime, Java JDK, and Android SDK Tools installed and with their executables folders already inserted into the PATH environment variable of the system. If you’re not at this point, the command line may say you that it doesn’t recognize the commands you’re providing. Assuming you’re at this point, let’s go into the super-nerd details of the process.

This is how you’ll feel while running this tutorial (Image by Know Your Meme)

So, what you have to do is:

  • Install Apktool . Follow the instructions on that page and install it. You will be required to use command line, but trust me, installation is easier than it seems;
  • Open a command line window
  • Enter the directory of the APK
    cd <path_to_arcore_apk>
  • Decode the APK using Apktool. This will put all the content of the Android package in a subdirectory with the same name of the package
    apktool d arcore-preview-modified.apk
  • Use File Explorer to enter the just created directory, that is <path_to_arcore_apk>/arcore-preview-modified
  • Inside this directory, you should find a file called apktool.yml . Open it with a smart text editor like Notepad++ or Visual Studio. If you use standard notepad, it will mess with line terminators and things will get harder.
  • Inside the file, you should find 4 lines similar to these ones
    sdkInfo:
    minSdkVersion: '24'
    targetSdkVersion: '24'
    maxSdkVersion: '24'
  • Substitute the minSdkVersion and targetSdkVersion with the ones of your phone. I have Android 6.0, so I have SDK ver23 and so I transformed the above lines to:
    sdkInfo:
    minSdkVersion: '23'
    targetSdkVersion: '23'
    maxSdkVersion: '24'

    You can look for your SDK version given the version of Android installed on your phone (that you can get inside the phone settings), by checking the table at this page;

  • Encode again the APK. Return to command line and type the command
    apktool b arcore-preview-modified
  • Use file explorer and go to folder <path_to_arcore_apk>/arcore-preview-modified/dist/ . You should find an APK called arcore-preview-modified.apk that is the one you wish to use. Unluckily you can’t install it directly on your device since it is an unsigned APK.
  • Sign the APK using the instruction that you can find at this Stack Overflow post. Basically, you have to open a command line, go to the directory of the new apk
    cd <path_to_arcore_apk>/arcore-preview-modified/dist/

    and type

    keytool -genkey -v -keystore arcore.keystore -alias arcore -keyalg RSA -keysize 2048 -validity 10000

    to create a keystore that you’ll use only for this purpose. If you already have a keystore of yours, use that one. This command will ask you some questions… feel free to answer what you wish. If you’re going to create it for internal testing, giving it stupid passwords like 123456 makes things easier. Then run

    jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore arcore.keystore arcore-preview-modified.apk arcore

    This command should magically sign your apk.

  • At this moment you can finally type
    adb install -r <path_to_just_signed_arcore_apk>/arcore-preview-modified.apk

And voilà! Your old Android phone can execute the ARCore service! You can now install ARCore on every Android phone!

Unity development
Development of ARCore apps inside Unity (Image by Google)

Now it’s turn to create a Unity AR application that can run on our majestic service. Let’s try to use the Unity ARCore sample app and let’s see if it works.

Install Unity 2017.2 (beta 11 or above) from Unity website, then follow the instructions on Unity ARCore page to create your first app, but stop before actually building the app. The instructions are already very detailed on Google tutorial page, so I won’t replicate them here.

When you’re about to build the app, locate the file <path_to_your_Unity_project>/Assets/GoogleARCore/SDK/Plugins/unitygar.aar and delete it. Then substitute it with the modified version created by TomTheCarrot, that you can find at the service-mod branch or directly here. At this point, build the project, deploy it and run it with your phone!

This trick can work with every ARCore Unity project: you have just to substitute the original unitygar.aar file with the one you can find on GitHub to launch your AR app on every kind of phone!

If you have Android 6.0 or before, after the build you have to downgrade the required SDK by using the same process that you used for the service. Unity won’t let you select Android 6.0 if you enable Tango, so you have to do that by hand after the build.

Unity development – does it work?

To me, not at all. The modified version of the unitygar.aar file makes some mess with Unity build process and I get the following error.

Damn damn damn

I tried everything to fix that, but with no success. Some people are having my same issue, while I’ve read of others that have successfully used it. So, you can try it, but don’t expect it to work for sure.

Android Studio Development
Sample AR Android app inside Android Studio (Image by Google)

If you want to develop standard Android apps, the process is very similar. Go to Google ARCore Android Studio guide and follow all the steps that will guide you through the installation of Android Studio, the sample package, installation, and deployment. Again, the tutorial is already very detailed so there’s no need for me to replicate anything here. And again, stop just before building and launching the app.

Before building the app, go to <path_to_android_sample_app>\arcore-android-sdk-master\libraries and substitute arcore_client.aar with the file provided by TomTheCarrot on the service-mod branch that you can download directly from here. With this modification, your app can run on every Android phone. Return to Android Studio hit play and let it launch your ARCore app on your phone!

Notice that I had a lot of problems with the damn Gradle (the package manager of Android Studio). The sample app, at the time of writing, targets Android SDK 25, that I had not installed on my PC. So if building process doesn’t work, try installing that SDK through Android SDK Manager or modify target SDK changing project properties.

Android Studio Development – Android 6.0 or lower

Of course, an application that targets Android SDK 25 couldn’t run on my Note4 phone, so I had to lower the SDK requirements for it. To do that, you have to modify the settings inside the application manifest and build settings.

These are the two files you have to change to build your application for older Android versions

Inside AndroidManifest.xml locate the uses-sdk tag and set android:minSdkVersion to your version of Android. Then open build.gradle and do the same for minSdkVersion (under android – defaultConfig). After that, try rebuilding and your old phone should execute the sample ARCore app!

Android Studio Development – Does it work?

To me, not at all. I had again build errors as I had with Unity. Strange things about the inability to move classes. I hope for you things are better.

I got a bit angry, so I decided I damn wanted it to f***ing work on my phone and decided to go the hyper-nerd way.

Android Studio Development – The hyper-nerd way
Following this nerdy tutorial you will become as cool as this guy (Image by This Crush)

Since Thomas Suarez posted the tutorial on how he created his modified arcore_client.aar file, I decided to follow it and create the file myself to see if a home-made version could work better. You can find his personal instructions here. I’ll copy-paste them here, so I can add them my personal comments.

As stated before, I assume that you already have Java runtime, Java JDK, and Android SDK Tools installed and with their executables folders already inserted into the PATH environment variable of the system.

What you have to do to obtain your modified version of arcore_client.aar file is the following:

  • Get java class decompiler CFR and put that jar in a directory that I will call <path_to_cfr> . Rename the downloaded jar file as cfr.jar
  • Get an original version of arcore_client.aar, the one provided by Google with its ARCore package. I assume you have it in <path_to_arcore_client_aar> directory
  • Open a command line interface and go to that directory
    cd <path_to_arcore_client_aar>
  • Unzip the AAR to a temporary directory: using File Explorer (or the command line, depending on how nerd you are), rename arcore_client.aar to arcore_client.zip and then unzip the contents in a sub directory named arcore_client
  • Enter the temporary directory:
    cd arcore_client
  • Locate a file named classes.jar. Rename it with File Explorer or command line into classes.zip. Unzip it into a subfolder called classes.
  • Enter the temporary classes directory:
    cd classes
  • Enter the directory containing the SupportedDevices class:
    cd com/google/atap/tangoservice
  • Decompile the SupportedDevices class:
    java -jar <path_to_cfr>\cfr.jar SupportedDevices.class > SupportedDevices.java
  • Open the just created SupportedDevices.java file (that is in <path_to_arcore_client_aar>\arcore_client\classes\com\google\atap\tangoservice) with a smart text editor and remove all code of the function isSupported(). Substitute it with “return true”. We’re basically removing the check of the device model, enabling the produced app to run on every device. The file should look like this one:
    package com.google.atap.tangoservice;
    
    import android.content.Context;
    import android.content.pm.ApplicationInfo;
    import android.content.pm.PackageManager;
    import android.os.Build;
    import android.os.Bundle;
    import android.util.Log;
    
    public class SupportedDevices {
        private static final String TAG = SupportedDevices.class.getSimpleName();
    
        public static boolean isSupported(Context context) {        
            return true;
        }
    
        private static boolean deviceCalibrationAvailable() {
            return Build.FINGERPRINT.contains("sailfish:7") || Build.FINGERPRINT.contains("sailfish:O") || Build.FINGERPRINT.contains("sailfish:8") || Build.FINGERPRINT.contains("marlin:7") || Build.FINGERPRINT.contains("marlin:O") || Build.FINGERPRINT.contains("marlin:8") || Build.FINGERPRINT.contains("walleye:O") || Build.FINGERPRINT.contains("walleye:8") || Build.FINGERPRINT.contains("taimen:O") || Build.FINGERPRINT.contains("taimen:8") || Build.FINGERPRINT.contains("SC-02J/SC-02J:7") || Build.FINGERPRINT.contains("SCV36_jp_kdi/SCV36:7") || Build.FINGERPRINT.contains("dreamqlteue/dreamqlteue:7") || Build.FINGERPRINT.contains("dreamqltesq/dreamqltesq:7") || Build.FINGERPRINT.contains("dreamqlteldusq/dreamqltesq:7") || Build.FINGERPRINT.contains("dreamqltezm/dreamqltecmcc:7") || Build.FINGERPRINT.contains("dreamqltevl/dreamqltecan:7") || SupportedDevices.isSupportedExynosDevice();
        }
    
        public static boolean isSupportedExynosDevice() {
            return Build.FINGERPRINT.contains("dreamlteldu/dreamlte:7") || Build.FINGERPRINT.contains("dreamlteks/dreamlteks:7") || Build.FINGERPRINT.contains("dreamltexx/dreamlte:7");
        }
    }
    
    
  • Compile the modified SupportedDevice class. Notice that you will need to know the path where Android SDK manager installs your SDKs and pick the right SDK. My app gets compiled using Android 25 SDK, so I have to pick the path to android 25 SDK:
    javac -cp <path_to_android_sdks>\platforms\android-25\android.jar -source 1.7 -target 1.7 SupportedDevices.java

    It will give a warning. Who cares.

  • Delete the Java source file just created (SupportedDevices.java) using command line or File Manager
  • Change directory back to the initial temporary directory (<path_to_arcore_client_aar>\arcore_client):
     cd ../../../../../
  • Create a JAR from the modified classes directory:
    jar cvf classes.jar -C classes .

    Notice that at the end of this command there is a damn period “.”. I didn’t notice that and I spent half an hour wondering why Windows kept on not executing my command and continued giving me the command line options of “jar” command

  • Delete the classes.zip file that you had created there previously
  • Change directory back to repo root:
    cd ..
  • Delete (if you wish) the arcore_client.zip that you previously created
  • Create an AAR from the modified aar directory:
    jar cvf arcore_client.aar -C arcore_client .

    Again, don’t forget the last period.

At the end of this process you should obtain your home-made version of arcore_client.aar.

Repeat the above procedure, substituting it to the original version inside your Android Studio sample project. Build, run and have fun!

Android Studio Development – The hyper-nerd way – Does it work?

To me, no. But it let me at least build the app and deploy it on my phone. So in the end I had on my old Samsung Note 4, running Android 6.0, ARCore service + an ARCore app running. It has been some kind of satisfaction. But as soon as I launch the app, a pop-up opens telling me that “Tango Core process has been stopped” and the app halts at the “Looking for surfaces…” stage.

I’ve also tried this procedure on a Samsung S6 running Android 7.0 and the result is exactly the same.

On what phones does it work?

So, why I wrote this long tutorial if it does not seem to work on any phone? First of all because it has been an interesting experiment. And then also because actually there are some phones where this procedure works: you can find the table with the working and non working models here. Basically they are:

  • Google Pixel / XL
  • Google Pixel 2 / 2 XL
  • Samsung S8
  • Samsung S8+
  • Huawei Nexus 6P
  • OnePlus 5

The last 3 phones were not enabled to run ARCore, so this hack is a great win for their owners!

Conclusion

ARCore-for-all is a very interesting project and it enables all phones to install ARCore services and apps and some phones to even execute ARCore apps! The project has still a long road to go to become usable on all phones and unluckily it sources seems not updated since 2 months. The forum part of the repo is instead very active and this makes me think that the project is far from dead. I really hope that all AR community can help in taking it further so that everyone of us can experiment with Augmented Reality on Android!


I hope you liked this article, and if it has been the case, please subscribe to my newsletter so that to sustain my efforts for this AR/VR blog!

(Header image by Google)

 

Skarredghost: AR/VR developer, startupper, zombie killer. Sometimes I pretend I can blog, but actually I've no idea what I'm doing. I tried to change the world with my startup Immotionar, offering super-awesome full body virtual reality, but now the dream is over. But I'm not giving up: I've started an AR/VR agency called New Technology Walkers with which help you in realizing your XR dreams with our consultancies (Contact us if you need a project done!)
Related Post
Disqus Comments Loading...