尝试为background_location Flutter插件构建Android APK。由于某些原因,它给出了以下错误。应用程序在ios模拟器上运行。
插件链接:https://pub.dev/packages/background_location/example
e: /Users/my-cpu/.pub-cache/hosted/pub.dartlang.org/background_location-0.8.1/android/src/main/kotlin/com/almoullim/background_location/BackgroundLocationService.kt: (23, 1): Class 'BackgroundLocationService' is not abstract and does not implement abstract member public abstract fun onRequestPermissionsResult(p0: Int, p1: Array<(out) String!>, p2: IntArray): Boolean defined in io.flutter.plugin.common.PluginRegistry.RequestPermissionsResultListener
e: /Users/my-cpu/.pub-cache/hosted/pub.dartlang.org/background_location-0.8.1/android/src/main/kotlin/com/almoullim/background_location/BackgroundLocationService.kt: (221, 5): 'onRequestPermissionsResult' overrides nothing
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':background_location:compileReleaseKotlin'.
在BackgroundLocationService。kt替换
override fun onRequestPermissionsResult(requestCode: Int, permissions: Array?, grantResults: IntArray?): Boolean
override fun onRequestPermissionsResult(requestCode: Int, permissions: Array, grantResults: IntArray): Boolean