Skip to content
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

Crashes on Android when Activity Closes #49

Open
JWiseCoder opened this issue May 28, 2019 · 8 comments
Open

Crashes on Android when Activity Closes #49

JWiseCoder opened this issue May 28, 2019 · 8 comments

Comments

@JWiseCoder
Copy link

Whenever the cropper finishes on Android, it returns everything properly. However, when the cropper activity closes, it causes the entire app to crash without any visible error. I've dug through the device logs, but the only thing I could see was something like InputDispatcher: Attempted to unregister already unregistered input channel

Is it possible I'm doing something wrong? Or is this a bug in the underlying code?

@shiv19
Copy link
Collaborator

shiv19 commented May 28, 2019

Just run the things inside your .then block in a setTimeout @JWiseCoder

@JWiseCoder
Copy link
Author

JWiseCoder commented May 29, 2019

I did. It still crashes without writing out an error. I even put a delay on each setTimeout, and it still crashed.

@JWiseCoder
Copy link
Author

JWiseCoder commented Jun 10, 2019

I still haven't found any way to keep it from crashing. It has something to do with how the Activity is being closed. Not sure if it's something inside the uCrop library or something this plugin is doing.

Or could it be something like the native image in the ImageSource is linked to the cached image file on disk, which is getting deleted before it returns? Maybe it's not entirely in memory or something?

@Noppey
Copy link

Noppey commented Dec 30, 2019

My app crashes when I take another picture with nativescript-camera, after cropping the previous picture. I also tried setTimeouts everywhere, no help there.

Update: It seems I mixed up the angular template with the normal usage, when using the proper angular template, it works fine.

@JWiseCoder
Copy link
Author

@Noppey Can you elaborate on that? Do you have an example?

@Noppey
Copy link

Noppey commented Dec 30, 2019

https://github.com/bthurlow/nativescript-imagecropper/blob/master/demo/app/main-view-model.ts

This demo-code broke when I used that in Angular (only changed some deprecated dependencies), after clicking the button for "takepicture" a second time.

When not cropping, taking the picture worked just fine. I don't have an exact reproduction example, as I kept trying to fix it.

@shiv19
Copy link
Collaborator

shiv19 commented Dec 30, 2019

Ok, after I'm back from holidays, I'll release the pro plugins version of this plugin to this public version. That is stable and I did the support for {N} 6 on it.

In the current public version, it wasn't me who made the upgrade to {N} 6 and as such I haven't been offering support for it lately.

After I release the proplugins verison to public, I'll notify here and from then I'll start supporting this plugin once again.

I understand that this is an important plugin and needs better support.

Expect a stable version to be released on or before Jan 3rd 2020. :)

Cheers

@shiv19
Copy link
Collaborator

shiv19 commented Jan 5, 2020

Update:
v3.0.0 was released now. It matches the Proplugins variant.
Please check the demo app once again to see the proper implementation.

I'm actively using this plugin and have had no issues with it so far.

the setTimeout part here is crucial to make it work on iOS, because the asset won't be immediately ready to be read by the plugin.

}, isAndroid ? 0 : 1000);

I've also added my service implementation to show you how to use it with proper loader and also support image uploading with compression.

hope this helps :)

Cheers!
Shiva <3

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

No branches or pull requests

3 participants