Google maps 在颤振中运行google heat map时出错
我是一名新手,我正在尝试使用这个插件在谷歌地图Google maps 在颤振中运行google heat map时出错,google-maps,flutter,dart,heatmap,Google Maps,Flutter,Dart,Heatmap,我是一名新手,我正在尝试使用这个插件在谷歌地图google\u地图\u flatter\u热图0.1.1+2中创建热图 但每次我运行代码时,都会出现此错误。我已经将APK密钥添加到清单文件中,并尝试了flatterclean,但仍然是一样的 E:\~MobileDev\flutter project\myproject\android\app\src\main\java\io\flutter\plugins\GeneratedPluginRegistrant.java:32: error: co
google\u地图\u flatter\u热图0.1.1+2中创建热图
但每次我运行代码时,都会出现此错误。我已经将APK密钥添加到清单文件中,并尝试了flatterclean
,但仍然是一样的
E:\~MobileDev\flutter project\myproject\android\app\src\main\java\io\flutter\plugins\GeneratedPluginRegistrant.java:32: error: constructor GoogleMapsPlugin in class GoogleMapsPlugin cannot be applied to given types;
flutterEngine.getPlugins().add(new io.flutter.plugins.googlemaps.GoogleMapsPlugin());
^
required: Registrar
found: no arguments
reason: actual and formal argument lists differ in length
1 error
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:compileDebugJavaWithJavac'.
> Compilation failed; see the compiler error output for details.
编辑:
我尝试删除另一个插件,它是google\u-maps\u-flatter:^0.5.30
。现在它开始工作了。这是否意味着这两个插件之间存在冲突?还有什么我可以同时使用它们吗?是的,你是对的,这两个软件包之间存在冲突,因为名称GoogleMaps
存在于两个软件包中:GoogleMaps\u flatter\u heatmap
和GoogleMaps\u flatter
如果要同时使用这两个包,则需要使用“as prefix”导入这些包以区分它们。例如:
import "package:google_maps_flutter/google_maps_flutter.dart" as gmaps;
import "package:google_maps_flutter_heatmap/google_maps_flutter_heatmap.dart" as heatmap;
然后,您可以通过在使用的前缀之一前加前缀来声明GoogleMap
。比如说,您想在google\u maps\u flatter
包中使用GoogleMap
。然后会是这样的:
gmaps.GoogleMap(
initialCameraPosition: _initialLocation,
),