android-sdk icon indicating copy to clipboard operation
android-sdk copied to clipboard

Your SDK is out of date

Open iliferov opened this issue 7 years ago • 0 comments

I am using 1.0.1 BitPay SDK version and I am getting NullPointerException.

My code:

BitPayAndroid.withToken(BITPAY_TOKEN, "https://test.bitpay.com/").then(new BitpayPromiseCallback() {
            @Override
            public void onSuccess(BitPayAndroid bitPayAndroid) {
                Invoice newInvoice = new Invoice(amount, currency);
                newInvoice.setNotificationURL(BITPAY_WEB_HOOK_URL);
                bitPayAndroid.createNewInvoice(newInvoice).then(new PromiseCallback<Invoice>() {
                    @Override
                    public void onSuccess(Invoice invoice) {
                        Intent invoiceIntent = new Intent(WishDetailActivity.this, InvoiceActivity.class);
                        invoiceIntent.putExtra(InvoiceActivity.INVOICE, invoice);
                        //NPE here, example down below. 
                        //It seems BitPay SDK Invoice model is out of date. 
                        //It wants paymentUrls (which is deprecated field according to the BitPay docs), but
                        //receives paymentCodes
                        startActivity(invoiceIntent); 
                    }

Exception:

java.lang.RuntimeException: Unable to start activity ComponentInfo{cz.cvut.fit.elateme/com.bitpay.sdk.android.InvoiceActivity}: java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String com.bitpay.sdk.model.InvoicePaymentUrls.getBIP21()' on a null object reference
                                                                         at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2416)
                                                                         at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2476)
                                                                         at android.app.ActivityThread.-wrap11(ActivityThread.java)
                                                                         at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1344)
                                                                         at android.os.Handler.dispatchMessage(Handler.java:102)
                                                                         at android.os.Looper.loop(Looper.java:148)
                                                                         at android.app.ActivityThread.main(ActivityThread.java:5417)
                                                                         at java.lang.reflect.Method.invoke(Native Method)
                                                                         at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
                                                                         at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
                                                                      Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String com.bitpay.sdk.model.InvoicePaymentUrls.getBIP21()' on a null object reference
                                                                         at com.bitpay.sdk.android.InvoiceActivity.getAddress(InvoiceActivity.java:425)
                                                                         at com.bitpay.sdk.android.InvoiceActivity.onCreate(InvoiceActivity.java:159)
                                                                         at android.app.Activity.performCreate(Activity.java:6237)
                                                                         at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1107)

iliferov avatar May 18 '18 21:05 iliferov