How to install Android wear app onto android marshmallow avd emulator?

admin

Administrator
Staff member
For the last few days, I've been trying to get the android wear app working on an android marshmallow (API 23) emulator. The reason I'd like to do this, is so that I can pair my android (phone) emulator, with my android wear emulator, with a view to get an automated calabash smoke test running on jenkins. I know this is possible (or at least has been possible previously), as I found this (kennethmascarenhas.wordpress.com/2014/08/19/developing-for-android-wear-with-emulators/), which outlines pairing the two emulators together.

<strong>What I've tried thus far:</strong>

<hr>

<em>(1) Install Android wear app onto marshmallow emulator running Google APIs</em>

Emulator config:

<ul>
<li>Device: Nexus 5</li>
<li>Target: Android 6.0 - API Level 23</li>
<li>CPU/ABI: Google APIs Intel Atom (x86)</li>
<li>Emulator Options: Use Host GPU</li>
</ul>

Start up emulator:

Code:
emulator -avd &lt;my_avd&gt; -writable-system -no-boot-anim

Install the android wear app (downloaded from here: www.apkmirror.com/apk/google-inc/android-wear/android-wear-1-5-0-2714488-gms-release/android-wear-1-5-0-2714488-gms-android-apk-download/):

Code:
adb -s emulator-5554 install &lt;path_to_downloaded_wear_apk&gt;

Opening the wear app however, produces a dialog stating: "Update your Google app on the Play Store. Then open Android Wear again."

This is where I went down the rabbit hole trying to get Google Play installed -_-

Interestingly, if you run the emulator with "Google APIs", the following google play apps are already bundled:

<ul>
<li>Google play services - package:/system/priv-app/PrebuiltGmsCore/PrebuiltGmsCore.apk=com.google.android.gms
versionName=8.4.89 (2428711-470)</li>
<li>Google Account Manager - package:/system/priv-app/GoogleLoginService/GoogleLoginService.apk=com.google.android.gsf.login
versionName=6.0-2780065</li>
<li>Google Services Framework - package:/system/priv-app/GoogleServicesFramework/GoogleServicesFramework.apk=com.google.android.gsf
versionName=6.0-2780065</li>
<li>Google Play Store - package:/system/app/LicenseChecker/LicenseChecker.apk=com.android.vending
versionName=1.8 (Don't think this is actually it as I can't see app in apps list)</li>
</ul>

According to this blog post (www.flinkd.org/2015/02/installing-google-play-on-the-android-emulator-api-21-lollipop/), it is possible to install google play store (and everything that goes with it), or at least it was on API 21.

Remount emulator device partition to read-write:

Code:
adb remount

However, when I try to 'push' the apks to the emulator, e.g.:

Code:
adb push PrebuiltGmsCore.apk /system/priv-app

I get an error like:

Code:
failed to copy 'PrebuiltGmsCore.apk' to '/system/priv-app/PrebuiltGmsCore.apk': Read-only file system

At this point, I decided to try something else.

<hr>

<em>(2) Install google play store on marshmallow emulator NOT running Google APIs</em>

Emulator config:

<ul>
<li>Device: Nexus 5</li>
<li>Target: Android 6.0 - API Level 23</li>
<li>CPU/ABI: Intel Atom (x86)</li>
<li>Emulator Options: Use Host GPU</li>
</ul>

But again, I get the same 'Read-only file system' error as before when trying to 'push' the apks onto the device.

I even tried just installing them as you normally would, e.g.:

Code:
adb install &lt;path_to_apk&gt;

Which works, but appears to install the apps into the wrong directory with the wrong permissions. So when I open the Google Play Store app, I get a million errors saying google play services, framework and store have crashed (logcat saying "You need MANAGE_USERS permission" for each of the apps).

<hr>

<em>(3) Other things I've tried</em>

Rather than running 'adb remount', I have also tried:

Code:
adb shell
su
mount -o rw,remount /system/priv-app/

But I get the same 'Read-only file system' error, when trying to 'push' the apks.

I've also tried your bog standard 'chmod' or /system/priv-app/, but again, I get the 'Read-only file system' error.

Oh, and also, before you ask, yes I'm running 'adb root'.

<hr>

Has anyone out there had any luck with what I'm trying to accomplish? Please help.

P.S. Sorry about not having proper links. I don't have enough stack cred yet...