I am new with Kotlin and little bit stack with intentService. Manifest shows me an error that my service doesn't contain default constructor, but inside service it looks ok and there are no errors.
下面是我的intentService:
class MyService : IntentService {
constructor(name:String?) : super(name) {
}
override fun onCreate() {
super.onCreate()
}
override fun onHandleIntent(intent: Intent?) {
}
}
I was also try another variant:
class MyService(name: String?) : IntentService(name) {
但是,当我try 运行此服务时,仍然收到错误:
java.lang.Class<com.test.test.MyService> has no zero argument constructor
有没有办法修复Kotlin中的默认构造函数?
Thanks!