krschultz / android-proguard-snippets

Proguard configurations for common Android libraries

Home Page:http://www.kevinrschultz.com/blog/2014/02/15/proguard-with-gradle/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

Palatis opened this issue · 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.

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

Thanks. you saved my day.

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