Coder Social home page Coder Social logo

dapriett / nativescript-google-maps-sdk Goto Github PK

View Code? Open in Web Editor NEW
243.0 243.0 169.0 4.6 MB

Cross Platform Google Maps SDK for Nativescript

License: MIT License

Ruby 0.07% TypeScript 95.08% CSS 0.54% HTML 0.74% Shell 1.23% JavaScript 0.57% Vue 1.50% SCSS 0.28%
nativescript nativescript-plugin

nativescript-google-maps-sdk's People

Contributors

abhayastudios avatar alg avatar bgildson avatar christocracy avatar dapriett avatar domgaud avatar eddyverbruggen avatar felipewaku avatar fgutteridge avatar georgaberg avatar hdeshev avatar jacobdoucet avatar kefahb avatar kuvelas avatar laureckis avatar leocaseiro avatar loigor avatar mmacku avatar naderio avatar newapx avatar nickcoury avatar rajivnarayana avatar rhrn avatar rignonnoel avatar sittingfox avatar sprechen avatar twistedtamarin avatar tylerablake avatar vcooley avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

nativescript-google-maps-sdk's Issues

99% of map is grey

Was able to run the demo code to run using the android emulator, but for some reason like 99% of the map is grey and a small sliver at the bottom loads. It seems to load everything, but only a small portion of the map is visible. I've attached a screenshot. Any idea what's going on?
googlemap-issue

IOS Map Animation

Hi all,

I need to remove google maps slide animation...
I have been reading on google documentation and Apple but could not find a solution...

how can I remove the slide animation on map...

updateCamera() {
        this.ios.animateToCameraPosition(this._createCameraPosition());
    }

iOS Build Error on Telerik Platform

Getting the following error on the Telerik Platform when trying to build a project using the google maps sdk module. We removed the module and the app built ok. Do you have any idea why this might be?

Error: Cannot build project because module nativescript-google-maps-sdk contains insecure code. Remove the module and try again.

google play services issue w/ other plugins

It looks like this plugin currently conflicts w/ the following two plugins due to the google play services version referenced. Both plugins below are currently referencign 8.4.0.
Push Plugin: https://github.com/NativeScript/push-plugin
Google Analytics Plugin: https://github.com/sitefinitysteve/nativescript-googleanalytics

Can this be specifically set in this plugin to the following so it also uses the same version as both plugins above?
dependencies {
compile 'com.google.android.gms:play-services-maps:8.4.0'
}

Crash on load without any message

Hi,

I'm struggling to make the plugin work on android API 23 on a Mac.

Steps that I've followed :
install the plugin via tns plugin add
Adding the nativescript_google_maps_api_key with a freshly generated one
Removing the android platform
Building for scratch

Still my app is crashing down directly, without any warning or anything. I don't know how to adress my issue.

Without the plugin, my app works like a charm.
Thing is that one of my coworker has exactly the same app running on linux, and the app works with its build. (works also with the phone I'm using, and his).

Thanks for your great job !

(Running on {N} angular 2.0.0, both of us)

using the sdk with angular 2

Hi, I managed to use the plugin with angular2 but I am not able to add the event listeners on the map tag

(markerSelect)="onMarkerSelect"
(cameraChanged)="onCameraChanged"

I added brackets because thats how it should be in angular (I also tried without) but the functions do not seem to be called.

Anyone has any idea?

Thanks

Got the following error. What should I do?

Error building project with google maps plugin

Hi,

I successfully built a sample app with a previous version of your plugin, however with the new version of the plugin i get build errors as shown below. I see now you have removed the dependancy on the old nativescript-plugin-google-play-services plugin.

A problem occurred configuring root project 'games'.

Could not resolve all dependencies for configuration ':_nativescript-google-maps-sdkDebugCompile'.
Could not find any matches for com.google.android.gms:play-services-maps:+ as no versions of com.google.android.gms:play-services-maps are available.
Searched in the following locations:
https://jcenter.bintray.com/com/google/android/gms/play-services-maps/maven-metadata.xml
https://jcenter.bintray.com/com/google/android/gms/play-services-maps/
file:/Users/osx/Development/nativescript/gmaps/platforms/android/libs/aar/
file:/Volumes/UserData/usr/local/opt/android-sdk/extras/android/m2repository/com/google/android/gms/play-services-maps/maven-metadata.xml
file:/Volumes/UserData/usr/local/opt/android-sdk/extras/android/m2repository/com/google/android/gms/play-services-maps/
Required by:
:gmaps:unspecified

I do have google play installed at the following location:
/Volumes/UserData/usr/local/opt/android-sdk/extras/google/google_play_services/libproject/google-play-services_lib/libs/

I am new to android and gradle builds. I thought that since you had the dependency in your include.grade file that the gradle build would take care of including the google map dependency.

I know previous to the gradle integration that you had to use a library add to add the google play jar file. Am i missing something here?

dependencies {
compile 'com.google.android.gms:play-services-maps:+’
}

Also did you have any plans on adding the my location option to your plugin?

Many thanks for a great plugin.

Peter

Crash on load (NS CLI 1.6.1)

This is the first time I'll be using the plugin but I can't seem to make it work. I downloaded and run the demo and this error I get immediately when the app starts in the emulator (I am using Genymotion).

com.tns.NativeScriptException:
Calling js method onCreateView failed

TypeError: Cannot read property 'android' of undefined
File: "/data/data/com.myapp.myapp/files/app/tns_modules/nativescript-google-maps-sdk/map-view.js, line: 31, column: 38

StackTrace:
Frame: function:'MapView._createCameraPosition', file:'/data/data/com.myapp.myapp/files/app/tns_modules/nativescript-google-maps-sdk/map-view.js', line: 31, column: 39
Frame: function:'MapView._createUI', file:'/data/data/com.myapp.myapp/files/app/tns_modules/nativescript-google-maps-sdk/map-view.js', line: 120, column: 35
Frame: function:'View._onContextChanged', file:'/data/data/com.myapp.myapp/files/app/tns_modules/ui/core/view.js', line: 206, column: 14
Frame: function:'View._onAttached', file:'/data/data/com.myapp.myapp/files/app/tns_modules/ui/core/view.js', line: 164, column: 14
Frame: function:'eachChild', file:'/data/data/com.myapp.myapp/files/app/tns_modules/ui/core/view.js', line

Couldn't launch the app on Ios

When am trying to deploy for ios i got the this error
///app/tns_modules/nativescript-google-maps-sdk/map-view.js:86:60: JS ERROR ReferenceError: Can't find variable: GMSMapViewDelegate

But works in android.

Places autocompletion

Is it possible to add auto-completion to addresses entered in a text field or search bar like in apps such as Uber, etc? If yes, can you please show an example of how to implement it?

Thanks!

adding functionality for OnDraggingMarker

Hi all,

I just add to my app the OnMarkerDragListener for android, it could be nice to add to your plugin

this is what I did for android

gMap.setOnMarkerDragListener(new com.google.android.gms.maps.GoogleMap.OnMarkerDragListener({
    onMarkerDrag: function(gmsMarker) {
      return this;
    },
    onMarkerDragEnd: function(gmsMarker) {
      callback(gmsMarker);
      return this;
    },
    onMarkerDragStart: function(gmsMarker) {
      return this;
    }
  }));

Now the thing is that I also want to implement this listener to IOS but I could figure out how to do that, I have been read and found how to make the instance of GMSMapViewDelegate:

  var MyMapViewDelegate = NSObject.extend({
    didEndDraggingMarker: function(map, marker, event) {
      console.log("did drag marker with event");
    }
  }, {
    protocols: [GMSMapViewDelegate]
  });

  var mapViewDelegate = MyMapViewDelegate.alloc().init();
  gMap.delegate = mapViewDelegate;

The listener is not working with this code, could you give a hand with this. Also once listener for IOS is working we could add to the list of support events such as markerSelect or cameraChanged

Crash

Hi,
I use your plugin with Nativescript 1.5.2. In debug mode are excelent but when I build my release version the app crashes.

Blank/White map view on iOS 8.2 and 9.3.2

Hi,

I keep getting completely white map view in my project. Tested on iPhone 5S (8.2) and iPhone 6S(9.3.2).The app works like a charm on Android devices - the map is displayed properly.

I'm using:

  • {N} 2.1.1 version
  • {N} core-modules 2.1.4 version
  • Pods version 1.0.1
  • MapReady event is fired properly

I have Google project with enabled Google Maps SDK for iOS with proper API Key.
No javascript or native exceptions are thrown...just white map view (all other components around it are properly working - buttons, tab view, labels e.g).

Any suggestions?
Thanks

Can't find variable: GMSServices

Hi dapriett! Thanks so much for putting this repo together! I was trying to follow along with your directions and when launching the my app on the ios emulator I get the following error:

file:///app/app.js:4:14: JS ERROR ReferenceError: Can't find variable: GMSServices

I have posted my code (modulo node_packages/, platforms/) over here. If you had any advice on this error I would be very appreciative! Thanks again.

Updating observables in the mapReady handler

Hi @dapriett,

first, I'm glad that such a module exist for nativescript :)

I wanted to notice that there is some strange behavior regarding observables in the mapReady handler:

var test = new Observable({test: 1});

function OnMapReady(args) {
   var mapView = args.object;
   var gMap = mapView.gMap;

   test.set('test', 2);
}

//View: test=1

So when I try to change the value of the test observable (which is bound to a view) the value in the view stays unchanged.
Changing the value outside the mapReady handler behaves as expected:

var test = new Observable({test: 1});
test.set('test', 2);

function OnMapReady(args) {
   var mapView = args.object;
   var gMap = mapView.gMap;

}

// View: test=2

Is there a meaningful explanation for this behavior?

is fitBounds available ?

I have been trying to fit multiple markers without any luck.

It seems that fitBounds is available in iOS thru GMSCameraUpdate fitBounds, but I can not make it work, do you have any insight ?

animateWithCameraUpdate crashes the instance as: unrecognized selector sent to instance.

Thanks,

Typo - get longitude method.

Before anything else, thanks for stepping up and getting this done for the community.

There is a typo in "map-view.ios.js" at line #185

return this._ios.latitude; should be return this._ios.longitude;

Same issue on "map-view.android.js" at line #250

return this._android.latitude; should be return this._android.longitude;

Map not showing after upgrading to {N} 1.5.0

The map isn't showing up in my application since upgrading to {N} 1.5.0. The map view has the Google logo on the bottom left, but it's otherwise blank. I tried removing and re-adding the plugin, but that didn't work either.

The API key is specified in the proper file according to the instructions, so that's definitely not the issue.

Get coordinates from tap

I am trying to add a marker if the user long pressed at the map. In the source code I found the coordinateTappedEvent, how can I use it?
My try with:

public onMapReady(args) {
      this.map = args.object;
      this.map.on(MapsModule.MapView.coordinateTappedEvent, (eventData) => {
        console.log(eventData);
      });
}

failed. The callback is never called. If it isn't implemented yet, can I get the coordinates from the View-Tap Event?

Thanks for your help!

addTileOverlay and TileOptions

Hi,

We trying to use custom tile overlay provider with your sdk but we can't find any solution, can you can this feature?

Android marker icon

Hi, when i try add icon to marker i get following error:

TypeError: Cannot read property 'android' of null File: "/data/data/app.test.test/files/app/tns_modules/nativescript-google-maps-sdk/map-view.js, line: 311, column: 115

I have images placed right in AppResource file (in xml element Image is normal showed).

The demo app crashed on start

Followed the instruction to build the demo for Android (tied on both emulator and real android device). Did installed both "Google Repository" and "Google Play services" from SDK Manager, and was able to build.

BUILD SUCCESSFUL

Total time: 39.671 secs
Project successfully built
Transferring project files...

However, got error "Unfortunately, googlemapdemo2 has stopped."

So check the log

/>adb logcat

--------- beginning of /dev/log/main
D/dalvikvm(  740): GC_FOR_ALLOC freed 1750K, 36% free 8104K/12496K, paused 9ms, total 9ms
D/dalvikvm(  740): GC_FOR_ALLOC freed 379K, 32% free 8585K/12496K, paused 15ms, total 15ms
--------- beginning of /dev/log/system
W/ActivityManager(  740): Activity pause timeout for ActivityRecord{529e4878 u0 org.nativescript.googlemapdemo2/com.tns.NativeScriptActivity t47 f}
W/EGL_xap (  966): eglSurfaceAttrib not implemented
E/WindowManager(  740): Starting window AppWindowToken{52c0a9b4 token=Token{529e4928 ActivityRecord{529e4878 u0 org.nativescript.googlemapdemo2/com.tns.NativeScriptActivity t47}}} timed out
W/ActivityManager(  740): Activity destroy timeout for ActivityRecord{529e4878 u0 org.nativescript.googlemapdemo2/com.tns.NativeScriptActivity t47 f}

/>tns info

All NativeScript components versions information
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ Component        β”‚ Current version β”‚ Latest version β”‚ Information   β”‚
β”‚ nativescript     β”‚ 2.0.1           β”‚ 2.0.1          β”‚ Up to date    β”‚
β”‚ tns-core-modules β”‚ 2.0.1           β”‚ 2.0.1          β”‚ Up to date    β”‚
β”‚ tns-android      β”‚ 2.0.0           β”‚ 2.0.0          β”‚ Up to date    β”‚
β”‚ tns-ios          β”‚                 β”‚ 2.0.1          β”‚ Not installed β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

package.json

{
    "description": "NativeScript Application",
    "license": "SEE LICENSE IN <your-license-filename>",
    "readme": "NativeScript Application",
    "repository": "<fill-your-repository-here>",
    "nativescript": {
        "id": "org.nativescript.googlemapdemo2",
        "tns-android": {
            "version": "2.0.0"
        }
    },
    "dependencies": {
        "nativescript-google-maps-sdk": "^1.3.1",
        "tns-core-modules": "2.0.1"
    },
    "devDependencies": {
        "babel-traverse": "6.9.0",
        "babel-types": "6.10.0",
        "babylon": "6.8.1",
        "filewalker": "0.1.2",
        "lazy": "1.0.11"
    }
}

Any idea?

Cluster Feature

Do you have any plans to include clustering? There are official ways provided for android and iOS. I would love to see clustering feature here

addMarker won't work with @Input values for Angular on Android only

Hi @dapriett, thank you so much for this awesome module.

I'm using this module in my app and work perfectly on ios.

If I set static values for latitude and longitude(such your example), my marker works great.

However, If I set the latitude and longitude with @Input, the map shows in the correct position, but the function addMarker won't show any icon/image.

The weirdest thing is that I don't have any bug. It shows all directions and values on console.dump, but I can't see the marker...

Am I the only one with this issue?

PS: The issue is on Android only and with @Input values

@Component({
    selector: "my-map",
    template: `
<GridLayout rows="auto,*">
    <Button text="Add Marker" (tap)="addMarker($event)"></Button>
    <MapView row="1" (mapReady)="onMapReady($event)"
        [latitude]="latitude" [longitude]="longitude"
        [zoom]="zoom" [bearing]="bearing"
        [tilt]="tilt" [padding]="padding"
    ></MapView>
</GridLayout>
    `,
})
export class MyMap {
    @Input() latitude: any;  //works for the map only
    @Input() longitude: any; //works for the map only
    // latitude: number = -33.86; //works fine
    // longitude: number =  151.20;  //works fine

    zoom: number = 8;
    bearing: number = 0;
    tilt: number = 0;
    padding: Array<number> = [40, 40, 40, 40];

    coreMarker: any;

    @ViewChild("MapView") mapView: any;

    public addMarker(args) {
        console.log("Setting a marker...");
        console.log('latitude', this.latitude); //shows correctly
        console.log('longitude', this.longitude); //shows correctly

        var marker = new mapsModule.Marker();
        //marker.position = mapsModule.Position.positionFromLatLng(-33.86, 151.20); //works
        marker.position = mapsModule.Position.positionFromLatLng(this.latitude, this.longitude);
        marker.userData = {index: 1};
        this.mapView.addMarker(marker);
        // console.dump(marker); //shows correctly
    }

    public onMapReady(args) {
        console.log("onMapReady");

        this.mapView = args.object; // I've tried using nativeElement, same issue
    }

Component <my-map> usage:

<my-map [latitude]="address.latitude" [longitude]="address.longitude"></my-map>

PS: Other functions such as addCircle and addPolyline have the same issue.

Publish .d.ts with npm

Hi @dapriett, thank you for this amazing plugin.

I was wondering if you could publish the declaration .d.ts combined with the package?

That would be nice for IntelliSense in my IDE.

Thanks.

Unable to build

I use your default instruction.
screenshot-web facebook com 2016-03-26 04-00-58
I was wondering why this happen

Conflicts with firebase

Hi. I have been using the maps plugin and it works great. However we now have a requirement to use firebase. This plugin seems to be conflicting with firebase with the error below

Execution failed for task ':processF0F1F2F3DebugGoogleServices'.

Please fix the version conflict either by updating the version of the google-services plugin (information about the latest version is available at https://bintray.com/android/andr
oid-tools/com.google.gms.google-services/) or updating the version of com.google.android.gms to 9.0.0.

The firebase plugin we used is here - https://github.com/EddyVerbruggen/nativescript-plugin-firebase

Any help appreciated

Permission ACCESS_FINE_LOCATION for 6.0 android devices

Hi, I got an issue while trying to enable the setMyLocationEnabled on gMap.
I had to add : in android manifest but I still got the error.
To solve it, I had to activate the permission in the setting manually .
I saw a workaround in nativescript-mapbox, so i tried without success to implement the permission asker piece of code. This look like this :

    private _fineLocationPermissionGranted = function () {
        console.log("In _fineLocationPermissionGranted");
        var hasPermission = android.os.Build.VERSION.SDK_INT < 23; // Android M. (6.0)
        if (!hasPermission) {
            hasPermission = android.content.pm.PackageManager.PERMISSION_GRANTED ==
                android.support.v4.content.ContextCompat.checkSelfPermission(application.android.foregroundActivity, android.Manifest.permission.ACCESS_FINE_LOCATION);
        }
        return hasPermission;
    };

    hasFineLocationPermission = function () {
        console.log("In hasFineLocationPermission");
        var fineLocationPermissionGranted = this._fineLocationPermissionGranted();
        return new Promise(function (resolve) {
            resolve(fineLocationPermissionGranted);
        });
    };

    requestFineLocationPermission = function () {
        console.log("In requestFineLocationPermission");
        var fineLocationPermissionGranted = this._fineLocationPermissionGranted();
        return new Promise(function (resolve) {
            console.log("In requestFineLocationPermission 2");
            if (!fineLocationPermissionGranted) {
                console.log("In requestFineLocationPermission 3");
                // in a future version we could hook up the callback and change this flow a bit
                android.support.v4.app.ActivityCompat.requestPermissions(
                    application.android.foregroundActivity,
                    [android.Manifest.permission.ACCESS_FINE_LOCATION],
                    111);
                // this is not the nicest solution as the user needs to initiate scanning again after granting permission,
                // so enhance this in a future version, but it's ok for now
                console.log("In requestFineLocationPermission 4");
                resolve();
            }
        });
    };

I tried to call requestFineLocationPermission but It never worked.
Any clue on how to make the app ask for the permission?

Compass

How can I retrieve current location and change compass status...

dynamically add markers

Cant add markers dinamically.
For example when i tap on a listitem to get a marker with the location of the taped item.

How to bind data to the map in the code behind?

Hi @dapriett - Sorry to keep bugging you! I was wondering how one binds data to the map in the xml:

<maps:mapView id="theMap" latitude = "{{ latitude }}" longitude = "{{ longitude }} zoom = "{{ zoom }}" mapReady="OnMapReady" /> 

from the code behind? I've tried setting the bindingContext of gMap with no luck. Any suggestions?

zooming on ios?

Great job on this plugin. I am having trouble figuring out how to zoom in ios?

I can get the map and markers to come up in the emulator and on my devices, just can't seem to figure out how to get the map to zoom in on a certain spot. I've tried gMap.animatetozoom(n) and a couple of other things but can't seem to figure out the syntax. Is there a sample somewhere I haven't found for this? Any help would be greatly appreciated.

Zooming in on Android

Hey,

How can we zoom in on a map instance on Android? I tried this but it didn't work:

var cuf = new com.google.android.gms.maps.CameraUpdateFactory();
gMap.animateCamera(cuf.zoomTo(14),1000,null);

Overlay elements (image/view) on map

Can we overlay an image (e.g., a location marker fixed at the center) or a view (e.g., text field or search bar) on top of the map?

I tried something like this, but the elements within the <maps:mapView> tags didn't show at all:

<maps:mapView id="map" latitude="12.85" longitude="77.66" mapReady="onMapReady">
    <SearchBar hint="Enter an address..." id="search" keyboardType="text" />
</maps:mapView>

Unable to find variable GMSServices

I've run tns plugin add nativescript-google-maps-sdk. When I try to run the conditional to initialize the API key on iOS, the compiler reports that it cannot find the variable GMSServices. Any ideas how to fix it?

marker with custom icon

I can add markers dynamically, but I can't change the marker icon. Marker example for iOS on Google docs is like that :

CLLocationCoordinate2D position = CLLocationCoordinate2DMake(51.5, -0.127); GMSMarker *london = [GMSMarker markerWithPosition:position]; london.title = @"London"; london.icon = [UIImage imageNamed:@"house"]; london.map = mapView;

How can I add UIImage in nativescript?

EDIT: Just realized there is an example for this in the demo code.

Initial long and lat getting set incorrectly + only a single marker being added on android

Really great plugin! It's been working wonderfully on iOS.

Having some probs on my end for Android. I'm on a SAMSUNG-SGH-I337 / 4.4.2

The initial lat and long in:

is getting set incorrectly. When lat and long are in the pacific northwest it's getting set to somewhere in Africa.

in the onMapReady function I'm iterating through an array. Only the first marker is getting set (and incorrectly), this is being set somewhere in the Atlantic ocean.

vm.onMapReady = function(args) {
var mapView = args.object;
var singleReview = ReviewClassIndex();
var reviews = null;
if(singleReview) {reviews = singleReview;}
else {reviews = ReviewClass();}

    for (var e in reviews) {

        var lat = reviews[e].lat;
        var long = reviews[e].long;

        console.dump([lat, long]);

        var marker = new mapsModule.Marker();
        marker.position = mapsModule.Position.positionFromLatLng(lat, long);
        marker.title = reviews[e].name;
        marker.snippet = reviews[e].desc + ' ' + reviews[e].rate + '/5';
        marker.userData = { index : e + 1};
        marker.review = reviews[e];
        mapView.addMarker(marker);
    }
}

Is this some type of creds issue?

"Cannot read property 'android' of undefined"

Calling js method onCreateView failed
TypeError: "Cannot read property 'android' of undefined"
File: "/data/data/org.nativescript.AppName.files.app.tns_modules/nativescript-google-maps-sdk/map-view.js". line: 32, colomn: 39

Android build fails when adding the plugin

Hi,

Build on Android fails on my side after I add the plugin. Here are steps to reproduce:

  1. Checkout sampleGroceries app: git clone [email protected]:NativeScript/sample-Groceries.git
  2. Checkout "start" branch: git checkout start
  3. Add android platform: tns platform add android
  4. Add the plugin: tns plugin add nativescript-google-maps-sdk
  5. Build: tns build android

Here is the error:

WARNING: The file: /Users/ickata/Desktop/Tables/tns/sample-Groceries/node_modules/nativescript-google-maps-sdk/platforms/android/AndroidManifest.xml is depricated, you can read more about what will be the expected plugin structure here: https://www.nativescript.org/blog/migrating-n-android-plugins-from-version-1.7-to-2.0
WARNING: The file: /Users/ickata/Desktop/Tables/tns/sample-Groceries/node_modules/nativescript-google-maps-sdk/platforms/android/res/values/nativescript_google_maps_api.xml is depricated, you can read more about what will be the expected plugin structure here: https://www.nativescript.org/blog/migrating-n-android-plugins-from-version-1.7-to-2.0

:config phase:  createDefaultIncludeFiles
    +found plugins: nativescript-google-maps-sdk
Renaming plugin directory to flavor name: /Users/ickata/Desktop/Tables/tns/sample-Groceries/platforms/android/src/nativescript-google-maps-sdk -> /Users/ickata/Desktop/Tables/tns/sample-Groceries/platforms/android/src/F0
    +found plugins: tns-core-modules-widgets
Renaming plugin directory to flavor name: /Users/ickata/Desktop/Tables/tns/sample-Groceries/platforms/android/src/tns-core-modules-widgets -> /Users/ickata/Desktop/Tables/tns/sample-Groceries/platforms/android/src/F1

:config phase:  createPluginsConfigFile
     Creating product flavors include.gradle file in /Users/ickata/Desktop/Tables/tns/sample-Groceries/platforms/android/configurations folder...

:config phase:  pluginExtend
    +applying configuration from: /Users/ickata/Desktop/Tables/tns/sample-Groceries/platforms/android/configurations/include.gradle
    +applying configuration from: /Users/ickata/Desktop/Tables/tns/sample-Groceries/platforms/android/configurations/nativescript-google-maps-sdk/include.gradle
    +applying configuration from: /Users/ickata/Desktop/Tables/tns/sample-Groceries/platforms/android/configurations/tns-core-modules-widgets/include.gradle

:config phase:  copyAarDependencies

:config phase:  addAarDependencies
    +adding dependency: /Users/ickata/Desktop/Tables/tns/sample-Groceries/platforms/android/libs/aar/widgets-release.aar

FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring root project 'sampleGroceries'.
> Could not resolve all dependencies for configuration ':_F0F1DebugCompile'.
   > Could not find any matches for com.google.android.gms:play-services-maps:+ as no versions of com.google.android.gms:play-services-maps are available.
     Searched in the following locations:
         https://jcenter.bintray.com/com/google/android/gms/play-services-maps/maven-metadata.xml
         https://jcenter.bintray.com/com/google/android/gms/play-services-maps/
         file:/Users/ickata/Desktop/Tables/tns/sample-Groceries/platforms/android/libs/aar/
         file:/usr/local/opt/android-sdk/extras/android/m2repository/com/google/android/gms/play-services-maps/maven-metadata.xml
         file:/usr/local/opt/android-sdk/extras/android/m2repository/com/google/android/gms/play-services-maps/
     Required by:
         :sampleGroceries:unspecified

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED

Total time: 8.026 secs
Command /Users/ickata/Desktop/Tables/tns/sample-Groceries/platforms/android/gradlew failed with exit code 1
# build android
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ Usage   β”‚ Synopsis                                                                                                                                                                                 β”‚
β”‚ General β”‚ $ tns build android [--compileSdk <API Level>] [--key-store-path <File Path> --key-store-password <Password> --key-store-alias <Name> --key-store-alias-password <Password>] [--release] β”‚
β”‚         β”‚ [--static-bindings] [--copy-to <File Path>]                                                                                                                                              β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Builds the project for Android and produces an APK that you can manually deploy on device or in the native emulator.

### Options

    * --compileSdk - Sets the Android SDK that will be used to build the project.
    * --release - If set, produces a release build. Otherwise, produces a debug build. When set, you must also specify the --key-store-* options.
    * --key-store-path - Specifies the file path to the keystore file (P12) which you want to use to code sign your APK. You can use the --key-store-* options along with --release to produce a signed release build. You need to specify all --key-store-* options.
    * --key-store-password - Provides the password for the keystore file specified with --key-store-path. You can use the --key-store-* options along with --release to produce a signed release build. You need to specify all --key-store-* options.
    * --key-store-alias - Provides the alias for the keystore file specified with --key-store-path. You can use the --key-store-* options along with --release to produce a signed release build. You need to specify all --key-store-* options.
    * --key-store-alias-password - Provides the password for the alias specified with --key-store-alias-password. You can use the --key-store-* options along with --release to produce a signed release build. You need to specify all --key-store-* options.
    * --copy-to - Specifies the file path where the built .apk will be copied. If it points to a non-existent directory, it will be created. If the specified value is directory, the original file name will be used.

### Attributes
<API Level> is a valid Android API level. For example: 22, 23.

Before adding the plugin I was able to build for android and to run the demo app in the emulator. So my setup should be fine.

Let me know if you need additional information.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.