0

I am trying to use protobuf3 source code and it uses "sun.misc.Unsafe". Can you please let me know how to import the necessary package for it.Here is the sample code

zapping
  • 4,118
  • 6
  • 38
  • 56
feicheng
  • 1
  • 1
  • 2

2 Answers2

0

This class will return you an Unsafe instance on almost all existing JVM implementations including Android (both VM versions): https://github.com/noctarius/tengi/blob/master/java/tengi-core/src/main/java/com/noctarius/tengi/core/impl/UnsafeUtil.java

this answer is a copy of noctarius' answer here: In Android, how to invoke sun.misc.Unsafe methods using Java reflection?

Community
  • 1
  • 1
Jan B
  • 518
  • 1
  • 3
  • 18
0

Unfortunately sun.misc.Unsafe class not included in android standard library. But you can to use it between pre-compiled direct proxy class: https://github.com/iamironz/unsafe