其他分享
首页 > 其他分享> > flutter amap_base_map Android编译报错 'onMethodCall' overrides nothing

flutter amap_base_map Android编译报错 'onMethodCall' overrides nothing

作者:互联网

在使用amap_base_map做地图功能的时候,iOS的没有问题,Android编译时报错,报错内容

e: /Users/chenhao/flutter/.pub-cache/hosted/pub.flutter-io.cn/amap_base_map-0.4.4+4/android/src/main/kotlin/me/yohom/amapbasemap/map/MapHandlers.kt: (237, 1): Object 'OpenOfflineManager' is not abstract and does not implement abstract member @UiThread public abstract fun onMethodCall(@NonNull p0: MethodCall, @NonNull p1: MethodChannel.Result): Unit defined in me.yohom.amapbasemap.MapMethodHandler
e: /Users/chenhao/flutter/.pub-cache/hosted/pub.flutter-io.cn/amap_base_map-0.4.4+4/android/src/main/kotlin/me/yohom/amapbasemap/map/MapHandlers.kt: (243, 5): 'onMethodCall' overrides nothing
                                                                        
FAILURE: Build failed with an exception.                                
                                                                        
* What went wrong:                                                      
Execution failed for task ':amap_base_map:compileReleaseKotlin'.        
> 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 5s  

报错的大致内容是 在

/Users/chenhao/flutter/.pub-cache/hosted/pub.flutter-io.cn/amap_base_map-0.4.4+4/android/src/main/kotlin/me/yohom/amapbasemap/map/MapHandlers.kt: 

这个路径下MapHandlers.kt文件 中(243, 5)这个位置onMethodCall有问题,找到这个位置并定位到onMethodCall 把

 override fun onMethodCall(p0: MethodCall?, p1: MethodChannel.Result?) {
        registrar.activity().startActivity(
                Intent(AMapBaseMapPlugin.registrar.activity(),
                        OfflineMapActivity::class.java)
        )
    }

把 ? 可选项 去掉 在重新编译即可

标签:map,pub,onMethodCall,base,报错,amap,nothing,flutter
来源: https://www.cnblogs.com/qqcc1388/p/13271889.html