Android market: Your device is not compatible with this item
用 apktool 1.4.1 反编译Vending.apk 3.1.3版本,遇到错误,无法插入调试信息再打包重新安装。搜索反编译后的文件查找信息:
smali/com/android/vending/R$string.smali:.field public static final availability_restriction_hardware:I = 0x7f080191
deli@deli-laptop:~/Desktop/a/Vending$ grep 0x7f080191 * -r
smali/com/google/android/finsky/activities/DetailsAvailabilityRestrictionViewBinder.smali: const v3, 0x7f080191
猜出大概代码:
public bind(View view, Document document, int iconWidth, int iconRightMargin, DfeToc toc) {
TextView reason = view.findViewById(R.id.restriction_reason);
int restriction = document.getAvailabilityRestriction();
switch (restriction) {
case 4:
reason.setText(R.string.availability_restriction_hardware);
break;
}
}
public int getAvailabilityRestriction() {
boolean hasAvailability = mFinskyDoc.hasAvailability();
if (hasAvailability) {
int restriction = mFinskyDoc.getAvailability().getRestriction();
reutrn restriction;
}
return -1;
}
restriction的值是通过 setRestriction 设置,读取protobuf数据,也没弄清楚,因为无法插入调试信息。发现3.1.3版本比以前版本复杂多了。
最后发现
deli@deli-laptop:~$ diff build.prop build.prop~
31c31
< ro.build.fingerprint=N708_800_600/broncho_N708/N708_800_600/:2.2/FRF91/user.N708_800_600.20110917.133140:user/test-keys
---
> ro.build.fingerprint=N708/broncho_N708/N708_800_600/:2.2/FRF91/user.N708_800_600.20110917.133140:user/test-keys
ro.build.fingerprint=N708,N708这个是我们的项目名,临时修改编译脚本成N708_800_600,出现下划线,导致被google过滤掉了。搞第三方ROM的,注意了,别随意修改系统参数,除非你真的明白你在干啥东东。