The following code
package com.inthemoon.snippets.rxjava;
import io.reactivex.*;
public class HelloWorld {
public static void main(String[] args) {
Flowable.just("Hello world").subscribe(System.out::println);
}
}
causes the following compile error
Error:(9, 15) java: cannot access org.reactivestreams.Publisher class file for org.reactivestreams.Publisher not found
POM dependency is following
<dependencies>
<!-- https://mvnrepository.com/artifact/io.reactivex.rxjava2/rxjava -->
<dependency>
<groupId>io.reactivex.rxjava2</groupId>
<artifactId>rxjava</artifactId>
<version>2.0.4</version>
</dependency>
</dependencies>
Same error and simple solution - add this to your app Gradle file
implementation 'io.reactivex.rxjava2:rxjava:2.1.14'
implementation 'io.reactivex.rxjava2:rxandroid:2.0.2'
The same happened to me.I have solved it. add the dependeny follows:
<dependency>
<groupId>org.reactivestreams</groupId>
<artifactId>reactive-streams</artifactId>
<version>1.0.0</version>
</dependency>
This has been fixed since 2.0.5 by github.com/ReactiveX/RxJava/issues/5014 2.1.1, is the latest version as of this answer
Solution :
<dependency>
<groupId>io.reactivex.rxjava2</groupId>
<artifactId>rxjava</artifactId>
<version>2.1.1</version>
</dependency>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With