failed to install via phone

Tagged:

Currently contains 14 posts

Avatar

February 17, 2016 21:52

Song XU

Hi support team,

I followed the instructions from Fidesmo gradle plugin, yet failed to install via phone. My phone is Galaxy Note II, and card is Privacy Card Black.
After I sent the build command:
./gradlew installToLocalCard -P fidesmo.adb_reader —stacktrace

I got answer:
_______________________
:deleteFromLocalCard FAILED

FAILURE: Build failed with an exception.

  • What went wrong:
    Execution failed for task ‘:deleteFromLocalCard’.
    > 401 Unauthorized
    _______________________

I’m curious it’s the first installation for the sample Cardlet, which is registered in Fidesmo Dashboard, how comes the error from ‘deleteFromLocalCard’?

Let me know if a full log would help.

Thanks.
Song

Avatar

February 18, 2016 15:38

NFCtester

Hi Song,

The first task in installToLocalCard is always an attempt to delete any existing applet with the same AID – as a development tool, it assumes that the developer will want to replace the existing applet with the newest version. If there is none, as in your case, execution should continue without any trouble.

As for the error 401, it is returned by our server when the combination fidesmoAppId/fidesmoAppKey in your gradle.properties file does not match the correct credentials for your account. An easy way to set those properties is described in the tutorial https://developer.fidesmo.com/tutorials/javacard , in section “Building and installing the cardlet”.

Thanks for posting your question in our forum.

Regards,
/Miguel

Avatar

February 18, 2016 17:50

Song XU

Hi Miguel,

Thanks for your prompt answer. I corrected the credential mistake. Now the error message is:
_____________________________________

  • What went wrong:
    Execution failed for task ‘:deleteFromLocalCard’.
    > Unable to determine out come of operation
    …. more
    Caused by: retrofit.RetrofitError: 404 Not Found
    at retrofit.RetrofitError.httpError(RetrofitError.java:40)
    at retrofit.RestAdapter$RestHandler.invokeRequest(RestAdapter.java:383)
    _____________________________________

The tutorial you mentioned doesn’t have information for install via phone. I refer to your github page (https://github.com/fidesmo/gradle-fidesmo#android-phone-as-card-reader).

Hope here is the right place to post questions like this, or better through github?

Thanks.
Song

Avatar

February 18, 2016 19:04

NFCtester

Hi Song,

This place is great to post questions like this one! This way, everyone can find them if they run into similar issues. We also have the support email support@fidesmo.com

I can reproduce that same error by simply not connecting any phone to my computer, or by letting the command time out by not taking any card to my phone. So there must be something going on with the connection card-phone-computer. When running the command, can you see any changes on the phone screen? It should say “Run ‘deleteFromLocalCard’ task” above an animation showing a card tapping a smartphone.

Regards,
/Miguel

Avatar

February 24, 2016 21:33

Song XU

Miguel,

The phone screen stayed in ‘ready for commands’ all the time even my card tapped the phone. The NFC activation works well with Fidesmo demo app. So after taking a deep breath, I will try to find out the connection problem, which is normally biggest headache for card and phone communication. Any suggestion for identifing error? I will work on it tomorrow and keep you updated.

Cheers,
Song

Avatar

February 25, 2016 10:01

Fidesmo Administrator

Hi Song & Miguel,

The plugin uses ADB to talk with the phone and trigger the phone via intent, So one thing you can test is to run the ADB command directly. Connect the phone with USB. Start the Fidesmo application in “Card reader mode”. Then run the following command from your computer:

adb shell am start -W com.fidesmo.sec.android/.ui.OperationActivity_

If it works it should then trigger the fidesmo application to move over to the next screen (when it asks you to put your card behind the phone). If it doesn’t work, there is really a problem in the communication between the phone and the computer.

I have also created a github issue for this, so that if we find a solution we can implement it. To make it more specific it would be great to know:
- What is the brand and model of your phone?
- What version of Android is it running?
- The output of the command “adb version”, basically which version of ADB you are running

The issue is available here: https://github.com/fidesmo/gradle-fidesmo/issues/31

Thanks!
Petter

Avatar

February 25, 2016 22:09

Song XU

Hi Petter and Miguel,

Here’s the situation:
- Still ‘Ready for commands’ after Petter’s adb command test, I figure out there might be communication failure at low level. Test ‘adb devices’ command and get my guess proved.

- Tens of tips to activate mobile with adb.
1) install vendor’s USB driver
2) turn on developer mode (Settings→About device.Hit the ‘Build number’ for 7 times)
3) add vendor ID into ~/.android/adb_usb.ini (For vendor ID, Mac Utilities→System Information→USB)
4) switch USB connection option from ‘MTP’ to ‘PTP’ on phone
5) phone settings→Developer options→USB debugging (get checked)
Trust me, StackOverflow will show you people get this solved via tens of combinations. For me, 2&5 work well.

- Now Petter’s command ‘adb shell am start OperationActivity’ bring my phone screen into another message box: ‘Put back the card and hold on…’ Which is really exciting…well, at least for 5 seconds. After my card tapped phone on its back, Fidesmo app poped up warning message: ‘Unfortunately, Fidesmo has stopped’.

- It looks some compatibility problems cause the app stopped. Hope my device information is useful:
Samsung Galaxy Note II (SCH-N719 for China Telecom)
Android OS 4.3
Baseband N719KEUCOA1
Kernel 3.0.31
Adb 1.0.32

Please let me know anything I can do for the troubleshooting.

Cheers.
Song

Avatar

February 26, 2016 09:07

Fidesmo Administrator

Hi Song,

Thank you for your testing. The command I sent can only validate the communication with the phone, and the app will crash if the card is tapped after it has been sent (it is lacking several required data fields). Sorry for not mentioning this already in the post!

Now we know that your phone is reacting to commands from the computer terminal. Did you try to use it with gradle again?

Thank you for the details regarding your device, I am adding them to the issue now.

Avatar

February 27, 2016 10:25

Song XU

Dear all,

Step 1) Run gradlew installToLocalCard -P fidesmo.adb_reader
The phone screen says: Run ‘deleteFromLocalCard’ task. 10 seconds later, it displays “successful”.

Step 2) When running installToLocalCard, I saw message ‘Put back the card and hold on’. So I remove the card and put it back again since I didn’t see any changes from phone. Then the phone beep endlessly. I assume there operation is interrupted by my operation.

Step 3) Retry but fail. Warning is:

  • Exception is:
    org.gradle.api.tasks.TaskExecutionException: Execution failed for task ‘:deleteFromLocalCard’.

Song

Avatar

February 27, 2016 10:25

Song XU

Dear all,

Step 1) Run gradlew installToLocalCard -P fidesmo.adb_reader
The phone screen says: Run ‘deleteFromLocalCard’ task. 10 seconds later, it displays “successful”.

Step 2) When running installToLocalCard, I saw message ‘Put back the card and hold on’. So I remove the card and put it back again since I didn’t see any changes from phone. Then the phone beep endlessly. I assume there operation is interrupted by my operation.

Step 3) Retry but fail. Warning is:

  • Exception is:
    org.gradle.api.tasks.TaskExecutionException: Execution failed for task ‘:deleteFromLocalCard’.

Song

Avatar

March 02, 2016 09:00

NFCtester

Dear Song,

Let’s verify that there is nothing wrong with your card:

Can you please do the following:
- Open the Fidesmo app on your phone. Make sure that ‘Developer Mode’ is enabled in ‘Settings’
- Select app “Fidesmo’s Testing Tools”
- Tap card, and from the list of services choose “Test service using transceive API
- Follow the instructions on the screen

Was it successful?

Regards,
/Miguel

Avatar

March 02, 2016 17:51

Song XU

Dear Miguel,
After I tap Fidesmo card, there is no reaction except for endless beep for Test service using transceive API. I think the interruption of previous operation brings my card damaged. For another test without activating Fidesmo app: Tap a public traffic card, phone beep once; tap my Fidesmo card, phone keeps beep endlessly.

Song

Avatar

March 04, 2016 09:06

NFCtester

Dear Song,

Please write an email to support@fidesmo.com with your address and we will replace your Fidesmo card.
We are deprecating the gradle plugin combination with “Card reader mode” on an Android phone, because we think that phones are not reliable enough as contactless readers for this usage.

Regards,
/Miguel

Avatar

March 04, 2016 10:51

Song XU

Dear Miguel,

Thank you for offering me a replacement card. Do you need the problem card for further analysis? If so, I can send it back.

For the gradle plugin’s ‘card reader mode on a phone’, I really hope the feature could be continued.
1) The feature is actually the first reason to attract me, as a developer without contactless card reader, to purchase and test a Fidesmo card.

2) I believe the convenience the feature brings to developers would have great influence in developer communities, especially for mobile app developers who normally don’t equip with contactless card reader.

3) Contactless brings difficulties for reliable apdu communications, physical difference from varied mobile phones makes compatibility test work huge. But I believe changing timeout, TCP-like retransmission and maybe user-interface with phone LED indication could improve reliability for reader mode via phone.

Let me know if there’re anything I can do to help you on testing or coding, just don’t want to see such a great feature deprecated. :)

Have a nice weekend.

Song

Reply to thread