1

我正在尝试使用 spongycastle 并遵循我可以获得的所有帮助来包含它,但是当应用程序执行时它在我将其添加为提供程序的代码处崩溃:

static {
    Security.addProvider(new org.spongycastle.jce.provider.BouncyCastleProvider());
}

我将 scprov-jdk15-1.46.99.3-UNOFFICIAL-ROBERTO-RELEASE.jar 作为外部 JAR 添加到我的项目中,并且 eclipse 不报告任何错误。

有任何想法吗?

堆栈跟踪:

08-11 12:41:56.653: W/ActivityThread(683): Application com.ljbrits.test4 is waiting for the debugger on port 8100...
08-11 12:41:56.723: I/System.out(683): Sending WAIT chunk
08-11 12:41:56.723: I/dalvikvm(683): Debugger is active
08-11 12:41:56.914: I/System.out(683): Debugger has connected
08-11 12:41:56.914: I/System.out(683): waiting for debugger to settle...
08-11 12:41:57.113: I/System.out(683): waiting for debugger to settle...
08-11 12:41:57.153: I/dalvikvm(683): threadid=3: reacting to signal 3
08-11 12:41:57.203: I/dalvikvm(683): Wrote stack traces to '/data/anr/traces.txt'
:
08-11 12:41:59.344: I/System.out(683): waiting for debugger to settle...
08-11 12:41:59.546: I/System.out(683): debugger has settled (1437)
08-11 12:41:59.693: I/dalvikvm(683): threadid=3: reacting to signal 3
08-11 12:41:59.824: I/dalvikvm(683): Wrote stack traces to '/data/anr/traces.txt'
08-11 12:42:00.173: I/dalvikvm(683): threadid=3: reacting to signal 3
08-11 12:42:00.183: I/dalvikvm(683): Wrote stack traces to '/data/anr/traces.txt'
08-11 12:42:00.193: D/dalvikvm(683): threadid=1: still suspended after undo (sc=1 dc=1)
08-11 12:42:00.283: E/dalvikvm(683): Could not find class 'org.spongycastle.jce.provider.BouncyCastleProvider', referenced from method com.ljbrits.test4.Test4Activity.<clinit>
08-11 12:42:00.283: W/dalvikvm(683): VFY: unable to resolve new-instance 417 (Lorg/spongycastle/jce/provider/BouncyCastleProvider;) in Lcom/ljbrits/test4/Test4Activity;
08-11 12:42:00.283: D/dalvikvm(683): VFY: replacing opcode 0x22 at 0x0000
08-11 12:42:00.363: D/dalvikvm(683): DexOpt: unable to opt direct call 0x07d8 at 0x02 in Lcom/ljbrits/test4/Test4Activity;.<clinit>
08-11 12:42:00.683: I/dalvikvm(683): threadid=3: reacting to signal 3
08-11 12:42:00.714: D/dalvikvm(683): threadid=1: still suspended after undo (sc=1 dc=1)
08-11 12:42:00.714: I/dalvikvm(683): Wrote stack traces to '/data/anr/traces.txt'
:
08-11 12:42:06.233: I/dalvikvm(683): Wrote stack traces to '/data/anr/traces.txt'
08-11 12:42:08.719: W/dalvikvm(683): Exception Ljava/lang/NoClassDefFoundError; thrown while initializing Lcom/ljbrits/test4/Test4Activity;
08-11 12:42:08.719: W/dalvikvm(683): Class init failed in newInstance call (Lcom/ljbrits/test4/Test4Activity;)
4

1 回答 1

0

此处抛出的 NoClassDefFoundError 表明 SpongyCastle 类未包含在您部署的 apk 文件中 - 尝试解压缩 apk 以检查这一点)。这可能是由一些原因引起的,请确保您进行了干净的构建(您是使用 ant 还是 eclipse 构建?),如果问题仍然存在,则可能是 proguard 问题 - ProGuard 可能会删除它认为未使用的类 - 可以你发布你的 proguard.cfg 吗?

于 2012-08-11T13:59:29.623 回答