question

jaimel avatar image
jaimel asked Jacob Abrams commented

Open Cash Drawer

I trigger a cash open command in the Clover Station 2018 and it works, now the same code does not work on the Duo or the Solo, in the Manifest file I have the

<use-permission android:name="clover.permission.POP_CASH_DRAWER_NEW" />


The code is

public void onOpenCashDrawerClick() {

    Context appCt = getApplicationContext();
    CashDrawers cds = new CashDrawers(appCt);
    Log.i("onOpenCashDrawerClick", String.valueOf(cds.list().size()));
    for (int i = 0; i <  cds.list().size(); i++)
    {
        Log.i("inside1for",String.valueOf(i));
        cds.list().iterator().next().pop();
    }

    Set<CashDrawer> drawers = new CashDrawers(appCt).list(); // get the set of connected cash drawers
    for (CashDrawer cd : drawers) {
        Log.i("inside2for", String.valueOf(cd.getDrawerNumber()));
        cd.pop(); // pop each connected cash drawer
    }
}
clover developer community
10 |2000

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

Jacob Abrams avatar image
Jacob Abrams answered

What version of the clover-android-sdk library are you using? The code you wrote looks correct but I suspect you are using an old version of the clover-android-sdk from before 262.2. Please update to the latest clover-android-sdk which as of writing is 284.


It was briefly noted at https://docs.clover.com/docs/clover-android-sdk-v2622-release-notes that there were improvements to the cash drawer API, specifically the SDK was improved to automatically support new Clover devices so hopefully once you start using this version it cash drawers on all current and future devices will work without needing to update the clover-android-sdk.


10 |2000

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

jaimel avatar image
jaimel answered

In the code the list of cash drawers are always 0, so the line of code that suppose to give me back the list of cash drawers connected to the Clover device does not return any.


10 |2000

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

jaimel avatar image
jaimel answered Jacob Abrams commented

Thank you Jacob, that is what I though, I donwloaded the latest version of the SDK, now I am trying to update the sdk within the project but I am getting all shorts of erros and problems with the grade built, is there a procedure to easily update the clover sdk in an existin gproject?

1 comment
10 |2000

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

Jacob Abrams avatar image Jacob Abrams ♦♦ commented ·

Generally we try to make updates seamless but there are times when we make non-backwards compatible changes though we usually warn developers about this in the release notes https://docs.clover.com/docs/release-notes-announcements

Without knowing the errors there is no way to know what errors you are getting there is no way I can suggest how to address them. Can you post a log with the errors you see.

0 Likes 0 ·
jaimel avatar image
jaimel answered

> Task :comprise-smartmoneymanager:minifyDebugWithR8 FAILED

AGPBI: {"kind":"error","text":"Type com.clover.sdk.v3.base.Point$1 is defined multiple times: C:\\Code\\Clover\\comprise-smartmoneymanager\\clover-android-connector-sdk\\build\\intermediates\\runtime_library_classes_jar\\debug\\classes.jar:com/clover/sdk/v3/base/Point$1.class, C:\\Code\\Clover\\comprise-smartmoneymanager\\clover-android-sdk\\build\\intermediates\\runtime_library_classes_jar\\debug\\classes.jar:com/clover/sdk/v3/base/Point$1.class","sources":[{"file":"C:\\Code\\Clover\\comprise-smartmoneymanager\\clover-android-connector-sdk\\build\\intermediates\\runtime_library_classes_jar\\debug\\classes.jar"}],"tool":"R8"}


Execution failed for task ':comprise-smartmoneymanager:minifyDebugWithR8'.

> com.android.tools.r8.CompilationFailedException: Compilation failed to complete, origin: C:\Code\Clover\comprise-smartmoneymanager\clover-android-connector-sdk\build\intermediates\runtime_library_classes_jar\debug\classes.jar:com/clover/sdk/v3/base/Point$1.class


* Try:

Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.



10 |2000

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

jaimel avatar image
jaimel answered Jacob Abrams edited

Jacob, I updated the Development studio and the gradle along with the dependencies, my project has included the clover-android-connector-sdk, the clover-android-loyalty-kit and the clover-android-sdk

that is the settings.gradle below

include 'clover-android-sdk'
include 'clover-android-connector-sdk'
include 'clover-android-loyalty-kit'
include 'comprise-smartmoneymanager'
1 comment
10 |2000

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

Jacob Abrams avatar image Jacob Abrams ♦♦ commented ·

Looks like perhaps you actually downloaded the clover-android-sdk source code and are including it as a module? I wouldn't recommend using it that way.

Prefer obtaining a prebuilt version from maven like so in your build.gradle file in the dependencies area:

implementation 'com.clover.sdk:clover-android-sdk:284'
implementation 'com.clover.sdk:clover-android-loyalty-kit:284'
implementation 'com.clover.sdk:clover-android-connector-sdk:284'

Also it's possible you are hitting this bug Google has recently fixed: https://issuetracker.google.com/issues/223365583 If you are using android gradle plugin 7.1.0, 7.1.1 or 7.1.2 please upgrade to 7.1.3:

classpath "com.android.tools.build:gradle:7.1.3"
0 Likes 0 ·
jaimel avatar image
jaimel answered Jacob Abrams commented

Jacob, so I think that the groove library is not loaded, as a result the XmlParser is not available and the xml files like the javadoc.xml is not parsed, I am not sure where in the project to add the dependency..

1 comment
10 |2000

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

Jacob Abrams avatar image Jacob Abrams ♦♦ commented ·
0 Likes 0 ·
jaimel avatar image
jaimel answered Jacob Abrams commented

Jacob,

I updated all the Clover SDK and new Android sdk, it all seems to be working as expected, thank you.

1 comment
10 |2000

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

Jacob Abrams avatar image Jacob Abrams ♦♦ commented ·
Welcome :)
-1 Like -1 ·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

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