"New permissions added
WARNING
Users that have the APK with version code 19 may need to accept one or more of the android.permission.READ_PHONE_STATE and android.permission.WRITE_EXTERNAL_STORAGE permissions, which may result in them not upgrading to this version of the app."
All com.android.support libraries must use the exact same version specification (mixing versions can lead to runtime crashes). Found versions 27.1.0, 27.0.2. Examples include com.android.support:animated-vector-drawable:27.1.0 and com.android.support:cardview-v7:27.0.2 less... (⌃F1)
There are some combinations of libraries, or tools and libraries, that are incompatible, or can lead to bugs. One such incompatibility is compiling with a version of the Android support libraries that is not the latest version (or in particular, a version lower than your targetSdkVersion.)
// build.gradle (project)
// ...
allprojects {
// ...
// Force all of the primary support libraries to use the same version.
configurations.all {
resolutionStrategy {
// force "com.android.support:support-annotations:${versions.supportLibrary}"
// force 'com.google.code.findbugs:jsr305:3.0.0'
eachDependency { details ->
if (details.requested.group == 'com.android.support') {
details.useVersion versions.supportLibrary
}
}
}
}
}
private CompositeDisposable compositeDisposable =
new CompositeDisposable();
@Override public void onCreate() {
compositeDisposable.add(backendApi.loadUser()
.subscribe(this::displayUser, this::handleError));
}
@Override public void onDestroy() {
compositeDisposable.clear();
}
SendChannel を使って同様にこのような。
interface JobHolder {
val job: Job
}
class MainActivity : AppCompatActivity(), JobHolder {
override val job: Job = Job()
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
addJob {
while (true) {
delay(500)
println("A")
}
}
addJob {
while (true) {
delay(1000)
println("B")
}
}
}
// Job の actor として action を登録する
private fun addJob(action: suspend () -> Unit) {
val actor = actor<Unit>(job + UI, capacity = Channel.CONFLATED) {
for (event in channel) action()
}
actor.offer(Unit)
}
override fun onDestroy() {
super.onDestroy()
job.cancel()
}
}
まとめてキャンセルできましたね!
どうせなら作って置いたらどうだろう。
class JobHolder {
private val job = Job()
fun add(action: suspend () -> Unit) {
val actor = actor<Unit>(job + UI, capacity = Channel.CONFLATED) {
for (event in channel) action()
}
actor.offer(Unit)
}
fun cancel() {
job.cancel()
}
}