Software Ramblings

Scala Java and Android

Trying to Solve Error 491 in Play Store on Android Emulator

| Comments

Installing Google Play Store on Android emulator is quite easy – I described it in my previous article. However there is one problem that does not allow downloading of apps – the dreadful Error 491. After some investigation it appears that the error happens because Android emulator does not have DRM! This is the exact error that is displayed in Logcat:

1
2
3
4
5
6
7
8
06-25 07:51:42.142: WARN/DownloadManager(342): Exception for id 7: android/drm/DrmManagerClient
        java.lang.NoClassDefFoundError: android/drm/DrmManagerClient
        at com.android.providers.downloads.DownloadDrmHelper.isDrmMimeType(DownloadDrmHelper.java:45)
        at com.android.providers.downloads.Helpers.checkCanHandleDownload(Helpers.java:148)
        at com.android.providers.downloads.Helpers.generateSaveFile(Helpers.java:81)
        at com.android.providers.downloads.DownloadThread.processResponseHeaders(DownloadThread.java:563)
        at com.android.providers.downloads.DownloadThread.executeDownload(DownloadThread.java:256)
        at com.android.providers.downloads.DownloadThread.run(DownloadThread.java:172)

I’ve tried a few things to fix this, but nothing really helped. The CyanogenMod Google Apps package contained some DRM jar, but it didn’t help at all. So I’ve decided to browse my Galaxy S2 and found this /system/app/DrmProvider.apk which I thought might help. So I pulled it from device and pushed it to the emulator. As expected, it kind of worked, but it now threw another exception:

1
2
3
4
5
6
7
8
9
10
11
12
13
06-25 07:53:52.043: WARN/DownloadManager(724): Exception for id 8: null
        java.lang.ExceptionInInitializerError
        at com.android.providers.downloads.DownloadDrmHelper.isDrmMimeType(DownloadDrmHelper.java:45)
        at com.android.providers.downloads.Helpers.checkCanHandleDownload(Helpers.java:148)
        at com.android.providers.downloads.Helpers.generateSaveFile(Helpers.java:81)
        at com.android.providers.downloads.DownloadThread.processResponseHeaders(DownloadThread.java:563)
        at com.android.providers.downloads.DownloadThread.executeDownload(DownloadThread.java:256)
        at com.android.providers.downloads.DownloadThread.run(DownloadThread.java:172)
        Caused by: java.lang.UnsatisfiedLinkError: Library drmframework_jni not found; tried [/vendor/lib/libdrmframework_jni.so, /system/lib/libdrmframework_jni.so]
        at java.lang.Runtime.loadLibrary(Runtime.java:393)
        at java.lang.System.loadLibrary(System.java:535)
        at android.drm.DrmManagerClient.<clinit>(DrmManagerClient.java:56)
        ... 6 more

So I dig deeper and tried extracting missing .so files. Browsing my phone revealed four files that I might be interested in: libdrm1.so, libdrm1_jni.so, libdrmframework.so and libdrmframework_jni.so. Again, pulled those from device and pushed to emulator but I got the first exception and got stuck.

At this point I don’t have any more ideas how to solve this problem, but I will still try. It appears that installing DRM on emulator might be much more problematic than pulling some apks from real devices.

Comments