Xamarin Android 绑定

Xamarin Android Bindings

我正在尝试为此处 https://www.nmi.com/sdks-and-apis#CDNA 提供的 android SDK 创建绑定。绑定项目构建,我可以将它添加到我的 xamarin android 项目中,但是一旦我包含它,我就会得到以下 error/s.

error: package com.creditcall.chipdnamobile does not exist com.creditcall.chipdnamobile.IApplicationSelectionListener ChipDnaSample.Android C:\Users\mikee\Documents\GitHub\ChipDna\ChipDnaSample\ChipDnaSample.Android\obj\Debug\android\src\mono\com\creditcall\chipdnamobile\IApplicationSelectionListenerImplementor.java 8

error: package com.creditcall.chipdnamobile does not exist private native void n_onAvailablePinPads (com.creditcall.chipdnamobile.Parameters p0); ChipDnaSample.Android C:\Users\mikee\Documents\GitHub\ChipDna\ChipDnaSample\ChipDnaSample.Android\obj\Debug\android\src\mono\com\creditcall\chipdnamobile\IAvailablePinPadsListenerImplementor.java 33

有 64 个性质相同的错误只是引用不同 类。我把所有的代码都放在 GitHub here

如果我进入 Obj/Release/generated/src,我可以找到 IApplicationSelectionListener,因此它创建了一些绑定,但它实际上不起作用。有人可以指出我需要做些什么来纠正此类错误的正确方向吗?

谢谢

您必须更改 jar 的构建类型。 java 编译找不到它,因为它在编译时不存在。

改变

  • InputJarEmbeddedInputJar 对于 ChipDnaMobile.jar
  • ReferenceJarEmbeddedReferenceJar 对于 CardEaseXMLClient.jar

有关详细信息,请参阅:https://docs.microsoft.com/en-us/xamarin/android/platform/binding-java-library/binding-a-jar

重要句子:

Typically, you use the EmbeddedJar build action so that the .JAR is automatically packaged into the bindings library. This is the simplest option – Java bytecode in the .JAR is converted into Dex bytecode and is embedded (along with the Managed Callable Wrappers) into your APK. If you want to keep the .JAR separate from the bindings library, you can use the InputJar option; however, you must ensure that the .JAR file is available on the device that runs your app.