PhoneCallbacks Firebase :: Class 'PhoneCallbacks' 不是抽象的,也没有实现
PhoneCallbacks Firebase :: Class 'PhoneCallbacks' is not abstract and does not implement
好的,所以我从另一个开发人员那里得到了这段代码(我知道 PHP,网络开发,但我对 android 和 firebase 没有那么多经验)他给了我这段代码和一些过时的 SDK 和库,所以我更新了它们,但现在其中一个 kotlin 文件不断抛出这个错误,我不知道如何修复它,有人能帮忙吗
class PhoneCallbacks(private val listener : PhoneCallbacksListener) : PhoneAuthProvider.OnVerificationStateChangedCallbacks() {
interface PhoneCallbacksListener {
fun onVerificationCompleted(credential: PhoneAuthCredential?)
fun onVerificationFailed(exception: FirebaseException?)
fun onCodeSent(
verificationId: String?,
token: PhoneAuthProvider.ForceResendingToken?
)
}
override fun onVerificationCompleted(phoneAuthCredential: PhoneAuthCredential?) {
listener.onVerificationCompleted(phoneAuthCredential)
}
override fun onVerificationFailed(exception: FirebaseException?) {
listener.onVerificationFailed(exception)
}
override fun onCodeSent(verificationId: String?, token: PhoneAuthProvider.ForceResendingToken?) {
listener.onCodeSent(verificationId,token)
}
}
错误:
PhoneCallBacks.kt: (6, 1): Class 'PhoneCallbacks' is not abstract and does not implement abstract base class member public abstract fun onVerificationCompleted(p0: PhoneAuthCredential): Unit defined in com.google.firebase.auth.PhoneAuthProvider.OnVerificationStateChangedCallbacks
您已将 onVerificationCompleted
声明为:
override fun onVerificationCompleted(phoneAuthCredential: PhoneAuthCredential?) {
但实际的 interface 将 onVerificationCompleted
定义为非可选的,因此:
override fun onVerificationCompleted(phoneAuthCredential: PhoneAuthCredential) {
好的,所以我从另一个开发人员那里得到了这段代码(我知道 PHP,网络开发,但我对 android 和 firebase 没有那么多经验)他给了我这段代码和一些过时的 SDK 和库,所以我更新了它们,但现在其中一个 kotlin 文件不断抛出这个错误,我不知道如何修复它,有人能帮忙吗
class PhoneCallbacks(private val listener : PhoneCallbacksListener) : PhoneAuthProvider.OnVerificationStateChangedCallbacks() {
interface PhoneCallbacksListener {
fun onVerificationCompleted(credential: PhoneAuthCredential?)
fun onVerificationFailed(exception: FirebaseException?)
fun onCodeSent(
verificationId: String?,
token: PhoneAuthProvider.ForceResendingToken?
)
}
override fun onVerificationCompleted(phoneAuthCredential: PhoneAuthCredential?) {
listener.onVerificationCompleted(phoneAuthCredential)
}
override fun onVerificationFailed(exception: FirebaseException?) {
listener.onVerificationFailed(exception)
}
override fun onCodeSent(verificationId: String?, token: PhoneAuthProvider.ForceResendingToken?) {
listener.onCodeSent(verificationId,token)
}
}
错误:
PhoneCallBacks.kt: (6, 1): Class 'PhoneCallbacks' is not abstract and does not implement abstract base class member public abstract fun onVerificationCompleted(p0: PhoneAuthCredential): Unit defined in com.google.firebase.auth.PhoneAuthProvider.OnVerificationStateChangedCallbacks
您已将 onVerificationCompleted
声明为:
override fun onVerificationCompleted(phoneAuthCredential: PhoneAuthCredential?) {
但实际的 interface 将 onVerificationCompleted
定义为非可选的,因此:
override fun onVerificationCompleted(phoneAuthCredential: PhoneAuthCredential) {