關於如何在Google Play Store 購買付費APP
今天要測試專案的應用內支付功能,發現不好測試,在大陸無法付費。
想辦法搞一張美國的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.
而且:有些時候通訊總是不穩定,有時候會出現如下圖這樣的情形:
參考資料:
另付:htc desire 重新整理教程: