如何使 AR Core flutter 插件正常工作?

发布于 2025-01-09 12:19:22 字数 1118 浏览 0 评论 0原文

我正在尝试在我的 flutter 应用程序中使用 AR。我正在使用包 arcore_flutter_plugin。 添加插件后,我无法运行该应用程序,并且收到此错误(在禁用空安全功能后):

e: C:\Users\LENOVO THINKPAD\OneDrive\Bureau\Hackathon\ar_test\android\src\main\kotlin\com\difrancescogianmarco\arcore_flutter_plugin\ArCoreView.kt: (245, 38): Object is not abstract and does not implement abstract member public abstract fun onActivityCreated(p0: Activity, p1: Bundle?): Unit defined in android.app.Application.ActivityLifecycleCallbacks
e: C:\Users\LENOVO THINKPAD\OneDrive\Bureau\Hackathon\ar_test\android\src\main\kotlin\com\difrancescogianmarco\arcore_flutter_plugin\ArCoreView.kt: (246, 13): 'onActivityCreated' overrides nothing

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':arcore_flutter_plugin: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 1m 57s

有人可以帮助我使其工作吗?

I'm trying to use AR in my flutter app. I'm using the package arcore_flutter_plugin.
After adding the plugin, I'm unable to run the app and I get this error (after having disabled the null safety feature) :

e: C:\Users\LENOVO THINKPAD\OneDrive\Bureau\Hackathon\ar_test\android\src\main\kotlin\com\difrancescogianmarco\arcore_flutter_plugin\ArCoreView.kt: (245, 38): Object is not abstract and does not implement abstract member public abstract fun onActivityCreated(p0: Activity, p1: Bundle?): Unit defined in android.app.Application.ActivityLifecycleCallbacks
e: C:\Users\LENOVO THINKPAD\OneDrive\Bureau\Hackathon\ar_test\android\src\main\kotlin\com\difrancescogianmarco\arcore_flutter_plugin\ArCoreView.kt: (246, 13): 'onActivityCreated' overrides nothing

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':arcore_flutter_plugin: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 1m 57s

Can someone help me make it work ?

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

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

发布评论

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

评论(2

长亭外,古道边 2025-01-16 12:19:22

这是arcore_flutter_plugin 中的错误。

导航到 ArCoreView.kt 文件:

C:\用户\联想
THINKPAD\OneDrive\Bureau\Hackathon\ar_test\android\src\main
\kotlin\com\difrancescogianmarco\arcore_flutter_plugin\ArCoreView.kt

从以下行中删除 '?': 换行

override fun onActivityCreated(activity: Activity?, savedInstanceState: Bundle?)

override fun onActivityCreated(activity: Activity, savedInstanceState: Bundle?)

This is an error in the arcore_flutter_plugin.

Navigate into the ArCoreView.kt file:

C:\Users\LENOVO
THINKPAD\OneDrive\Bureau\Hackathon\ar_test\android\src\main
\kotlin\com\difrancescogianmarco\arcore_flutter_plugin\ArCoreView.kt

Remove '?' from the following line:

override fun onActivityCreated(activity: Activity?, savedInstanceState: Bundle?)

New-line:

override fun onActivityCreated(activity: Activity, savedInstanceState: Bundle?)
薆情海 2025-01-16 12:19:22

我也发现同样的错误
flutter 项目出错
通过更改 MotionEvent 修复了哪些问题? ---> MotionEvent更改ArCoreView.kt的代码之前

这张图片显示了我所做的更改

I also found the same error,
Error in flutter project
which was fixed by changing MotionEvent? ---> MotionEventBefore changing the code of ArCoreView.kt

This the image that shows the changes I have made

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