flutter amap_base_map Android編譯報錯 'onMethodCall' overrides nothing
阿新 • • 發佈:2020-07-09
在使用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) ) }
把 ? 可選項 去掉 在重新編譯即可