'AR core giving error in ar_core module flutter

I am new to flutter. I am using AR core provided by google. But I get this error at compiletime:

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

You can see my code here

is this error specific to my version or is it an error in the properties? Also I have enabled AndroidX



Solution 1:[1]

There is an error in the flutter plugin that needs to be corrected.

Go to ArCoreView.kt file in Flutter plugin at

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

remove "?" from onActivityCreated as below

i.e. Replace

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

By

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

This resolved my problem

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1