DeveloperLibs / flutter_google_map_route

This is a sample project of Flutter that display route on the google map. You can search destination address.
60 stars 52 forks source link

Execution failed for task ':map_view:compileDebugKotlin'. #1

Open jitenders859 opened 5 years ago

jitenders859 commented 5 years ago

getting error while flutter run

Gradle task 'assembleDebug'... e: /Users/mac/Documents/flutter/.pub-cache/hosted/pub.dartlang.org/map_view-0.0.14/android/src/main/kotlin/com/apptreesoftware/mapview/MapViewPlugin.kt: (168, 34):Only safe (?.) or non-null asserted (!!.) calls are allowed on a nullable receiver of type Map<String, Any>? e: /Users/mac/Documents/flutter/.pub-cache/hosted/pub.dartlang.org/map_view-0.0.14/android/src/main/kotlin/com/apptreesoftware/mapview/MapViewPlugin.kt: (171, 36):Only safe (?.) or non-null asserted (!!.) calls are allowed on a nullable receiver of type Map<String, Any>? e: /Users/mac/Documents/flutter/.pub-cache/hosted/pub.dartlang.org/map_view-0.0.14/android/src/main/kotlin/com/apptreesoftware/mapview/MapViewPlugin.kt: (172, 40):Only safe (?.) or non-null asserted (!!.) calls are allowed on a nullable receiver of type Map<String, Any>? e: /Users/mac/Documents/flutter/.pub-cache/hosted/pub.dartlang.org/map_view-0.0.14/android/src/main/kotlin/com/apptreesoftware/mapview/MapViewPlugin.kt: (173, 37):Only safe (?.) or non-null asserted (!!.) calls are allowed on a nullable receiver of type Map<String, Any>? e: /Users/mac/Documents/flutter/.pub-cache/hosted/pub.dartlang.org/map_view-0.0.14/android/src/main/kotlin/com/apptreesoftware/mapview/MapViewPlugin.kt: (174, 31):Only safe (?.) or non-null asserted (!!.) calls are allowed on a nullable receiver of type Map<String, Any>? e: /Users/mac/Documents/flutter/.pub-cache/hosted/pub.dartlang.org/map_view-0.0.14/android/src/main/kotlin/com/apptreesoftware/mapview/MapViewPlugin.kt: (175, 28):Only safe (?.) or non-null asserted (!!.) calls are allowed on a nullable receiver of type Map<String, Any>? e: /Users/mac/Documents/flutter/.pub-cache/hosted/pub.dartlang.org/map_view-0.0.14/android/src/main/kotlin/com/apptreesoftware/mapview/MapViewPlugin.kt: (177, 21):Only safe (?.) or non-null asserted (!!.) calls are allowed on a nullable receiver of type Map<String, Any>? e: /Users/mac/Documents/flutter/.pub-cache/hosted/pub.dartlang.org/map_view-0.0.14/android/src/main/kotlin/com/apptreesoftware/mapview/MapViewPlugin.kt: (178, 66):Only safe (?.) or non-null asserted (!!.) calls are allowed on a nullable receiver of type Map<String, Any>?

FAILURE: Build failed with an exception.

BUILD FAILED in 1m 31s

saisurvase commented 5 years ago

go to user flutter sdk path

.pub-cache/hosted/pub.dartlang.org/MapViewPlugin.kt replace this val cameraDict = mapOptions["cameraPosition"] as Map with val cameraDict = mapOptions["cameraPosition"] as Map
BhaveshPrince commented 5 years ago

same problem please give me ans.

Saddi993 commented 5 years ago

go to user flutter sdk path .pub-cache/hosted/pub.dartlang.org/MapViewPlugin.kt

replace this val cameraDict = mapOptions["cameraPosition"] as Map<String, Any> with val cameraDict = mapOptions["cameraPosition"] as Map<String, Any>

both are same lines... what are saying to replace

Saddi993 commented 5 years ago

go to user flutter sdk path .pub-cache/hosted/pub.dartlang.org/MapViewPlugin.kt

replace line no 167 to 180 with this code:

            val mapOptions = call.argument<Map<String, Any>>("mapOptions")
            val cameraDict = mapOptions!!["cameraPosition"] as Map<String, Any>
            initialCameraPosition = getCameraPosition(cameraDict)
            toolbarActions = getToolbarActions(call.argument<List<Map<String, Any>>>("actions"))
            showUserLocation = mapOptions!!["showUserLocation"] as Boolean
            showMyLocationButton = mapOptions!!["showMyLocationButton"] as Boolean
            showCompassButton = mapOptions!!["showCompassButton"] as Boolean
            hideToolbar = mapOptions!!["hideToolbar"] as Boolean
            mapTitle = mapOptions!!["title"] as String

            if (mapOptions!!["mapViewType"] != null) {
                val mappedMapType: Int? = mapTypeMapping.get(mapOptions!!["mapViewType"]);
                if (mappedMapType != null) mapViewType = mappedMapType;
            }

it works for me

dubyouth commented 4 years ago

Hi @Saddi993 I do exactly the same with your sugestion but still get this error:

Launching lib\main.dart on SM G920V in debug mode...
e: C:\flutter\.pub-cache\hosted\pub.dartlang.org\map_view-0.0.14\android\src\main\kotlin\com\apptreesoftware\mapview\MapViewPlugin - Copy.kt: (27, 7): Redeclaration: MapViewPlugin
e: C:\flutter\.pub-cache\hosted\pub.dartlang.org\map_view-0.0.14\android\src\main\kotlin\com\apptreesoftware\mapview\MapViewPlugin - Copy.kt: (168, 34): Only safe (?.) or non-null asserted (!!.) calls are allowed on a nullable receiver of type Map<String, Any>?
e: C:\flutter\.pub-cache\hosted\pub.dartlang.org\map_view-0.0.14\android\src\main\kotlin\com\apptreesoftware\mapview\MapViewPlugin - Copy.kt: (171, 36): Only safe (?.) or non-null asserted (!!.) calls are allowed on a nullable receiver of type Map<String, Any>?
e: C:\flutter\.pub-cache\hosted\pub.dartlang.org\map_view-0.0.14\android\src\main\kotlin\com\apptreesoftware\mapview\MapViewPlugin - Copy.kt: (172, 40): Only safe (?.) or non-null asserted (!!.) calls are allowed on a nullable receiver of type Map<String, Any>?
e: C:\flutter\.pub-cache\hosted\pub.dartlang.org\map_view-0.0.14\android\src\main\kotlin\com\apptreesoftware\mapview\MapViewPlugin - Copy.kt: (173, 37): Only safe (?.) or non-null asserted (!!.) calls are allowed on a nullable receiver of type Map<String, Any>?
e: C:\flutter\.pub-cache\hosted\pub.dartlang.org\map_view-0.0.14\android\src\main\kotlin\com\apptreesoftware\mapview\MapViewPlugin - Copy.kt: (174, 31): Only safe (?.) or non-null asserted (!!.) calls are allowed on a nullable receiver of type Map<String, Any>?
e: C:\flutter\.pub-cache\hosted\pub.dartlang.org\map_view-0.0.14\android\src\main\kotlin\com\apptreesoftware\mapview\MapViewPlugin - Copy.kt: (175, 28): Only safe (?.) or non-null asserted (!!.) calls are allowed on a nullable receiver of type Map<String, Any>?
e: C:\flutter\.pub-cache\hosted\pub.dartlang.org\map_view-0.0.14\android\src\main\kotlin\com\apptreesoftware\mapview\MapViewPlugin - Copy.kt: (177, 21): Only safe (?.) or non-null asserted (!!.) calls are allowed on a nullable receiver of type Map<String, Any>?
e: C:\flutter\.pub-cache\hosted\pub.dartlang.org\map_view-0.0.14\android\src\main\kotlin\com\apptreesoftware\mapview\MapViewPlugin - Copy.kt: (178, 66): Only safe (?.) or non-null asserted (!!.) calls are allowed on a nullable receiver of type Map<String, Any>?
e: C:\flutter\.pub-cache\hosted\pub.dartlang.org\map_view-0.0.14\android\src\main\kotlin\com\apptreesoftware\mapview\MapViewPlugin.kt: (27, 7): Redeclaration: MapViewPlugin

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':map_view:compileDebugKotlin'.
> 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
nikitwei commented 4 years ago

hi @Saddi993 i am facing same error and by your solution it work 👍 . but when app was installed there is nothing and only show Text 'Google Map Box' -_-