Android:无法使用提供的参数调用以下任何功能

时间:2018-08-17 10:51:20

标签: android kotlin androidx

我刚刚将android gradle插件版本提高到com.android.tools.build:gradle:3.3.0-alpha06,但是我的项目无法编译,并出现以下错误:

None of the following functions can be called with the arguments supplied: 
public inline fun <reified W : `Worker;`> 
PeriodicWorkRequestBuilder(repeatInterval: `Duration;`, 
flexTimeInterval: `Duration;`): PeriodicWorkRequest.`Builder;` defined 
in androidx.work
public inline fun <reified W : `Worker;`> 
PeriodicWorkRequestBuilder(repeatInterval: Long, repeatIntervalTimeUnit: `TimeUnit;`): PeriodicWorkRequest.`Builder;` defined in androidx.work

代码非常简单:

override fun onCreate(savedInstanceState: Bundle?) {
    super.onCreate(savedInstanceState)
    setContentView(R.layout.activity_main)

    PeriodicWorkRequestBuilder<MyWorker>(1L, TimeUnit.HOURS)
}

class MyWorker: Worker() {
    override fun doWork(): Result {
        TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
    }
}

其中有一个示例存储库:https://github.com/martinbonnin/TestCanary6

我会错过某些东西还是Android Studio错误吗?

1 个答案:

答案 0 :(得分:1)

我也遇到过类似的问题,但就我而言,编译器错误表明它无法访问kotlinx协程库__(ツ)_ //中的类。目前,我已经还原了插件更新,并且正在使用命令行工具进行构建/安装。

编辑:我认为它已在https://issuetracker.google.com/issues/112723639

中被跟踪