In my application I use MessageDigest.getInstance("SHA-1")
to get SHA1, it can run successfully in android 2.3, but it can't run in android 4.0 and it will show the below exception:
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)
Who can explain this case?
From reading around googlegroups it sounds like android.security.MessageDigest
was removed in Honeycomb. Unfortunately I am yet to find evidence of this in the Android developer documentation.
Try using java.security.MessageDigest
instead.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With