我刚刚将 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 错误?
最佳答案
我一直面临类似的问题,但在我的例子中,编译器错误表明它无法访问 kotlinx 协程库中的类 ¯_(ツ)_/¯。现在我已经恢复了插件更新,并且正在使用命令行工具构建/安装。
编辑:我认为它已在 https://issuetracker.google.com/issues/112723639 中被追踪到
关于Android:不能使用提供的参数调用以下函数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51893782/