【问题标题】:Kotlin android compile error about service关于服务的 Kotlin android 编译错误
【发布时间】:2021-08-28 06:31:03
【问题描述】:

当我尝试使用 Kotlin 编写服务时

package com.personal.distribute.service

import android.app.Service
import android.content.Intent
import android.os.IBinder

class MyService : Service() {

    override fun onBind(intent: Intent): IBinder {
        return null
    }
}

我遇到了一些类似的编译错误

e: F:\FastAppStory\android\quickappsdk\src\main\java\com\psersonal\distribute\service\MyService.kt: (7, 1): 类 'MyService' 不是抽象的,也没有实现抽象基类成员 public abstract fun getBasePackageName(): String!在android.app.Service中定义

我没有找到对应的可能问题。

【问题讨论】:

  • gradle 构建版本是 4.0.1。 gradle 是 6.3。

标签: android kotlin


【解决方案1】:

这个错误的原因是一个本地库到CompileOnly覆盖了Context...导致问题

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-05-09
    • 1970-01-01
    相关资源
    最近更新 更多