RxJava icon indicating copy to clipboard operation
RxJava copied to clipboard

Should I add proguard rules for RxJava2?

Open CoXier opened this issue 8 years ago • 8 comments

Thanks for using RxJava but before you post an issue, please consider the following points:

  • [x] Please include the library version number, including the minor and patch version, in the issue text. In addition, if you'd include the major version in the title (such as 2.x) that would be great.

  • [ ] If you think you found a bug, please include a code sample that reproduces the problem. Dumping a stacktrace is usually not enough for us.

  • [ ] RxJava has more than 150 operators, we recommend searching the javadoc for keywords of what you try to accomplish.

  • [ ] If you have a question/issue about a library/technology built on top of RxJava (such as Retrofit, RxNetty, etc.), please consider asking a question on StackOverflow first (then maybe on their issue list).

  • [ ] Questions like "how do I X with RxJava" are generally better suited for StackOverflow (where it may already have an answer).

  • [ ] Please avoid cross-posting questions on StackOverflow, this issue list, the Gitter room or the mailing list.

As I know there are many methods and class in RxJava2.

  • So I want to know should I add proguard rules for RxJava2 to optimize it.
  • If need, can you tell me the proguard rules? (There are only rules for 1.x when I google)

CoXier avatar Oct 11 '18 02:10 CoXier

RxJava 2.x doesn't need proguard rules

artem-zinnatullin avatar Oct 11 '18 02:10 artem-zinnatullin

Why doesn't RxJava2.x need proguard rules?

CoXier avatar Oct 11 '18 04:10 CoXier

Because it doesn't use reflection nor causes proguard warnings

artem-zinnatullin avatar Oct 11 '18 05:10 artem-zinnatullin

Thanks a lot.

CoXier avatar Oct 11 '18 06:10 CoXier

If that is true, then why am I getting the following Proguard warnings which cause my build to fail:

Warning: org.reactivestreams.FlowAdapters$FlowToReactiveProcessor: can't find superclass or interface java.util.concurrent.Flow$Processor
Warning: org.reactivestreams.FlowAdapters$FlowToReactiveSubscriber: can't find superclass or interface java.util.concurrent.Flow$Subscriber
Warning: org.reactivestreams.FlowAdapters$FlowToReactiveSubscription: can't find superclass or interface java.util.concurrent.Flow$Subscription
Warning: org.reactivestreams.FlowAdapters: can't find referenced class java.util.concurrent.Flow$Publisher
Warning: org.reactivestreams.FlowAdapters: can't find referenced class java.util.concurrent.Flow$Processor
Warning: org.reactivestreams.FlowAdapters: can't find referenced class java.util.concurrent.Flow$Subscriber
Warning: org.reactivestreams.FlowAdapters: can't find referenced class java.util.concurrent.Flow```

phileo avatar Dec 20 '19 00:12 phileo

Because the people behind reactive streams decided to ship Java 9 classes in a Java 6-compatible artifact

JakeWharton avatar Dec 20 '19 00:12 JakeWharton

So we need rules for rxjava2?

valokafor avatar Dec 20 '19 20:12 valokafor

Upgrade to RxJava 2.2.16 which already contains the rules for ignoring these specific warnings. Depending on your tooling, you may still have to add rules manually: https://github.com/ReactiveX/RxJava#r8-and-proguard-settings

akarnokd avatar Dec 20 '19 20:12 akarnokd