question

demskigroup avatar image
demskigroup asked demskigroup commented

AppsConnector BindingException

I have been trying to use AppsConnector to get the current subscription of an app but AppsConnector is returning a bindingexception and is not connecting properly. I'm using v3 of AppsConnector.

This is in my connector method, I have a merchant and order connector as well and both of those work fine:

appConnector = new AppsConnector(this,
mAccount); appConnector.connect();

Used to call the below method after connecting:

new getAppSub().execute();

Here is my method for after connecting:

 private class getAppSub extends AsyncTask<String, Void, Boolean> {
        @Override
        protected Boolean doInBackground(String... params) {

            try {
                app = appConnector.getApp();
                System.out.println("SubscriptionName: " + app.getName());
            } catch (RemoteException e) {
                e.printStackTrace();
            } catch (ServiceException e) {
                e.printStackTrace();
            } catch (BindingException e) {
                e.printStackTrace();
            } catch (ClientException e) {
                e.printStackTrace();
            }
            if (app.getCurrentSubscription() != null) {
                AppSubscription subscription = app.getCurrentSubscription();
                if (Strings.isNullOrEmpty(subscription.getDescription())) {
                    System.out.println("Subscription1: " + subscription.getName());
                } else {
                    System.out.println("Subscription2: " + subscription.getName());
                }
            }

            return true;
        }
    }

The binding exception occurs on this line:

app = appConnector.getApp();

and here is the exception message itself:

W/System.err: com.clover.sdk.v1.BindingException: Could not bind to Android service
W/System.err:     at com.clover.sdk.v1.ServiceConnector.waitForConnection(ServiceConnector.java:162)
W/System.err:     at com.clover.sdk.v1.ServiceConnector.execute(ServiceConnector.java:208)
W/System.err:     at com.clover.sdk.v3.apps.AppsConnector.getApp(AppsConnector.java:54)
W/System.err:     at zoomifi.terminalsale.MainSaleActivity$getAppSub.doInBackground(MainSaleActivity.java:1148)
W/System.err:     at zoomifi.terminalsale.MainSaleActivity$getAppSub.doInBackground(MainSaleActivity.java:1140)
W/System.err:     at android.os.AsyncTask$2.call(AsyncTask.java:288)
W/System.err:     at java.util.concurrent.FutureTask.run(FutureTask.java:237)
W/System.err:     at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:231)
W/System.err:     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
W/System.err:     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
W/System.err:     at java.lang.Thread.run(Thread.java:841)

A more complete logcat, the fatal error at the end is from appConnector.getApp()

03-21 15:34:53.572 4901-4901/? D/dalvikvm: Late-enabling CheckJNI
03-21 15:34:53.593 4901-4908/? D/dalvikvm: Debugger has detached; object registry had 1 entries
03-21 15:34:53.613 4901-4901/? I/System.out: APPLICATION CALLED
03-21 15:34:53.622 4901-4901/? W/dalvikvm: VFY: unable to find class referenced in signature (Landroid/view/SearchEvent;)
03-21 15:34:53.622 4901-4901/? I/dalvikvm: Could not find method android.view.Window$Callback.onSearchRequested, referenced from method android.support.v7.view.WindowCallbackWrapper.onSearchRequested
03-21 15:34:53.622 4901-4901/? W/dalvikvm: VFY: unable to resolve interface method 18277: Landroid/view/Window$Callback;.onSearchRequested (Landroid/view/SearchEvent;)Z
03-21 15:34:53.622 4901-4901/? D/dalvikvm: VFY: replacing opcode 0x72 at 0x0002
03-21 15:34:53.622 4901-4901/? I/dalvikvm: Could not find method android.view.Window$Callback.onWindowStartingActionMode, referenced from method android.support.v7.view.WindowCallbackWrapper.onWindowStartingActionMode
03-21 15:34:53.622 4901-4901/? W/dalvikvm: VFY: unable to resolve interface method 18281: Landroid/view/Window$Callback;.onWindowStartingActionMode (Landroid/view/ActionMode$Callback;I)Landroid/view/ActionMode;
03-21 15:34:53.622 4901-4901/? D/dalvikvm: VFY: replacing opcode 0x72 at 0x0002
03-21 15:34:53.654 4901-4901/? W/ContextImpl: Implicit intents with startService are not safe: Intent { act=com.clover.intent.action.ORDER_SERVICE_V3 (has extras) } android.content.ContextWrapper.bindService:517 com.clover.sdk.v1.ServiceConnector.connect:118 zoomifi.terminalsale.MainSaleActivity.connect:342 
03-21 15:34:53.656 4901-4901/? W/ContextImpl: Implicit intents with startService are not safe: Intent { act=com.clover.sdk.merchant.intent.action.MERCHANT_SERVICE (has extras) } android.content.ContextWrapper.bindService:517 com.clover.sdk.v1.ServiceConnector.connect:118 zoomifi.terminalsale.MainSaleActivity.connect:344 
03-21 15:34:53.657 4901-4901/? W/ContextImpl: Implicit intents with startService are not safe: Intent { act=com.clover.sdk.customer.intent.action.CUSTOMER_SERVICE (has extras) } android.content.ContextWrapper.bindService:517 com.clover.sdk.v1.ServiceConnector.connect:118 zoomifi.terminalsale.MainSaleActivity.connect:346 
03-21 15:34:53.666 4901-4901/? W/ContextImpl: Implicit intents with startService are not safe: Intent { act=com.clover.sdk.app.intent.action.APPS_SERVICE (has extras) } android.content.ContextWrapper.bindService:517 com.clover.sdk.v1.ServiceConnector.connect:118 zoomifi.terminalsale.MainSaleActivity.connect:350 
03-21 15:34:53.668 4901-4901/? W/ContextImpl: Implicit intents with startService are not safe: Intent { act=com.clover.sdk.printer.intent.action.RECEIPT_REGISTRATION_SERVICE (has extras) } android.content.ContextWrapper.bindService:517 com.clover.sdk.v1.ServiceConnector.connect:118 zoomifi.terminalsale.MainSaleActivity.connectReceiptConnector:402 
03-21 15:34:56.671 4901-4928/zoomifi.terminalsale I/ServiceConnector: waitForConnection result: true, retryCount: 1
03-21 15:34:56.677 4901-4928/zoomifi.terminalsale W/System.err: com.clover.sdk.v1.BindingException: Could not bind to Android service
03-21 15:34:56.679 4901-4928/zoomifi.terminalsale W/System.err:     at com.clover.sdk.v1.ServiceConnector.waitForConnection(ServiceConnector.java:162)
03-21 15:34:56.680 4901-4928/zoomifi.terminalsale W/System.err:     at com.clover.sdk.v1.ServiceConnector.execute(ServiceConnector.java:208)
03-21 15:34:56.681 4901-4928/zoomifi.terminalsale W/System.err:     at com.clover.sdk.v3.apps.AppsConnector.getApp(AppsConnector.java:54)
03-21 15:34:56.681 4901-4928/zoomifi.terminalsale W/System.err:     at zoomifi.terminalsale.MainSaleActivity$getAppSub.doInBackground(MainSaleActivity.java:1148)
03-21 15:34:56.681 4901-4928/zoomifi.terminalsale W/System.err:     at zoomifi.terminalsale.MainSaleActivity$getAppSub.doInBackground(MainSaleActivity.java:1140)
03-21 15:34:56.682 4901-4928/zoomifi.terminalsale W/System.err:     at android.os.AsyncTask$2.call(AsyncTask.java:288)
03-21 15:34:56.682 4901-4928/zoomifi.terminalsale W/System.err:     at java.util.concurrent.FutureTask.run(FutureTask.java:237)
03-21 15:34:56.684 4901-4928/zoomifi.terminalsale W/System.err:     at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:231)
03-21 15:34:56.684 4901-4928/zoomifi.terminalsale W/System.err:     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
03-21 15:34:56.685 4901-4928/zoomifi.terminalsale W/System.err:     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
03-21 15:34:56.686 4901-4928/zoomifi.terminalsale W/System.err:     at java.lang.Thread.run(Thread.java:841)
03-21 15:34:56.688 4901-4928/zoomifi.terminalsale W/dalvikvm: threadid=12: thread exiting with uncaught exception (group=0x4168dba8)
03-21 15:34:56.691 4901-4977/zoomifi.terminalsale D/CloverAuth: Authenticating Account {name=Zoomifi, Inc | jmarcus@zoomifi.com (DEV), type=com.clover.account}
03-21 15:34:56.714 4901-4977/zoomifi.terminalsale V/CloverAuth: Bundle result returned from account manager: 
03-21 15:34:56.714 4901-4977/zoomifi.terminalsale V/CloverAuth: authAccount => Zoomifi, Inc | jmarcus@zoomifi.com (DEV)
03-21 15:34:56.716 4901-4977/zoomifi.terminalsale V/CloverAuth: base_url => https://apisandbox.dev.clover.com
03-21 15:34:56.716 4901-4928/zoomifi.terminalsale E/AndroidRuntime: FATAL EXCEPTION: AsyncTask #1
                                                                    Process: zoomifi.terminalsale, PID: 4901
                                                                    java.lang.RuntimeException: An error occured while executing doInBackground()
                                                                        at android.os.AsyncTask$3.done(AsyncTask.java:300)
                                                                        at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:355)
                                                                        at java.util.concurrent.FutureTask.setException(FutureTask.java:222)
                                                                        at java.util.concurrent.FutureTask.run(FutureTask.java:242)
                                                                        at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:231)
                                                                        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
                                                                        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
                                                                        at java.lang.Thread.run(Thread.java:841)
                                                                     Caused by: java.lang.NullPointerException
                                                                        at zoomifi.terminalsale.MainSaleActivity$getAppSub.doInBackground(MainSaleActivity.java:1160)
                                                                        at zoomifi.terminalsale.MainSaleActivity$getAppSub.doInBackground(MainSaleActivity.java:1140)
                                                                        at android.os.AsyncTask$2.call(AsyncTask.java:288)
                                                                        at java.util.concurrent.FutureTask.run(FutureTask.java:237)
                                                                        at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:231) 
                                                                        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112) 
                                                                        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587) 
                                                                        at java.lang.Thread.run(Thread.java:841)
4 comments
10 |2000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Jeffrey Blattman avatar image Jeffrey Blattman ♦♦ commented ·

More contextual logcat would help. There may be an error of some sort before the trace.

0 Likes 0 ·
demskigroup avatar image demskigroup commented ·

I added a more complete logcat

0 Likes 0 ·
Jeffrey Blattman avatar image Jeffrey Blattman ♦♦ commented ·

I don't see the problem, assuming you have com.clover.engine installed which is where the service is hosted. Can you create an MVCE and include a link to it so we can verify the problem?

0 Likes 0 ·
demskigroup avatar image demskigroup commented ·

Yes, I can try that. I've been following the clover example at: https://github.com/clover/android-exa...

0 Likes 0 ·

1 Answer

demskigroup avatar image
demskigroup answered

Here is a more complete logcat, the fatal error at the end is from appConnector.getApp() being null.

03-21 15:34:53.572 4901-4901/? D/dalvikvm: Late-enabling CheckJNI 03-21 15:34:53.593 4901-4908/? D/dalvikvm: Debugger has detached; object registry had 1 entries 03-21 15:34:53.613 4901-4901/? I/System.out: APPLICATION CALLED 03-21 15:34:53.622 4901-4901/? W/dalvikvm: VFY: unable to find class referenced in signature (Landroid/view/SearchEvent;) 03-21 15:34:53.622 4901-4901/? I/dalvikvm: Could not find method android.view.Window$Callback.onSearchRequested, referenced from method android.support.v7.view.WindowCallbackWrapper.onSearchRequested 03-21 15:34:53.622 4901-4901/? W/dalvikvm: VFY: unable to resolve interface method 18277: Landroid/view/Window$Callback;.onSearchRequested (Landroid/view/SearchEvent;)Z 03-21 15:34:53.622 4901-4901/? D/dalvikvm: VFY: replacing opcode 0x72 at 0x0002 03-21 15:34:53.622 4901-4901/? I/dalvikvm: Could not find method android.view.Window$Callback.onWindowStartingActionMode, referenced from method android.support.v7.view.WindowCallbackWrapper.onWindowStartingActionMode 03-21 15:34:53.622 4901-4901/? W/dalvikvm: VFY: unable to resolve interface method 18281: Landroid/view/Window$Callback;.onWindowStartingActionMode (Landroid/view/ActionMode$Callback;I)Landroid/view/ActionMode; 03-21 15:34:53.622 4901-4901/? D/dalvikvm: VFY: replacing opcode 0x72 at 0x0002 03-21 15:34:53.654 4901-4901/? W/ContextImpl: Implicit intents with startService are not safe: Intent { act=com.clover.intent.action.ORDERSERVICEV3 (has extras) } android.content.ContextWrapper.bindService:517 com.clover.sdk.v1.ServiceConnector.connect:118 zoomifi.terminalsale.MainSaleActivity.connect:342 03-21 15:34:53.656 4901-4901/? W/ContextImpl: Implicit intents with startService are not safe: Intent { act=com.clover.sdk.merchant.intent.action.MERCHANTSERVICE (has extras) } android.content.ContextWrapper.bindService:517 com.clover.sdk.v1.ServiceConnector.connect:118 zoomifi.terminalsale.MainSaleActivity.connect:344 03-21 15:34:53.657 4901-4901/? W/ContextImpl: Implicit intents with startService are not safe: Intent { act=com.clover.sdk.customer.intent.action.CUSTOMERSERVICE (has extras) } android.content.ContextWrapper.bindService:517 com.clover.sdk.v1.ServiceConnector.connect:118 zoomifi.terminalsale.MainSaleActivity.connect:346 03-21 15:34:53.666 4901-4901/? W/ContextImpl: Implicit intents with startService are not safe: Intent { act=com.clover.sdk.app.intent.action.APPSSERVICE (has extras) } android.content.ContextWrapper.bindService:517 com.clover.sdk.v1.ServiceConnector.connect:118 zoomifi.terminalsale.MainSaleActivity.connect:350 03-21 15:34:53.668 4901-4901/? W/ContextImpl: Implicit intents with startService are not safe: Intent { act=com.clover.sdk.printer.intent.action.RECEIPTREGISTRATIONSERVICE (has extras) } android.content.ContextWrapper.bindService:517 com.clover.sdk.v1.ServiceConnector.connect:118 zoomifi.terminalsale.MainSaleActivity.connectReceiptConnector:402 03-21 15:34:56.671 4901-4928/zoomifi.terminalsale I/ServiceConnector: waitForConnection result: true, retryCount: 1 03-21 15:34:56.677 4901-4928/zoomifi.terminalsale W/System.err: com.clover.sdk.v1.BindingException: Could not bind to Android service 03-21 15:34:56.679 4901-4928/zoomifi.terminalsale W/System.err: at com.clover.sdk.v1.ServiceConnector.waitForConnection(ServiceConnector.java:162) 03-21 15:34:56.680 4901-4928/zoomifi.terminalsale W/System.err: at com.clover.sdk.v1.ServiceConnector.execute(ServiceConnector.java:208) 03-21 15:34:56.681 4901-4928/zoomifi.terminalsale W/System.err: at com.clover.sdk.v3.apps.AppsConnector.getApp(AppsConnector.java:54) 03-21 15:34:56.681 4901-4928/zoomifi.terminalsale W/System.err: at zoomifi.terminalsale.MainSaleActivity$getAppSub.doInBackground(MainSaleActivity.java:1148) 03-21 15:34:56.681 4901-4928/zoomifi.terminalsale W/System.err: at zoomifi.terminalsale.MainSaleActivity$getAppSub.doInBackground(MainSaleActivity.java:1140) 03-21 15:34:56.682 4901-4928/zoomifi.terminalsale W/System.err: at android.os.AsyncTask$2.call(AsyncTask.java:288) 03-21 15:34:56.682 4901-4928/zoomifi.terminalsale W/System.err: at java.util.concurrent.FutureTask.run(FutureTask.java:237) 03-21 15:34:56.684 4901-4928/zoomifi.terminalsale W/System.err: at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:231) 03-21 15:34:56.684 4901-4928/zoomifi.terminalsale W/System.err: at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112) 03-21 15:34:56.685 4901-4928/zoomifi.terminalsale W/System.err: at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587) 03-21 15:34:56.686 4901-4928/zoomifi.terminalsale W/System.err: at java.lang.Thread.run(Thread.java:841) 03-21 15:34:56.688 4901-4928/zoomifi.terminalsale W/dalvikvm: threadid=12: thread exiting with uncaught exception (group=0x4168dba8) 03-21 15:34:56.691 4901-4977/zoomifi.terminalsale D/CloverAuth: Authenticating Account {name=Zoomifi, Inc | jmarcus@zoomifi.com (DEV), type=com.clover.account} 03-21 15:34:56.714 4901-4977/zoomifi.terminalsale V/CloverAuth: Bundle result returned from account manager: 03-21 15:34:56.714 4901-4977/zoomifi.terminalsale V/CloverAuth: authAccount => Zoomifi, Inc | jmarcus@zoomifi.com (DEV) 03-21 15:34:56.716 4901-4977/zoomifi.terminalsale V/CloverAuth: baseurl => https://apisandbox.dev.clover.com 03-21 15:34:56.716 4901-4928/zoomifi.terminalsale E/AndroidRuntime: FATAL EXCEPTION: AsyncTask #1 Process: zoomifi.terminalsale, PID: 4901 java.lang.RuntimeException: An error occured while executing doInBackground() at android.os.AsyncTask$3.done(AsyncTask.java:300) at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:355) at java.util.concurrent.FutureTask.setException(FutureTask.java:222) at java.util.concurrent.FutureTask.run(FutureTask.java:242) at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:231) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587) at java.lang.Thread.run(Thread.java:841) Caused by: java.lang.NullPointerException at zoomifi.terminalsale.MainSaleActivity$getAppSub.doInBackground(MainSaleActivity.java:1160) at zoomifi.terminalsale.MainSaleActivity$getAppSub.doInBackground(MainSaleActivity.java:1140) at android.os.AsyncTask$2.call(AsyncTask.java:288) at java.util.concurrent.FutureTask.run(FutureTask.java:237) at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:231)  at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)  at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)  at java.lang.Thread.run(Thread.java:841) 

10 |2000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Welcome to the
Clover Developer Community