我编写了基于主机的卡仿真(HCE)应用程序,以在智能手机上进行移动支付。 我还使用nfc-tools库帮助我对手机和阅读器上的应用程序进行编码。 当我尝试在这2个设备上运行代码时,它们两者都可以连接在一起,但出现如下所示的错误:
org.nfctools.scio.TerminalHandler getAvailableTerminal
INFO: Checking terminal: ACS ACR122 0
DEBUG: org.nfctools.spi.acs.AcsDirectChannelTag - command: FF00000004D44A0100
DEBUG: org.nfctools.spi.acs.AcsDirectChannelTag - response: D54B009000
javax.smartcardio.CardException: Cannot connect using direct, connection already established using Unknown protocol 0
at sun.security.smartcardio.TerminalImpl.connect(Unknown Source)
at HCECardScanner.run(HostCardEmulationCardScanner.java:18)
at Reader.run(Reader.java:622)
at Reader$11.actionPerformed(Reader.java:565)
此外,当我在应用程序的日志中看到时,我发现我的应用程序也无法启动和运行基于主机的卡仿真服务。
06-28 14:18:30.083: I/ActivityManager(974): Start proc com.example.nfchcepayment for service com.example.nfchcepayment/.FirstApplet: pid=6068 uid=10268 gids={50268}
06-28 14:18:30.093: E/jdwp(6068): Failed sending reply to debugger: Broken pipe
06-28 14:18:30.093: D/dalvikvm(6068): Debugger has detached; object registry had 1 entries
06-28 14:18:30.103: I/dalvikvm(6068): Could not find method javacard.framework.ISOException.throwIt, referenced from method com.example.nfchcepayment.FirstApplet.processCommandApdu
两者2的错误也有关系吗?