Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error building project with google maps plugin #6

Closed
rodenp opened this issue Dec 8, 2015 · 5 comments
Closed

Error building project with google maps plugin #6

rodenp opened this issue Dec 8, 2015 · 5 comments

Comments

@rodenp
Copy link

rodenp commented Dec 8, 2015

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

@dapriett
Copy link
Owner

dapriett commented Dec 8, 2015

Looks like gradle can't find the play-services-maps Android library, which needs to be installed on your machine. Verify that you have the latest Google Play Services installed https://developer.android.com/sdk/installing/adding-packages.html

@dapriett
Copy link
Owner

dapriett commented Dec 8, 2015

For my location, you should be able to do something like this, although I haven't tested it:

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

    if(mapView.android) {
        gMap.setMyLocationEnabled(true);
    }

    if (mapView.ios) {
        gMap.myLocationEnabled(true);
    }
}

@rodenp
Copy link
Author

rodenp commented Dec 9, 2015

I had google play installed and after i added the google repository my project built successfully.
Also the my location button appeared on android after adding your code suggestion. I did have to add an extra permission to the android manifest:

Although everything builds ok and I can see the location button, there is no map shown.
Do you have any suggestions on why this might be?
I'm pretty sure the API key is correct as I have used it before.
It's difficult to debug since 1.5.1 no longer outputs the android logcat as default.

@rodenp rodenp closed this as completed Dec 9, 2015
@rodenp
Copy link
Author

rodenp commented Dec 9, 2015

It now works perfectly.
Many thanks for your help with this.
My last issue as to do with incorrect credentials to the API.

@dapriett
Copy link
Owner

dapriett commented Dec 9, 2015

Great - glad to hear it's working now. Enjoy!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants