Closed jakubgondar closed 4 years ago
I get a similar error in Xiaomi Mi9se on Android 10 QKQ, after the photo the application closes
Same on Pixel 3a and Samsung S20 (both android 10)
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.
I also have the same issue in my redmi k20 image didn't appears and in console it shows JS: Error: cancelled.
You need to add the following key android:requestLegacyExternalStorage="true"
if you are targetting API 29 or higher and you want to use the normal file api.
<manifest ... >
<!-- This attribute is "false" by default on apps targeting
Android 10 or higher. -->
<application android:requestLegacyExternalStorage="true" ... >
...
</application>
</manifest>
@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.
@NathanaelA Thank You So much it worked
@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
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:
Please, provide the following version numbers that your issue occurs with:
"tns-android"
: 6.5.0Please, 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.zipTo reproduce issue: 1) unpack ZIP 2) run
npm ci
(installs exact vesions from package-lock.json 3) runtns platform clean android
4) runtns 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: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 :