任务“:location:compileDebugKotlin”执行失败

发布于 2025-01-14 23:07:57 字数 1058 浏览 4 评论 0原文

任务“:location:compileDebugKotlin”执行失败。

运行 Gradle 任务“assembleDebug”... e: /Users/apple/.pub-cache/hosted/pub.dartlang.org/location-4.3.0/android/src/main/java/com/lyokone/location/FlutterLocationService.kt: (124, 1):类“FlutterLocationService”不是抽象的,并且没有实现抽象成员 public Abstract fun onRequestPermissionsResult(p0: Int, p1: Array<(out) String!>, p2: IntArray): io.flutter.plugin.common.PluginRegistry.RequestPermissionsResultListener 中定义的布尔值 e: /Users/apple/.pub-cache/hosted/pub.dartlang.org/location-4.3.0/android/src/main/java/com/lyokone/location/FlutterLocationService.kt: (258, 5): “onRequestPermissionsResult”不覆盖任何内容

失败:构建失败并出现异常。

  • 出了什么问题: 任务“:location:compileDebugKotlin”执行失败。

编译错误。查看日志了解更多详情

  • 尝试: 使用 --stacktrace 选项运行以获取堆栈跟踪。使用 --info 或 --debug 选项运行以获得更多日志输出。使用 --scan 运行以获得完整的见解。

  • 访问 https://help.gradle.org

    获取更多帮助

4 秒内构建失败 异常:Gradle 任务 assembleDebug 失败,退出代码为 1

Execution failed for task ':location:compileDebugKotlin'.

Running Gradle task 'assembleDebug'...
e: /Users/apple/.pub-cache/hosted/pub.dartlang.org/location-4.3.0/android/src/main/java/com/lyokone/location/FlutterLocationService.kt: (124, 1): Class 'FlutterLocationService' 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/apple/.pub-cache/hosted/pub.dartlang.org/location-4.3.0/android/src/main/java/com/lyokone/location/FlutterLocationService.kt: (258, 5): 'onRequestPermissionsResult' overrides nothing

FAILURE: Build failed with an exception.

  • What went wrong:
    Execution failed for task ':location:compileDebugKotlin'.

Compilation error. See log for more details

  • Try:
    Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

  • Get more help at https://help.gradle.org

BUILD FAILED in 4s
Exception: Gradle task assembleDebug failed with exit code 1

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

苏佲洛 2025-01-21 23:07:57

请前往此位置 -> Users/apple/.pub-cache/hosted/pub.dartlang.org,剪切/移动 location-4.3.0 文件夹并将其粘贴到某处,然后运行您的应用程序,它应该可以解决问题。

Please go to this location -> Users/apple/.pub-cache/hosted/pub.dartlang.org, cut/move the location-4.3.0 folder and paste it somewhere, run your application afterwards and it should solve the problem.

瞄了个咪的 2025-01-21 23:07:57

我认为这是由于版本与包不匹配造成的。就我而言,通过将软件包版本更改为最新版本解决了这个问题。

- location: ^4.3.0
+ location: ^4.4.0

I think this is due to version mismatch with the package. In my case, it was solved by changing the package version to latest version.

- location: ^4.3.0
+ location: ^4.4.0
前事休说 2025-01-21 23:07:57

只需确保您已在 AndroidManifest 文件中添加位置权限即可。
如果没有,请在 main -> 添加这些权限AndroidManifest.xml ,

<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>

Just make sure that you have added location permissions in AndroidManifest file.
if not, add these permissions in main -> AndroidManifest.xml ,

<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
隐诗 2025-01-21 23:07:57

就我而言,我这样做了:
然后在命令行中

flutter clean && flutter pub get

,在 pubspec.yaml 内

将speech_to_text库从speech_to_text: ^5.4.0升级到
语音到文本:^5.5.0

最后,它对我有用

NB: 如果您遇到任何问题,您可以将 location: xxx 更新为 location: ^4.4.0

In my case I did this:
In command line

flutter clean && flutter pub get

then, inside pubspec.yaml

upgrade speech_to_text library from speech_to_text: ^5.4.0 to
speech_to_text: ^5.5.0

Finally, it worked for me

NB: If you encounter any problem, you may update location: x.x.x to location: ^4.4.0

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文