Xamarin Android 绑定 [英] Xamarin Android Bindings

查看:26
本文介绍了Xamarin Android 绑定的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I'm trying to create bindings for the android sdk provided here https://www.nmi.com/sdks-and-apis#CDNA. The binding project builds, and I can add it into my xamarin android project but as soon as I include it I get the following error/s.

错误:com.creditcall.chipdnamobile 包不存在com.creditcall.chipdnamobile.IApplicationSelectionListener ChipDnaSample.AndroidC:\Users\mikee\Documents\GitHub\ChipDna\ChipDnaSample\ChipDnaSample.Android\obj\Debug\90\android\src\mono\com\creditcall\chipdnamobile\IApplicationSelectionListenerImplementor.java 8

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\90\android\src\mono\com\creditcall\chipdnamobile\IApplicationSelectionListenerImplementor.java 8

错误:包 com.creditcall.chipdnamobile 不存在私有原生 void n_onAvailablePinPads(com.creditcall.chipdnamobile.Parametersp0);ChipDnaSample.Android C:\Users\mikee\Documents\GitHub\ChipDna\ChipDnaSample\ChipDnaSample.Android\obj\Debug\90\android\src\mono\com\creditcall\chipdnamobile\IAvailablePinPadsListenerImplementor.java 33

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\90\android\src\mono\com\creditcall\chipdnamobile\IAvailablePinPadsListenerImplementor.java 33

仅引用不同的类就有 64 个相同性质的错误.我已将所有代码放在 GitHub 这里

There are 64 errors of the same nature just referencing different classes. I've put all the code on GitHub here

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

If I go into Obj/Release/generated/src I can find IApplicationSelectionListener so it is created some binding but it doesn't actually work. Could someone point me in the right direction about what I need to do to correct errors such as these?

谢谢

推荐答案

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

You have to change the build type of the jars. The java compile can't find it, because it's not present at compile time.

改变

  • InputJar to EmbeddedInputJar for ChipDnaMobile.jar
  • ReferenceJar 到 CardEaseXMLClient.jar 的 EmbeddedReferenceJar
  • InputJar to EmbeddedInputJar for ChipDnaMobile.jar
  • ReferenceJar to EmbeddedReferenceJar for CardEaseXMLClient.jar

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

For more info see: https://docs.microsoft.com/en-us/xamarin/android/platform/binding-java-library/binding-a-jar

重要的句子:

通常,您使用 EmbeddedJar 构建操作,以便 .JAR 自动打包到绑定库中.这是最简单的选项 - .JAR 中的 Java 字节码被转换为 Dex 字节码并嵌入(与托管可调用包装器一起)到您的 APK 中.如果要将 .JAR 与绑定库分开,可以使用 InputJar 选项;但是,您必须确保 .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.

这篇关于Xamarin Android 绑定的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆