android-proguard-snippets icon indicating copy to clipboard operation
android-proguard-snippets copied to clipboard

unknown reference to sun.misc.Unsafe in play-services

Open Palatis opened this issue 9 years ago • 3 comments

first apologize that I'm lazy to make a pull request...

api23+ is building with OpenJDK instead of Oracle JDK, which doesn't have sun.misc.Unsafe.

adding

-dontwarn com.google.common.cache.**
-dontwarn com.google.common.primitives.UnsignedBytes$**

to proguard-google-play-services.pro fixes warning:

Warning: com.google.common.cache.Striped64: can't find referenced class sun.misc.Unsafe
Warning: com.google.common.cache.Striped64: can't find referenced class sun.misc.Unsafe
Warning: com.google.common.cache.Striped64: can't find referenced class sun.misc.Unsafe
Warning: com.google.common.cache.Striped64: can't find referenced class sun.misc.Unsafe
Warning: com.google.common.cache.Striped64: can't find referenced class sun.misc.Unsafe
Warning: com.google.common.cache.Striped64: can't find referenced class sun.misc.Unsafe
Warning: com.google.common.cache.Striped64: can't find referenced class sun.misc.Unsafe
Warning: com.google.common.cache.Striped64: can't find referenced class sun.misc.Unsafe
Warning: com.google.common.cache.Striped64$1: can't find referenced class sun.misc.Unsafe
Warning: com.google.common.cache.Striped64$1: can't find referenced class sun.misc.Unsafe
Warning: com.google.common.cache.Striped64$1: can't find referenced class sun.misc.Unsafe
Warning: com.google.common.cache.Striped64$Cell: can't find referenced class sun.misc.Unsafe
Warning: com.google.common.cache.Striped64$Cell: can't find referenced class sun.misc.Unsafe
Warning: com.google.common.cache.Striped64$Cell: can't find referenced class sun.misc.Unsafe
Warning: com.google.common.cache.Striped64$Cell: can't find referenced class sun.misc.Unsafe
Warning: com.google.common.primitives.UnsignedBytes$LexicographicalComparatorHolder$UnsafeComparator: can't find referenced class sun.misc.Unsafe
Warning: com.google.common.primitives.UnsignedBytes$LexicographicalComparatorHolder$UnsafeComparator: can't find referenced class sun.misc.Unsafe
Warning: com.google.common.primitives.UnsignedBytes$LexicographicalComparatorHolder$UnsafeComparator: can't find referenced class sun.misc.Unsafe
Warning: com.google.common.primitives.UnsignedBytes$LexicographicalComparatorHolder$UnsafeComparator: can't find referenced class sun.misc.Unsafe
Warning: com.google.common.primitives.UnsignedBytes$LexicographicalComparatorHolder$UnsafeComparator: can't find referenced class sun.misc.Unsafe
Warning: com.google.common.primitives.UnsignedBytes$LexicographicalComparatorHolder$UnsafeComparator$1: can't find referenced class sun.misc.Unsafe

which renderes "Generate signed APK" to fail.

I dunno what side-effects would this introduce, tho.

Palatis avatar Mar 25 '16 22:03 Palatis

Use this -keep class com.google.** -dontwarn com.google.**

90Sachin avatar Sep 06 '16 13:09 90Sachin

Thanks. you saved my day.

krishnameena avatar Sep 25 '16 14:09 krishnameena

No need to prevent proguarding of all Protobuf. Just remove the warning for the referenced class with this in your proguard rules: -dontwarn sun.misc.Unsafe This will help make your apk smaller while ditching the warnings

LouisCAD avatar Feb 12 '17 23:02 LouisCAD