【问题标题】:Android: None of the following functions can be called with the arguments suppliedAndroid:不能使用提供的参数调用以下函数
【发布时间】:2018-08-18 17:19:03
【问题描述】:

我刚刚将 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 错误?

【问题讨论】:

    标签: android kotlin androidx


    【解决方案1】:

    我一直面临着类似的问题,但在我的情况下,编译器错误表示它无法访问 kotlinx 协程库¯_(ツ)_/¯ 中的类。现在我已经恢复了插件更新,我正在使用命令行工具构建/安装。

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-10-03
      • 2019-06-19
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多