I'm following this document to setup Play Asset Delivery which download few on-demand packages in my app.
It works very well on all my devices when I upload into google play internal testing/production channel.
assetPackManager.registerListener(downloadListener)
assetPackManager.fetch(listOf(packageName)).addOnCompleteListener{ res ->
Timber.i("Download $packageName ${res.isSuccessful}")
}
But I got many error reports from firebase crashlytics which I don't know how to resolve:
Fatal Exception: java.lang.Exception com.google.android.play.core.assetpacks.b: -11:
Asset Pack Download Error(-11): The Play Store app is either not installed or not the
official version.
(https://developer.android.com/reference/com/google/android/play/core/assetpacks/model/AssetPackErrorCode.html#PLAY_STORE_NOT_FOUND) at
com.google.android.play.core.assetpacks.e0.l(Unknown Source:21) at
com.google.android.play.core.assetpacks.e0.f(Unknown Source:4) at
com.google.android.play.core.assetpacks.o4.g(Unknown Source:19) at
com.bookbot.i.s(Unknown Source:231) at com.bookbot.i.C(Unknown Source:24) at
com.bookbot.i.f(Unknown Source:0) at com.bookbot.h.run(Unknown Source:6) at
android.os.Handler.handleCallback(Handler.java:883) at android.os.Handler.dispatchMessage(Handler.java:100) at android.os.Looper.loop(Looper.java:214) at android.app.ActivityThread.main(ActivityThread.java:7397) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:935)
This document say The Play Store app is either not installed or not the official version
, but I don't really understand it. My app is only published into google play by using app bundle, I don't publish into anywhere else, so I wonder why it says playstore not official?
Here are some affected devices:
AT&T Fusion Z (android 10)
Galaxy S9 (android 10)
vsmart (android 11)
Is there any way to resolve this issue? Or at least can check if device is not supported by Play Asset Delivery?
CodePudding user response:
Well, the error message is telling you exactly what's wrong -- those specific devices either had their Play Store app removed or disabled. Or they could be rooted, and the Play Store app was modified. Or those devices could be set up without Google Services at all, and use alternate app stores.
It's easy enough to test for, though. Just use GoogleApiAvailability
:
val result = GoogleApiAvailability.getInstance().isGooglePlayServicesAvailable(activityContext)
and from there you can either implement your own logic, or have Google display their error dialog:
val dialog = GoogleApiAvailability.getInstance().getErrorDialog(activityContext, result, 123)
dialog?.show()
You can also set up onActivityResult()
to check the response from the error dialog