AR 核心在 ar_core 模块颤振中给出错误

AR core giving error in ar_core module flutter

我是 Flutter 新手。我正在使用 google 提供的 AR 核心。但是我在编译时得到这个错误:

flutter.pub-cache\hosted\pub.dartlang.org\arcore_flutter_plugin-0.0.10\android\src\main\kotlin\com\difrancescogianmarco\arcore_flutter_plugin\ArCoreView.kt: (241, 38): Object is not abstract and does not implement abstract member public abstract fun onActivityCreated(@NonNull p0: Activity, @Nullable p1: Bundle?): Unit defined in android.app.Application.ActivityLifecycleCallbacks

你可以看到我的代码here

此错误是我的版本特有的还是属性中的错误? 我还启用了 AndroidX

flutter插件有错误需要更正

转到 ArCoreView.kt Flutter 插件中的文件

\flutter.pub-cache\hosted\pub.flutter-io.cn\arcore_flutter_plugin-0.0.10\android\src\main\kotlin\com\difrancescogianmarco\arcore_flutter_plugin

删除“?”从 onActivityCreated 如下

即 替换

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

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

这解决了我的问题