如何包括海绵城堡JAR中的Andr​​oid? [英] How to include the Spongy Castle JAR in Android?

查看:272
本文介绍了如何包括海绵城堡JAR中的Andr​​oid?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

显然海绵城堡是Android的替代品使用的是完整版的充气城堡的。

Apparently Spongy Castle is the Android alternative to using a full version of Bouncy Castle.

不过,在进口罐子我得到的各种因为它依赖于不包含在Android的,主要是javax.mail,javax.activati​​on中,并javax.awt.datatransfer包解决不了错误。

However, on importing the jar I'm getting all kinds of "cannot be resolved" errors because it relies on packages not included with Android, primarily javax.mail, javax.activation, and javax.awt.datatransfer.

那么什么是解决这个问题的最好方法是什么?回应<一个href="http://stackoverflow.com/questions/6326261/android-can-not-find-a-class-javax-activation-mimetypesfiletypemap-but-that-cl">this问题和<一href="http://stackoverflow.com/questions/4023837/android-javax-activation-cannot-be-resolved-after-including-java-mail-1-4-3-lib">this表明这些软件包不应该在所有的使用,这个流行的问题没有按甚至都不考虑找一个办法让AWT回来。因此,如何海绵城堡依靠它们? <一href="http://stackoverflow.com/questions/6488658/can-i-use-latest-bouncycastle-provider-on-android">People使用海绵城堡的,对吧?

So what's the best way around this? Responses to this question and this indicate those packages shouldn't be used at all, and this popular question doesn't even consider finding a way to get AWT back. So how is Spongy Castle relying on them? People are using Spongy Castle, right?

推荐答案

这些是如何将海绵城堡在一个项目中的两个非常简单的例子:

These are two very simple examples of how to include Spongy Castle in a project:

  • github.com/rtyley/spongycastle-eclipse - Eclipse
  • github.com/rtyley/toy-android-ssh-agent - Maven

由于v1.47,海绵城堡已经被分割为独立的子罐是完全反映匹配充气城堡工件(如 SC-光jdk15on.jar scpg-jdk15on.jar 等),并确保您包括的所有的要求,你在做什么的海绵城堡罐。这是很重要的

Since v1.47, Spongy Castle has been split into separate sub-jars that exactly mirror the matching Bouncy Castle artifacts (eg sc-light-jdk15on.jar, scpg-jdk15on.jar, etc), and it is important to ensure you include all the Spongy Castle jars required for what you're doing.

在依赖的全部信息可以在这里找到:

Full information on dependencies can be found at:

<一个href="http://rtyley.github.com/spongycastle/#downloads">http://rtyley.github.com/spongycastle/#downloads

目前最小的,你需要的 SC-光jdk15on.jar (基准轻质-API实现),并可能 scprov-jdk15on。罐(的 JCE 的周围的包装轻巧-API)。如果你正在使用Maven那么这一切依赖管理的东西是照顾你。

At minimum you'll need the sc-light-jdk15on.jar (the base lightweight-API implementation) and probably scprov-jdk15on.jar (the JCE wrapper around the lightweight-API). If you're using Maven then all this dependency-management stuff is taken care of for you.

您所描述的 javax.mail javax.activati​​on中等,有问题的相关性表明,你可能有选择了一个不正确的罐子(如每单​​库组件之一,而不是核心供应商一) - 为 scprov-jdk15on 罐子绝对的没有按'T 的任何这些奇怪的依赖关系,并在Android上运行得很开心。

The problematic dependencies you describe on javax.mail, javax.activation, etc, indicate that you might have chosen an incorrect jar (e.g. the every-single-library-component one, rather than the 'core provider' one) - as the scprov-jdk15on jar definitely doesn't have any of those weird dependencies, and runs happily on Android.

(声明,我是海绵城堡的维护者,但我已经有足够的其他用户的成功应用的报告呢!)

(disclaimer, I'm the maintainer of Spongy Castle, but I've had plenty of success reports from other users too!)

这篇关于如何包括海绵城堡JAR中的Andr​​oid?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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