Status Update
Comments
ro...@gmail.com <ro...@gmail.com> #2
Searched through kotlin 1.3 by accident and found this:
https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-result/index.html
It seems that my problem is solved by adding
import androidx.work.Result
---
You should rename Result to WorkResult, till the fact that we have a Result (kotlin 1.3) vs Result (androidx.work ) clash here...
---
So you must do the change no 1. above, clearify that wee ned to import androidx.work.Result
- happy coding -
RG
It seems that my problem is solved by adding
import androidx.work.Result
---
You should rename Result to WorkResult, till the fact that we have a Result (kotlin 1.3) vs Result (
---
So you must do the change no 1. above, clearify that wee ned to import androidx.work.Result
- happy coding -
RG
Description
AI-183.4284.148.34.5159543, JRE 1.8.0_152-release-1248-b01x64 JetBrains s.r.o, OS Windows 10(amd64) v10.0 , screens 1600x900, 1920x1080
Android Gradle Plugin: 3.4.0-alpha07
Gradle: 5.0
NDK: from local.properties: (not specified); latest from SDK: (not found);
LLDB: pinned revision 3.1 not found; latest from SDK: (package not found);
CMake: from local.properties: (not specified); latest from SDK: (not found); from PATH: (not found);
IMPORTANT: Please read
---
android.arch.work:work-runtime:1.0.0-alpha12 breaks, (doWork's) Result is missing success() and failure() with no parameters.
Trying to follow last minute changes to WorkManager implementation, this introduced breaking changes in Result, which doWork use.
Trying to follow the transcript for doWork here:
Like this:
======
package no.rogo.projectfk303.workers
import android.content.Context
import android.os.Bundle
import android.util.Log
import androidx.work.Worker
import androidx.work.WorkerParameters
import no.rogo.projectfk303.repositories.CommonDatabaseRepository
import no.rogo.projectfk303.repositories.StationListRepository
/**
* Created by Roar on 13.11.2018.
* Copyright RoGo Software / Gronmo IT
*/
class ReadDatabaseWorker(context: Context, workerParameters: WorkerParameters): Worker(context, workerParameters)
{
private val TAG by lazy { ReadDatabaseWorker::class.java.simpleName }
override fun doWork(): Result { //<--- Failure: One type argument expected for class Result<out T>
return try {
Log.i(TAG,"doWork () !")
val bundle = Bundle()
bundle.putString("kindID","0")
StationListRepository.readStations(bundle)
CommonDatabaseRepository.readKinds()
return Result.success() // <--- Failure: No value passed for parameter 'value'
}catch (ex: Exception)
{
Log.e(TAG,"Error doWork() !!")
return Result.failure() // <---- Fauilure: No value passed for parameter 'exception'
}
}
}
===
of course I could put in 'ex' in Result.failure and 'null' in Result.success(), but I still don't know what to put behind Result...
Opportunities
1. Change documentation so it follows what we should do.
2. Fix implemention of Result.success() and Result.failure() (with no parameters) as shown in example.
In meantime I fall back to alpha11...
RG