# Beginning RxKotlin · Introduction | Ray Wenderlich

**URL:** <https://forums.kodeco.com/t/beginning-rxkotlin-introduction-ray-wenderlich/49086>\
**Category:** 🎓 Courses & Articles\
**Created:** [September 12, 2018, 10:25am UTC](https://forums.kodeco.com/t/beginning-rxkotlin-introduction-ray-wenderlich/49086 "2018-09-12T10:25:03Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![macsimus](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/macsimus/32/109104_2.png) [@macsimus](https://forums.kodeco.com/u/macsimus)\
**Post date:** [September 12, 2018, 10:25am UTC](https://forums.kodeco.com/t/beginning-rxkotlin-introduction-ray-wenderlich/49086/1 "2018-09-12T10:25:03Z")

</div>

* * *
This is a companion discussion topic for the original entry at [https://www.raywenderlich.com/7419-beginning-rxkotlin/lessons/1](https://www.raywenderlich.com/7419-beginning-rxkotlin/lessons/1)

---

<div class="post-metadata">

**Author:** ![yutarokonda](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/yutarokonda/32/97646_2.png) [@yutarokonda](https://forums.kodeco.com/u/yutarokonda)\
**Post date:** [June 14, 2020, 7:08am UTC](https://forums.kodeco.com/t/beginning-rxkotlin-introduction-ray-wenderlich/49086/2 "2020-06-14T07:08:51Z")

</div>

Hi.

I managed to install Rx with the help of comments, but could you please update the sample code?

Do you have any plan for RxJava3?

---

<div class="post-metadata">

**Author:** ![macsimus](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/macsimus/32/109104_2.png) [@macsimus](https://forums.kodeco.com/u/macsimus)\
**Post date:** [June 15, 2020, 4:24pm UTC](https://forums.kodeco.com/t/beginning-rxkotlin-introduction-ray-wenderlich/49086/3 "2020-06-15T16:24:39Z")

</div>

Hi @yutarokonda and thanks for the question! We hope to update the course for RxJava 3 in the near-to-mid term. Are you using RxJava 2, and if so, did you run into any specific problems with the sample code? Thanks again!

---

<div class="post-metadata">

**Author:** ![yutarokonda](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/yutarokonda/32/97646_2.png) [@yutarokonda](https://forums.kodeco.com/u/yutarokonda)\
**Post date:** [June 15, 2020, 10:00pm UTC](https://forums.kodeco.com/t/beginning-rxkotlin-introduction-ray-wenderlich/49086/4 "2020-06-15T22:00:30Z")

</div>

Thank you! I’m looking forward to the update while continuing with RxJava2.

I had difficulty setting up Intellij Idea (JDK and gradle), as I only use Android Studio at work.  
Now that it’s properly set up, I can run codes from any lesson smoothly.

I have a question from lesson 6. How do you check if memory is leaked? My terminal didn’t have println outputs from the observer and the process just finished without any problem.

---

<div class="post-metadata">

**Author:** ![macsimus](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/macsimus/32/109104_2.png) [@macsimus](https://forums.kodeco.com/u/macsimus)\
**Post date:** [June 15, 2020, 11:09pm UTC](https://forums.kodeco.com/t/beginning-rxkotlin-introduction-ray-wenderlich/49086/5 "2020-06-15T23:09:44Z")

</div>

Thanks @yutarokonda! Could you paste in here the code you entered so we can try to diagnose the issue?

---

<div class="post-metadata">

**Author:** ![yutarokonda](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/yutarokonda/32/97646_2.png) [@yutarokonda](https://forums.kodeco.com/u/yutarokonda)\
**Post date:** [June 16, 2020, 11:22am UTC](https://forums.kodeco.com/t/beginning-rxkotlin-introduction-ray-wenderlich/49086/6 "2020-06-16T11:22:50Z")

</div>

I tried it now, and I see printed text. There must’ve been some mistake in my previous code. Sorry about the confusion.

About memory leakage, should Observable have either onError or onComplete event defined if you don’t use CompositeDisposable? Can you be loose about it when you use CompositeDisposable?  
I don’t see any sign of memory leaking. Is there any way of detecting it?

Below is the code I just tried (should be exactly the same from lesson 6)

```
import io.reactivex.Observable
import io.reactivex.disposables.CompositeDisposable
import io.reactivex.rxkotlin.subscribeBy

sealed class Droid: Throwable() {
    class OU812: Droid()
}

sealed class FileReadError: Throwable() {
    class FileNotFound: FileReadError()
}

fun main(args: Array<String>) {

    exampleOf("create") {

        val subscriptions = CompositeDisposable()

        val droids = Observable.create<String> {emitter ->
            emitter.onNext("R2-D2")
// emitter.onError(Droid.OU812())
            emitter.onNext("C-3PO")
            emitter.onNext("R-2SO")
        }

        val observer = droids.subscribeBy(
                onNext = { println(it)},
                onError = { println("Error, $it")},
                onComplete = { println("Completed")}
        )

// subscriptions.add(observer)
    }
}

```

---

<div class="post-metadata">

**Author:** ![macsimus](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/macsimus/32/109104_2.png) [@macsimus](https://forums.kodeco.com/u/macsimus)\
**Post date:** [June 16, 2020, 1:09pm UTC](https://forums.kodeco.com/t/beginning-rxkotlin-introduction-ray-wenderlich/49086/7 "2020-06-16T13:09:56Z")

</div>

Generally, you should dispose of subscriptions one way or another. Using `onError` and `onComplete` is independent of disposing subscriptions. `onError` is generally a good idea. `onComplete` depends on your use case.

With respect to detecting leaks, [LeakCanary](https://square.github.io/leakcanary/) is a good choice.

---

<div class="post-metadata">

**Author:** ![yutarokonda](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/yutarokonda/32/97646_2.png) [@yutarokonda](https://forums.kodeco.com/u/yutarokonda)\
**Post date:** [June 16, 2020, 10:21pm UTC](https://forums.kodeco.com/t/beginning-rxkotlin-introduction-ray-wenderlich/49086/8 "2020-06-16T22:21:04Z")

</div>

Thank you. I’ll ask you again when I get a new question.
