在试图从Google安装一些应用程序时,我遇到了以下错误:
LibraryUtils.isAvailable: not available restriction=9
DocUtils.getAvailabilityRestrictionResourceId: Item is not available. Reason: 9我正在x86硬件上运行一个自定义的AOSP版本(一个定制的Android风格)。我已经做了很多研究,也有很多模糊的尝试/猜测已经在网上找到答案,但我特别想知道“原因9”指的是什么。一旦我做到了这一点,我希望我能在AOSP中找到一个黑客,以避免错误,因为当我副业相同的应用程序运行良好。这是我的爱好,所以我不担心一些可能的意外副作用。
发布于 2015-08-31 09:04:51
如果您从设备中提取Play Store APK,则可以将其解压缩。我对APK进行了解压缩,并对您的错误消息进行了简单的搜索。错误消息可以在类com.google.android.finsky.utils.DocUtils中找到。
$ grep -lr "Item is not available"
com/google/android/finsky/utils/DocUtils.java以下是一种方法:
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;
}在您的示例中,响应的限制为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>在以下类中调用方法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这将是有益的,如果你提供的信息,何时这是被记录。
问题仍然很模糊。从谷歌搜索,一些人已经解决了类似的问题,通过改变一个系统属性(通常在/system/build.prop)。
也许不是你所期望的答案,但我希望我的研究能帮上忙。
https://stackoverflow.com/questions/31920605
复制相似问题