Skip to content

App crashes when saving photo on Android 10 devices #245

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

Closed
jakubgondar opened this issue Jun 5, 2020 · 8 comments · May be fixed by #247
Closed

App crashes when saving photo on Android 10 devices #245

jakubgondar opened this issue Jun 5, 2020 · 8 comments · May be fixed by #247

Comments

@jakubgondar
Copy link

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
...
@aschurf
Copy link

aschurf commented Jun 5, 2020

I get a similar error in Xiaomi Mi9se on Android 10 QKQ, after the photo the application closes

@octo888
Copy link

octo888 commented Jun 5, 2020

Same on Pixel 3a and Samsung S20 (both android 10)

@Geotracer
Copy link

I have the same issue with my recent app.
Even with the same type of phone, the app crashes when confirming the photo.
Mostly after the first install, the app crashes.
The other times it crashes randomly.

@akshaysisodia
Copy link

I also have the same issue in my redmi k20 image didn't appears and in console it shows JS: Error: cancelled.

@NathanaelA

This comment was marked as abuse.

@jakubgondar
Copy link
Author

@NathanaelA thanks for response, but would you mind at least adding this note to the plugin home page README.md? TNS 6.5.0 has default target API 29 so apps built with this plugin will by default crash on Android 10.

@akshaysisodia
Copy link

@NathanaelA Thank You So much it worked

@BMwanza
Copy link

BMwanza commented Mar 6, 2021

@NathanaelA's solution did not work for me.

My target API is set to 29, as it is now required by the Play Store, but I cannot get it work. App crashes when trying to take a picture

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

Successfully merging a pull request may close this issue.

6 participants