Angular Nativescript角度谷歌地图-无法读取属性';地图';未定义的
尝试使用正常的nativescript google maps sdk在nativescript中加载google maps时出错,错误为“无法读取未定义的属性‘maps’”,代码基于主页提供的示例 忽略这一段,这里是stackoverflow接受更多文本的问题的地方 这是堆栈错误Angular Nativescript角度谷歌地图-无法读取属性';地图';未定义的,angular,google-maps,nativescript,Angular,Google Maps,Nativescript,尝试使用正常的nativescript google maps sdk在nativescript中加载google maps时出错,错误为“无法读取未定义的属性‘maps’”,代码基于主页提供的示例 忽略这一段,这里是stackoverflow接受更多文本的问题的地方 这是堆栈错误 System.err: An uncaught Exception occurred on "main" thread. System.err: Calling js method onCreateView fail
System.err: An uncaught Exception occurred on "main" thread.
System.err: Calling js method onCreateView failed
System.err: TypeError: Cannot read property 'maps' of undefined
System.err:
System.err: StackTrace:
System.err: push.../node_modules/nativescript-google-maps-sdk/map- view.js.MapView._createCameraPosition(file:///node_modules\nativescript-google-maps-sdk\map- view.js:239:0)
System.err: at push.../node_modules/nativescript-google-maps-sdk/map-view.js.MapView.createNativeView(file:///node_modules\nativescript-google-maps-sdk\map-view.js:68:0)
System.err: at push.../node_modules/@nativescript/core/ui/core/view-base/view-base.js.ViewBase._setupUI(file:///node_modules\@nativescript\core\ui\core\view-base\view-base.js:492:0)
System.err: at (file:///node_modules\@nativescript\core\ui\core\view-base\view-base.js:534:0)
组件Html
<GridLayout>
<MapView (mapReady)="onMapReady($event)"></MapView>
</GridLayout>
依赖关系
},
"dependencies": {
"@angular/animations": "^8.2.14",
"@angular/common": "~8.2.0",
"@angular/compiler": "~8.2.0",
"@angular/core": "~8.2.0",
"@angular/forms": "~8.2.0",
"@angular/platform-browser": "~8.2.0",
"@angular/platform-browser-dynamic": "~8.2.0",
"@angular/router": "~8.2.0",
"@nativescript/theme": "~2.2.0",
"nativescript-angular": "~8.20.0",
"nativescript-angular-cli": "^0.1.9",
"nativescript-ui-sidedrawer": "~8.0.0",
"reflect-metadata": "~0.1.12",
"rxjs": "^6.4.0",
"tns-core-modules": "~6.2.0",
"zone.js": "~0.9.1"
},
"devDependencies": {
"@angular/compiler-cli": "~8.2.0",
"@ngtools/webpack": "~8.2.0",
"@types/googlemaps": "^3.38.1",
"codelyzer": "~4.5.0",
"nativescript-dev-webpack": "~1.3.0",
"nativescript-google-maps-sdk": "2.8.1",
"node-sass": "^4.7.1",
"tslint": "~5.19.0",
"typescript": "~3.5.3"
},
为什么要安装
nativescript谷歌地图sdk
plugin作为开发人员依赖项,假设它是一个依赖项。安装插件后,请尝试干净的构建。为什么要将nativescript谷歌地图sdk
插件安装为开发人员依赖项,假设它是依赖项。安装插件后,请尝试干净的构建。
},
"dependencies": {
"@angular/animations": "^8.2.14",
"@angular/common": "~8.2.0",
"@angular/compiler": "~8.2.0",
"@angular/core": "~8.2.0",
"@angular/forms": "~8.2.0",
"@angular/platform-browser": "~8.2.0",
"@angular/platform-browser-dynamic": "~8.2.0",
"@angular/router": "~8.2.0",
"@nativescript/theme": "~2.2.0",
"nativescript-angular": "~8.20.0",
"nativescript-angular-cli": "^0.1.9",
"nativescript-ui-sidedrawer": "~8.0.0",
"reflect-metadata": "~0.1.12",
"rxjs": "^6.4.0",
"tns-core-modules": "~6.2.0",
"zone.js": "~0.9.1"
},
"devDependencies": {
"@angular/compiler-cli": "~8.2.0",
"@ngtools/webpack": "~8.2.0",
"@types/googlemaps": "^3.38.1",
"codelyzer": "~4.5.0",
"nativescript-dev-webpack": "~1.3.0",
"nativescript-google-maps-sdk": "2.8.1",
"node-sass": "^4.7.1",
"tslint": "~5.19.0",
"typescript": "~3.5.3"
},