question

plin avatar image
plin asked David Marginian Deactivated commented

How to run debug mode in android studio?

I go over the documentation and many threads and realize before you can side-load the app, you have to
1. Sign and submit your app to Clover
2. Download the app from app market to the devkit (station 2018)
3. Then you can side-load the app afterward

I am able to execute step 1 and 2

However, if I run "debug" from Android studio, I see the popup said "Application Installation Failed" due to "The device already has an application with the same package but a different signature. In order to proceed, you will have to uninstall the existing application. ... Do you want to uninstall the existing application"

I select OK and Android studio install the debug version on the machine. I am able to set the breakpoint s to examine the data here and there.

In my code, I am trying to getMerchant. I am able to call "CloverAccount.getAccount" to get the clover account. But running the following code lead me "onServiceFailure".

mMerchantConnector.getMerchant(new ServiceConnector.Callback<Merchant>() {
   @Override
   public void onServiceSuccess(Merchant result, ResultStatus status) {

   }

   @Override
   public void onServiceFailure(ResultStatus status) {
   
   }

   @Override
   public void onServiceConnectionFailure() {
   }
});

The status show

ResultStatus{statusCode=FORBIDDEN, statusMessage=App doesn't have required permission: package xxxxxxx does not have permission MERCHANT_R}

Because of the popup alert, first I check the bundle.gradle. Make sure the signingConfigs is the one I used to sign the uploaded apk

    signingConfigs {
        debug {
            storeFile file('clover.keystore')
            storePassword 'xxxxxxxxxxxx'
            keyAlias 'cert'
            keyPassword 'xxxxxxxxxxxx'
        }
and the buildTypes
buildTypes {
    debug {
        signingConfig signingConfigs.debug
    }

I also double checked the permission I asked for the clover app. These permission don't change from the beginning.
(Merchant: Read, Inventory: Read, Order: Read, Write, Customer: Read, Write, Payment: Read)

I am stuck on this for 2 days. Couldn't figure out where goes wrong. Any clues will be appreciated!
DevKit
10 |2000

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

plin avatar image
plin answered David Marginian Deactivated commented
Turns out I found something worth to try and it works. Your link also gave me the same clue.

https://community.clover.com/questions/15316/testing-application-on-device-fails-after-each-upd.html
Quote from the OP answer
Upload release apk
Download it to you device or emulator.
uninstall it using adb command.
use Android studio or adb to install your app locally.
open Reigster app, transaction app, or setup app and press the sycn button.
You app with now have permissions.
Open Register app to sync before running my app is the key! I don't know why this step is not even mentioned in any documents. Please update the documents if you guys have a chance. And thanks for the clue.
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.

David Marginian avatar image David Marginian ♦♦ commented ·

I'm glad you got it working. I created an internal issue for our documentation team.

0 Likes 0 ·
David Marginian avatar image
David Marginian Deactivated answered
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