Record the solution to a choppy problem in the UI updated using retrofit + rxjava.
In a demo project, you can use rxjava + javasfit to download files and update the UI. No problems have been found,
UI progress update is also very comfortable.
But in our own project, after porting the code, we found that the UI does not update the progress, but refresh it after the download is complete.
In addition, during the entire download process, the app is obviously choppy. For example, if you press the back key, you will not be able to return it.
Later I thought about it. Will it be the problem of rxjava and retrofit versions?
I checked two version numbers in my project:
//rxjava compile 'io.reactivex:rxandroid:1.1.0' compile 'io.reactivex:rxjava:1.1.5' //network compile 'com.squareup.retrofit2:retrofit:2.0.2' compile 'com.squareup.retrofit2:adapter-rxjava:2.0.2' compile 'com.squareup.okhttp3:okhttp:3.2.0' compile 'com.squareup.okhttp3:logging-interceptor:3.0.1'
Let's take a look at the two version numbers in the demo project:
//rxJava compile 'io.reactivex:rxjava:latest.release' compile 'io.reactivex:rxandroid:latest.release' //network - squareup compile 'com.squareup.retrofit2:retrofit:latest.release' compile 'com.squareup.retrofit2:adapter-rxjava:latest.release' compile 'com.squareup.okhttp3:okhttp:latest.release' compile 'com.squareup.okhttp3:logging-interceptor:latest.release'
So I changed the two version numbers of my project to the two version numbers of the demo project to solve the problem.