Month: September 2011

  • 解决电子市场 3.13版本 “您的设备与此商品不兼容”的问题

    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的,注意了,别随意修改系统参数,除非你真的明白你在干啥东东。

  • A simple http web service

    很久没更新blog了,主要是这段时间工作太忙,刚加入一家创业公司 iboxpay,做移动支付,就是做中国版的Square 🙂

    重新温习 socket之类的内容,翻看以前写的一些代码,整理一下,一个简单的 web server,放在 github:https://github.com/lytsing/myhttpd
    这个例子很简单,但涉及到的内容都具备了:

    • 基础socket使用
    • 多路复用
    • 信号处理
    • 配置文件读取

    等周末再完善,加上ipv6支持,当做一个学习的教程吧。