2016-11-9 遇到的一点小问题
今天要打包结果发现提示以下错误:
app:transformClassesAndResourcesWithProguardForCeshiRelease
具体内容如下,基本一样:
Information:Gradle tasks [:app:assembleCeshiRelease]
Warning:rx.internal.util.unsafe.BaseLinkedQueueConsumerNodeRef: can't find referenced class sun.misc.Unsafe
Warning:rx.internal.util.unsafe.BaseLinkedQueueProducerNodeRef: can't find referenced class sun.misc.Unsafe
Warning:rx.internal.util.unsafe.ConcurrentCircularArrayQueue: can't find referenced class sun.misc.Unsafe
Warning:rx.internal.util.unsafe.ConcurrentSequencedCircularArrayQueue: can't find referenced class sun.misc.Unsafe
Warning:rx.internal.util.unsafe.MpmcArrayQueueConsumerField: can't find referenced class sun.misc.Unsafe
Warning:rx.internal.util.unsafe.MpmcArrayQueueProducerField: can't find referenced class sun.misc.Unsafe
Warning:rx.internal.util.unsafe.MpscLinkedQueue: can't find referenced class sun.misc.Unsafe
Warning:rx.internal.util.unsafe.SpmcArrayQueueConsumerField: can't find referenced class sun.misc.Unsafe
Warning:rx.internal.util.unsafe.SpmcArrayQueueProducerField: can't find referenced class sun.misc.Unsafe
Warning:rx.internal.util.unsafe.SpscArrayQueue: can't find referenced class sun.misc.Unsafe
Warning:rx.internal.util.unsafe.SpscUnboundedArrayQueue: can't find referenced class sun.misc.Unsafe
Warning:rx.internal.util.unsafe.UnsafeAccess: can't find referenced class sun.misc.Unsafe
Warning:there were 44 unresolved references to classes or interfaces.
Warning:Exception while processing task java.io.IOException: Please correct the above warnings first.
Error:Execution failed for task ':app:transformClassesAndResourcesWithProguardForCeshiRelease'.
> java.io.IOException: Please correct the above warnings first.
Information:BUILD FAILED
Information:Total time: 46.941 secs
Information:1 error
Information:14 warnings
Information:See complete output in console
就是提示混淆时出错,到混淆文件查找,有这句话
-keep class sun.misc. { ; }*
按网上说的把这个删掉,还是出错.后来又试了下,才发现应该是添加全.
再加上这个** -dontwarn sun.misc.****
两个都写上就没问题了,记录一下
然后是接拉卡拉的SDK第一次发现原来so文件还可以打成jar包来放,如图:
jar包日期竟然20150424,,,好久啊。
顺便吐槽一下拉卡拉的sdk真的是太不友好了,一堆drawable,colors,layout,string...
啥都有就是了,还都得放进去;功能太杂,全部堆到一个jar包里面,十几个功能,然而我们只需要用一两个;sdk的返回值也做得一般,虽然有四个返回类型,但成功方法竟然要进入两次才代表付款成功;然后就是测试环境和生成环境的jar竟然是不一样的,命名啥的都一样,但就是用不了,直接回调参数错误,也不说具体原因,为这问题找半天;还有就是demo版本用的API17,用的方法有些现在过时了。。。
不过学到个好东西,之前竟然一直没注意。之前解析json一直都是getString()但这方法如果没参数会抛出异常,用optString()则不会,还能自定义没有对应key时的返回值。