Hi forum…

I am trying to access the native API of android. I’m trying to

var builder = new;

But, I get “maps is undefined” and the programs explode…
I tried to do something more simple.

declare var com:any;


And in my console I have…

JS: ------------------
JS: [object Object]
JS: undefined
JS: ------------------

I installed tns-platform-declarations to have auto completion on my typescript but gms is not there…

So I conclude that the problem is that I no have access for some reason to gms
Need I to install, configure or put in some file to have access to gms ???

Putting you in the whole context, I’m trying put get the perfect zoom to Include several marks or pins on google maps… I’m using the plugin nativescript-google-maps-sdk, and trying to implement this gist to get the perfect zoom.

I have

  • {N}-Angular project
  • CLI: (run tns --version to fetch it)
  • package.json
  "description": "NativeScript Application",
  "license": "SEE LICENSE IN <your-license-filename>",
  "readme": "NativeScript Application",
  "repository": "<fill-your-repository-here>",
  "nativescript": {
    "id": "org.nativescript.panachebistroapp",
    "tns-ios": {
      "version": "3.0.0"
    "tns-android": {
      "version": "3.0.0"
  "dependencies": {
    "@angular/animations": "~4.1.2",
    "@angular/common": "~4.1.2",
    "@angular/compiler": "~4.1.2",
    "@angular/core": "~4.1.2",
    "@angular/forms": "~4.1.2",
    "@angular/http": "~4.1.2",
    "@angular/platform-browser": "~4.1.2",
    "@angular/platform-browser-dynamic": "~4.1.2",
    "@angular/router": "~4.1.2",
    "nativescript-angular": "~3.0.0",
    "nativescript-appversion": "^1.4.1",
    "nativescript-email": "^1.4.0",
    "nativescript-geolocation": "^3.0.0",
    "nativescript-google-maps-sdk": "^2.1.1",
    "nativescript-phone": "^1.3.0",
    "nativescript-sidedrawer": "^1.0.6",
    "nativescript-social-share": "^1.3.2",
    "nativescript-theme-core": "~1.0.2",
    "ng2-translate": "^5.0.0",
    "reflect-metadata": "~0.1.8",
    "rxjs": "~5.2.0",
    "tns-core-modules": "^3.0.0",
    "zone.js": "~0.8.2"
  "devDependencies": {
    "@angular/compiler-cli": "~4.1.2",
    "@ngtools/webpack": "1.3.1",
    "babel-traverse": "6.4.5",
    "babel-types": "6.4.5",
    "babylon": "6.16.1",
    "copy-webpack-plugin": "~4.0.1",
    "extract-text-webpack-plugin": "~2.1.0",
    "lazy": "1.0.11",
    "nativescript-css-loader": "~0.26.0",
    "nativescript-dev-android-snapshot": "^0.*.*",
    "nativescript-dev-typescript": "~0.4.0",
    "nativescript-dev-webpack": "^0.5.0",
    "raw-loader": "~0.5.1",
    "resolve-url-loader": "~2.0.2",
    "tns-platform-declarations": "^3.0.1",
    "typescript": "^2.3.3",
    "webpack": "~2.5.1",
    "webpack-sources": "~0.2.3"
  "scripts": {
    "ns-bundle": "ns-bundle",
    "start-android-bundle": "npm run ns-bundle --android --start-app",
    "start-ios-bundle": "npm run ns-bundle --ios --start-app",
    "build-android-bundle": "npm run ns-bundle --android --build-app",
    "build-ios-bundle": "npm run ns-bundle --ios --build-app"


I’ll just leave this here

Pay close attention to the package name ->

And since the nativescript-google-maps-sdk references the gradle plugin, you don’t have to do it to be able to access the Google Maps API.

Also, you won’t find the google API typings in platforms declarations, you can write your own, or just go without them.


@Pete.K I feel a little ashamed. What a dump problem.

I think my problem was to get autocompletion, I feel naked or blind without it.
Now I know that I need to develop with the documentation on the other hand (or screen).

Was really kind of you to answer this.
Thanks to make community.


I’ve worked on a feature that generates typings (autocompletion support) that represents the Android classes, but due to Google API’s complexity dealing with Java classes, and the discrepancies between JavaScript (TypeScript) and Java, it doesn’t just easily. I might get to working around those limitations some day :smiley:


@dianjuar it might come sooner than you expect. I’ll let you know if there’s any progress in that direction. :smiley: