question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Error getting location in NativeScript 5

See original GitHub issue

Hi,

After upgrade NativeScript to version 5, I have this error:

Cannot enable the location service. Error: java.lang.NoClassDefFoundError: Failed resolution of: Lcom/google/android/gms/internal/zzbck;

My app.gradle is:

{
  "nativescript": {
    "id": "com.autocorp.autocorpapp",
    "tns-android": {
      "version": "5.0.0"
    }
  },
  "description": "NativeScript Application",
  "license": "SEE LICENSE IN <your-license-filename>",
  "repository": "<fill-your-repository-here>",
  "dependencies": {
    "moment": "^2.22.2",
    "nativescript-crossplatform-aes": "^1.0.3",
    "nativescript-directions": "^1.3.0",
    "nativescript-dom": "^2.0.2",
    "nativescript-geolocation": "^4.3.1",
    "nativescript-google-maps-sdk": "^2.6.1",
    "nativescript-loading-screen": "^1.0.6",
    "nativescript-phone": "^1.4.0",
    "nativescript-sqlite": "^2.2.3",
    "nativescript-theme-core": "^1.0.4",
    "nativescript-xml2js": "^0.5.2",
    "tns-core-modules": "^5.0.2"
  },
  "readme": "NativeScript Application",
  "devDependencies": {
    "nativescript-dev-webpack": "^0.17.0"
  }
}

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:5
  • Comments:23 (1 by maintainers)

github_iconTop GitHub Comments

18reactions
DimitarTodorovcommented, Nov 15, 2018

Hi @neumartin , I’ve tested the plugin’s demo and found that there is no issue with it. The problem that you observe is related to dependency which both nativescript-geolocation and nativescript-google-maps-sdk plugins are using. The googlePlayServicesVersion dependency should be used with same version for both plugins. So the solution of the issue, when building an app is to specify which version of the dependency should be used by both plugins. As suggested by @annadante you should add before-plugins.gradle file where the googlePlayServicesVersion should be specified:

android {
    project.ext {
        googlePlayServicesVersion = "15.0.1" 
    }
}
9reactions
annadantecommented, Nov 14, 2018

I fixed the problem by adding this file to App_Resources/Android

file name: before-plugins.gradle content: android {
// other stuff here

project.ext { googlePlayServicesVersion = “15.0.1” } }

Read more comments on GitHub >

github_iconTop Results From Across the Web

Geolocation - NativeScript Docs
Geolocation plugin to use for getting current location, monitor movement, etc. npm install @nativescript/geolocation. Important Breaking Change Version ...
Read more >
Error: Cannot enable the location service. TypeError: Cannot ...
For anyone still looking for a solution to this, I was able to find was using CoreTypes.Accuracy.high geolocation.
Read more >
'tns' is not a recognized command - Google Groups
I have installed NativeScript CLI and whenever I try using the tns command, I get this error: "'tns' is not a recognized internal...
Read more >
Geolocation Mobile App Using NativeScript - Daxima
Using Nativescript plugins to manage geolocation in mobile application. ... you will get locations only from the last 5 seconds.
Read more >
geolocation nativescript plugin does not work in sap business ...
We found out that the reported issue has caused due to some breaking changes introduced in recent update to the nativescript-geolocation plugin.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found