NativeScript / nativescript-geolocation

Geolocation plugin to use for getting current location, monitor movement, etc
Apache License 2.0
139 stars 77 forks source link

App crashes constantly android #253

Closed mfik closed 4 years ago

mfik commented 4 years ago
{
  "nativescript": {
    "id": "nl.teammarco.xxx",
    "tns-ios": {
      "version": "6.1.0"
    },
    "tns-android": {
      "version": "6.1.2"
    }
  },
  "description": "xxx",
  "license": "SEE LICENSE IN <your-license-filename>",
  "repository": "<fill-your-repository-here>",
  "scripts": {
    "lint": "tslint \"src/**/*.ts\""
  },
  "dependencies": {
    "@angular/animations": "8.2.1",
    "@angular/common": "8.2.1",
    "@angular/compiler": "8.2.1",
    "@angular/core": "8.2.1",
    "@angular/forms": "8.2.1",
    "@angular/http": "8.0.0-beta.10",
    "@angular/platform-browser": "8.2.1",
    "@angular/platform-browser-dynamic": "8.2.1",
    "@angular/router": "8.2.1",
    "@nota/nativescript-webview-ext": "6.0.0-alpha.2",
    "nativescript-advanced-webview": "4.0.1",
    "nativescript-angular": "^8.2.1",
    "nativescript-appversion": "1.4.2",
    "nativescript-calendar": "2.1.0",
    "nativescript-directions": "1.3.1",
    "nativescript-email": "1.5.5",
    "nativescript-fancyalert": "3.0.9",
    "nativescript-geolocation": "5.1.0",
    "nativescript-iqkeyboardmanager": "1.5.1",
    "nativescript-mapbox": "4.4.1",
    "nativescript-phone": "1.4.0",
    "nativescript-plugin-firebase": "10.0.1",
    "nativescript-theme-core": "1.0.6",
    "nativescript-ui-dataform": "5.1.1",
    "nativescript-ui-listview": "7.1.0",
    "nativescript-ui-sidedrawer": "7.0.2",
    "nativescript-web-image-cache": "5.0.0",
    "reflect-metadata": "0.1.13",
    "rxjs": "6.5.2",
    "tns-core-modules": "^6.1.1",
    "uglifyjs-webpack-plugin": "2.2.0",
    "zone.js": "0.10.1"
  },
  "devDependencies": {
    "@angular/compiler-cli": "8.2.1",
    "@nativescript/schematics": "0.7.2",
    "@ngtools/webpack": "8.2.1",
    "codelyzer": "5.1.0",
    "nativescript-dev-webpack": "^1.2.1",
    "node-sass": "4.12.0",
    "tns-platform-declarations": "6.0.6",
    "tslint": "5.18.0",
    "typescript": "~3.5.3"
  },
  "gitHead": "803cec054c44c99eaa59cdc267993e6346f6cb3a",
  "readme": "NativeScript Application",
  "author": "Team Marco"
}

Constant crash while loading splash screen.

Please, tell us how to recreate the issue in as much detail as possible.

Did this in the oninit of the main app

geolocation.isEnabled().then((isEnabled) => {
            if (!isEnabled) {
                geolocation.enableLocationRequest(true, true).then(() => {
                    console.log("User Enabled Location Service");
                }, (e) => {
                    console.log("Error: " + (e.message || e));
                }).catch((ex) => {
                    console.log("Unable to Enable Location", ex);
                });
            }
        }, (e) => {
            console.log("Error: " + (e.message || e));
        });

Output is :

Error: JNI Exception occurred (SIGABRT). JS: ======= JS: Check the 'adb logcat' for additional information about the error. JS: ======= JS: JS: at require (:1:266) JS: at Function.requireEnsure [as e] (file:///src\webpack\bootstrap:769:0) JS: at fn.e (file:///src\webpack\bootstrap:146:0) JS: at Array.map () JS: at webpackAsyncContext (file:///src\$_lazy_route_resource lazy namespace object:40:0) JS: at SystemJsNgModuleLoader.push.../node_modules/@angular/core/fesm5/core.js.SystemJsNgModuleLoader.loadAndCompile (file:///node_modules\@angular\core\fesm5\core.js:27063:29) JS: at SystemJsNgModuleLoader.push.../node_modules/@angular/core/fesm5/core.js.SystemJsNgModuleLoader.load (file:///node_modules\@angular\core\fesm5\core.js:27055:0) JS: at ... ActivityManager: Process nl.teammarco.werkmatcher (pid 20513) has died: fore TOP (386,2382)

ADB Logcat *:E

10-24 14:53:05.301 20513 20513 F rco.werkmatche: runtime.cc:582] JNI DETECTED ERROR IN APPLICATION: JNI NewStringUTF called with pending exception java.lang.NoClassDefFoundError: Failed resolution of: Lcom/google/android/gms/internal/zzbck;

Tried : deleting node_modules, platforms, .cloud etc.

mfik commented 4 years ago

Resolved with newest debug data, adding 👍

project.ext { googlePlayServicesVersion = "+" }

tahir-jamil commented 4 years ago

i have added googlePlayServicesVersion = "+" but its crashes again

yolcuiskender commented 4 years ago

Insert this into app.graddle file

project.ext { googlePlayServicesVersion = "16.+" } dependencies { def googlePlayServicesVersion = project.googlePlayServicesVersion compile "com.google.android.gms:play-services-location:$googlePlayServicesVersion" }

This will stop the crash issue.

(Sorry for the formatting, I can't paste it in the format I like)

aosi87 commented 4 years ago

check my comment on https://github.com/NativeScript/nativescript-geolocation/issues/259

leocrawf commented 3 years ago

Insert this into app.graddle file

project.ext { googlePlayServicesVersion = "16.+" } dependencies { def googlePlayServicesVersion = project.googlePlayServicesVersion compile "com.google.android.gms:play-services-location:$googlePlayServicesVersion" }

This will stop the crash issue.

(Sorry for the formatting, I can't paste it in the format I like)

Finally, this fixed the issue for me!!!