I can't seem to get Proguard working with the RxAndroid v1.1.0 library.
我无法让Proguard使用RxAndroid v1.1.0库。
Previously I have been using v1.0.1 and this worked fine with the following rule.
以前我使用的是v1.0.1,这对下面的规则很有用。
-dontwarn rx.internal.util.unsafe.**
However after upgrading to v1.1.0 of rxAndroid and also including RxJava as it says on the Github ReadMe.txt, I get this exception whenever I use RxAndroid in my code.
但是升级到rxAndroid的v1.1.0之后,也包括了RxJava,就像Github的ReadMe上说的那样。txt,每当我在代码中使用RxAndroid时,我都会得到这个异常。
Caused by: java.lang.NoSuchFieldException: producerIndex
So I added more Proguard rules like people have said in some of the issue reports on the Github.
所以我增加了一些类似于人们在Github上的报告中提到的类似的规则。
-keep class rx.schedulers.Schedulers {
public static <methods>;
}
-keep class rx.schedulers.ImmediateScheduler {
public <methods>;
}
-keep class rx.schedulers.TestScheduler {
public <methods>;
}
-keep class rx.schedulers.Schedulers {
public static ** test();
}
-keepclassmembers class rx.internal.util.unsafe.*ArrayQueue*Field* {
long producerIndex;
long consumerIndex;
}
-keepclassmembers class rx.internal.util.unsafe.BaseLinkedQueueProducerNodeRef {
long producerNode;
long consumerNode;
}
-keepclassmembers class rx.internal.util.unsafe.BaseLinkedQueueProducerNodeRef {
rx.internal.util.atomic.LinkedQueueNode producerNode;
}
-keepclassmembers class rx.internal.util.unsafe.BaseLinkedQueueConsumerNodeRef {
rx.internal.util.atomic.LinkedQueueNode consumerNode;
}
-dontwarn rx.internal.util.unsafe.**
This does not work and I continually get the crashes when I generate the release builds. Any idea as I would like to use the latest libraries.
这不起作用,当我生成发布版本时,我不断地得到崩溃。我想使用最新的图书馆。
2 个解决方案
#1
7
I add the following code in proguard file.
我在proguard文件中添加了以下代码。
-keepclassmembers class rx.internal.util.unsafe.** {
long producerIndex;
long consumerIndex;
}
#2
0
You should try with
你应该试试,
-keep class * {
public private *;
}
# rxjava
-keep class rx.schedulers.Schedulers {
public static <methods>;
}
-keep class rx.schedulers.ImmediateScheduler {
public <methods>;
}
-keep class rx.schedulers.TestScheduler {
public <methods>;
}
-keep class rx.schedulers.Schedulers {
public static ** test();
}
-keepclassmembers class rx.internal.util.unsafe.*ArrayQueue*Field* {
long producerIndex;
long consumerIndex;
}
-keepclassmembers class rx.internal.util.unsafe.BaseLinkedQueueProducerNodeRef {
long producerNode;
long consumerNode;
}
#1
7
I add the following code in proguard file.
我在proguard文件中添加了以下代码。
-keepclassmembers class rx.internal.util.unsafe.** {
long producerIndex;
long consumerIndex;
}
#2
0
You should try with
你应该试试,
-keep class * {
public private *;
}
# rxjava
-keep class rx.schedulers.Schedulers {
public static <methods>;
}
-keep class rx.schedulers.ImmediateScheduler {
public <methods>;
}
-keep class rx.schedulers.TestScheduler {
public <methods>;
}
-keep class rx.schedulers.Schedulers {
public static ** test();
}
-keepclassmembers class rx.internal.util.unsafe.*ArrayQueue*Field* {
long producerIndex;
long consumerIndex;
}
-keepclassmembers class rx.internal.util.unsafe.BaseLinkedQueueProducerNodeRef {
long producerNode;
long consumerNode;
}