java.lang.NoClassDefFoundError:android.security.MessageDigest

时间:2012-06-21 11:25:14

标签: android classnotfoundexception

在我的应用程序中,我使用MessageDigest.getInstance("SHA-1")来获取SHA1,它可以在android 2.3中成功运行,但它无法在android 4.0中运行,它将显示以下异常:

FATAL EXCEPTION: main
java.lang.NoClassDefFoundError: android.security.MessageDigest
 at com.screenshare.email.Utility.getConsistentDeviceId(Utility.java:597)
 at com.screenshare.exchange.SyncManager.getDeviceIdInternal(SyncManager.java:1079)
 at com.screenshare.exchange.SyncManager.getDeviceId(SyncManager.java:1045)
 at com.screenshare.exchange.SyncManager.onCreate(SyncManager.java:1813)
 at android.app.ActivityThread.handleCreateService(ActivityThread.java:2253)
 at android.app.ActivityThread.access$1600(ActivityThread.java:123)
 at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1201)
 at android.os.Handler.dispatchMessage(Handler.java:99)
 at android.os.Looper.loop(Looper.java:137)
 at android.app.ActivityThread.main(ActivityThread.java:4424)
 at java.lang.reflect.Method.invokeNative(Native Method)
 at java.lang.reflect.Method.invoke(Method.java:511)
 at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
 at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
 at dalvik.system.NativeStart.main(Native Method) 

谁能解释这个案子?

1 个答案:

答案 0 :(得分:9)

reading around googlegroups起,听起来像{Honey}中的android.security.MessageDigest一样。不幸的是,我还没有在Android开发者文档中找到这方面的证据。

请尝试使用java.security.MessageDigest