无法在自定义AOSP上安装Google Play中的某些应用:商品无法使用.原因:9

pil*_*ipe 3 android android-source android-x86 google-play

尝试从Google Play安装某些应用时出现以下错误:

LibraryUtils.isAvailable: not available restriction=9 
DocUtils.getAvailabilityRestrictionResourceId: Item is not available. Reason: 9
Run Code Online (Sandbox Code Playgroud)

我在x86硬件上运行AOSP(定制的Android x86风格)的定制版本.我已经研究了很多,网上已经有很多模糊的尝试/猜测,但我特别在寻找"理由9"所指的内容.一旦我有了这个,我希望我能在AOSP中找到一个黑客以避免错误,因为当我侧载相同的应用程序时,它们运行正常.这是我的爱好,所以我并不担心一些可能的意外副作用.

Jar*_*ler 9

如果您从设备中提取Play商店APK,则可以对其进行反编译.我反编译了APK,并简单搜索了您的错误消息.可以在课程中找到错误消息com.google.android.finsky.utils.DocUtils

$ grep -lr "Item is not available"
com/google/android/finsky/utils/DocUtils.java
Run Code Online (Sandbox Code Playgroud)

这是方法:

public static int getAvailabilityRestrictionResourceId(Document document) {
    int restriction = document.getAvailabilityRestriction();
    int resourceId = R.string.availability_restriction_generic;
    switch (restriction) {
        case 2:
            resourceId = R.string.availability_restriction_country;
            break;
        case 8:
            resourceId = R.string.availability_restriction_not_in_group;
            break;
        case 9:
            if (document.getDocumentType() != 1) {
                resourceId = R.string.availability_restriction_hardware;
                break;
            }
            resourceId = R.string.availability_restriction_hardware_app;
            break;
        case 10:
            resourceId = R.string.availability_restriction_carrier;
            break;
        case 11:
            resourceId = R.string.availability_restriction_country_or_carrier;
            break;
        case 12:
            resourceId = R.string.availability_restriction_search_level;
            break;
        case 21:
            resourceId = R.string.availability_restriction_for_managed_account;
            break;
        case 22:
            resourceId = R.string.availability_restriction_missing_permission;
            break;
    }
    FinskyLog.d("Item is not available. Reason: " + restriction);
    return resourceId;
}
Run Code Online (Sandbox Code Playgroud)

在您的情况下,响应的限制为9.这将获得两个字符串之一.如果我们使用ApkTool反编译APK的资源,我们可以看到这两个字符串的值.

<string name="availability_restriction_hardware">"Your device isn't compatible with this item."</string>
<string name="availability_restriction_hardware_app">"Your device isn't compatible with this version."</string>
Run Code Online (Sandbox Code Playgroud)

该方法getAvailabilityRestrictionResourceId(Document document)在以下类中调用:

$ grep -lr getAvailabilityRestrictionResourceId | grep -v DocUtils
com/google/android/finsky/activities/AppsPermissionsActivity.java
com/google/android/finsky/billing/lightpurchase/OfferResolutionActivity.java
com/google/android/finsky/detailspage/WarningMessageModule.java
com/google/android/finsky/layout/WarningMessageSection.java
Run Code Online (Sandbox Code Playgroud)

如果您提供有关何时记录此信息的信息,将会非常有用.


问题仍然模糊不清.通过在Google上搜索,有些人通过更改系统属性(最常见的是/system/build.prop)解决了类似的问题.

可能不是你希望的答案,但我希望我的研究有所帮助.