今天要测试项目的应用内支付功能,发现不好测试,在大陆无法付费。
想办法搞一张美国的SIM卡 ()
按这个http://noirbright.com/?p=530上面的教程,试了一下,模拟T_Mobile 运营商成功了! 电子市场里的应用可以正常下载。(有一个自己开发的APP,原来不能在国内下载的,现在可以下载使用了。)关于 付费APP的下载 ,我试了一下,发现当你进行到下面的界面的时候:(由于本人没有VISA 或者 MasterCard 卡,所以无法顺利完成测试)
然后再点击 Continue,就会crash ,如下图:
Crash的原因是:
java.lang.NullPointerException
at com.google.android.finsky.billing.creditcard.AddCreditCardFragment.getAddressSpec(AddCreditCardFragment.java:249)
at com.google.android.finsky.billing.creditcard.AddCreditCardFragment.setupWidgets(AddCreditCardFragment.java:349)
at com.google.android.finsky.billing.creditcard.AddCreditCardFragment.onBillingCountriesLoaded(AddCreditCardFragment.java:286)
at com.google.android.finsky.billing.creditcard.AddCreditCardFragment.access$400(AddCreditCardFragment.java:55)
at com.google.android.finsky.billing.creditcard.AddCreditCardFragment$3.run(AddCreditCardFragment.java:271)
at com.google.android.finsky.billing.GetBillingCountriesAction.run(GetBillingCountriesAction.java:40)
at com.google.android.finsky.billing.creditcard.AddCreditCardFragment.loadBillingCountries(AddCreditCardFragment.java:268)
at com.google.android.finsky.billing.creditcard.AddCreditCardFragment.onCreateView(AddCreditCardFragment.java:243)
at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:870)
at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1080)
at android.support.v4.app.BackStackRecord.run(BackStackRecord.java:622)
at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1416)
at android.support.v4.app.FragmentManagerImpl$1.run(FragmentManager.java:420)
at android.os.Handler.handleCallback(Handler.java:587)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:130)
at android.app.ActivityThread.main(ActivityThread.java:3694)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:507)
产生这个错误的原因是: Google 还是可以发现你处于没有被授权支付的国度。这好像是躲不过去的,SIM卡里的地理信息好像是伪装不了的。
When an invalid country (one not authorized/enabled for purchases like China) code is read from the SIM and not found in the list mCountries ( BillingPreferences.BILLING_COUNTRIES ), the mSelectedCountry is set to NULL: private void setupWidgets(Bundle bundle) { mSelectedCountry = BillingUtils.findCountry(BillingUtils.getDefaultCountry(getActivity(), null), mCountries); ... mBillingAddress.setAddressSpec(mSelectedCountry, getAddressSpec(mSelectedCountry)); ... } SUGGESTED FIX: com.google.android.finsky.billing.creditcard.AddCreditCardFragment.getAddressSpecroutine should check parameter NULL condition.
而且:有些时候通信总是不稳定,有时候会出现如下图这样的情形:
参考资料:
http://bbs.saraba1st.com/2b/simple/?t793031.html
另付:htc desire 刷新教程: