nativescriptnativescript-angular

How to fix this error "Cannot enable the location service. Error: java.lang.NoClassDefFoundError"?


I am developing android and ios applications using native script-angular. I am using the native script-geolocation plugin to access the current location. I am also using native script-plugin, firebase plugin in my app. I can't enable the location in android using native script-geolocation in my app. How to fix the issue?

Iam using the plugin versions: nativescript-firebase = 7.3.0 geo-location = 5.1.0

This issue only occurs on the android platform, in ios, it was worked. I also set the app.gradle properties like

android {  
  defaultConfig {
    applicationId = "id"  
    multiDexEnabled true
    generatedDensities = []
  }
  project.ext {
    googlePlayServicesVersion = "16.+"
    }

  aaptOptions {  
    additionalParameters "--no-version-vectors"  
  }
  dexOptions {
    javaMaxHeapSize "4g"
  }

} 

Iam getting the following error:

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

Solution

  • Thank you manoj for suggesting this link Github issue. I have fixed the issue by updating google play services in android sdk and also i was creadted the before-plugins.gradle file and added the google play services configuration like below

    android {  
      project.ext {
          googlePlayServicesVersion = "15.0.1"
      }
    }