Skip to content

App crashes when saving photo on Android 10 devices #245

Closed
@jakubgondar

Description

@jakubgondar

Which platform(s) does your issue occur on?

Android 10 (Android 9 and lower seems to work fine), devices that I have tested this issue:

  • Samsung Galaxy M20 (SM-M205FN, Kernel: 4.4.177-17406009)
  • Android 10 emulator (Pixel_3_API_29_Android_10_with_Play_Store)

Please, provide the following version numbers that your issue occurs with:

  • CLI: 6.5.0
  • Cross-platform modules: 6.5.1
  • Runtime(s): "tns-android": 6.5.0
  • Plugin(s): "nativescript-camera": 4.5.0
  • Dependencies:
"dependencies": {
    "@angular/animations": "~8.2.0",
    "@angular/common": "~8.2.0",
    "@angular/compiler": "~8.2.0",
    "@angular/core": "~8.2.0",
    "@angular/forms": "~8.2.0",
    "@angular/platform-browser": "~8.2.0",
    "@angular/platform-browser-dynamic": "~8.2.0",
    "@angular/router": "~8.2.0",
    "@nativescript/theme": "~2.3.3",
    "nativescript-angular": "~8.21.0",
    "nativescript-camera": "~4.5.0",
    "reflect-metadata": "~0.1.12",
    "rxjs": "^6.4.0",
    "tns-core-modules": "~6.5.0",
    "zone.js": "~0.9.1"
  },
  "devDependencies": {
    "@angular/compiler-cli": "~8.2.0",
    "@ngtools/webpack": "~8.2.0",
    "nativescript-dev-webpack": "~1.5.1",
    "typescript": "~3.5.3"
  }

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

Nativescript-camera plugin does not work on Android 10 devices, our clients were complaining mostly about Samsung Galaxy and Xiaomi MI devices. It does not work also on Android 10.

Is there any code involved?

I am attaching simple demo app that is supposed to just take photo and show it in Angular component. App was generated via command tns create as Angular Hello world app.
tns650.zip

To reproduce issue:

  1. unpack ZIP
  2. run npm ci (installs exact vesions from package-lock.json
  3. run tns platform clean android
  4. run tns debug android
  5. Click "Click here to take photo", allow permissions and take photo. After taking photo, photo should appear below the button on screen.

On Android 10 emulator, it throws error JS: Error: cancelled in the console.
On Samsung Galaxy M20, application crashes. See attached GIF video how it behaves on real device:
ezgif com-resize

Error stack:
tns650error.txt

Workaround

I have found out that when targetSdkVersion is set to 28 (not default 29 in TNS 6.5.0) then application works :

...
android {
	defaultConfig {
		minSdkVersion 17
		targetSdkVersion 28
...

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions