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
[Android] Attempt to invoke virtual method 'int android.graphics.Bitmap.getWidth()' on a null object reference #165
Comments
Another test with "react-native-image-picker": "^0.18.6" gives me the same error... |
+1 |
What kind of image ? |
@yfuks Seems to be any photo based on the stacktraces we are seeing. Hard to tell exactly since the path is something like If I can help in any way let me know. We just did a soft-launch of our Android app yesterday, and have already seen this crash 92 times for 45 different users on a variety of devices and Android versions: |
A fast work around is to not set the folowingoptions : angle
maxWidth
maxHeight
quality I'm actually working on a fix :) Can you guys tell me if you get the same issue with the example ? It could help me. |
I can't test the example at the moment, but I just published a new APK with the workaround you suggested (we used |
Make sure you add the folowing permission <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/> Since i'm not able to reproduce i will add robustness code to the project to avoid crash. |
I just push robustness code to fix this issue that appears in the case you can't read the selected image. f134b91#diff-e2ac0feb8ce151bd872a7c4ab6b4801dR400 Hope this will work. |
@yfuks well, this will prevent the crash...but it's not going to help these guys actually get the image. Do we know the root cause? |
Well the code that i push will just prevent resizing if we cannot read the selected image. I feel like it could be helpfull since it don't prevent from getting response infos ( The crash can only appear when we can't read the selected photo. (No rights, not enough memory) |
@yfuks ohhh I see, I didn't see that it avoids the resize if we can't read it. Cool. I'm going to publish a new release to npm right now...@CodeTitanian @anativ @dhrrgn can you guys see if this fixes your issue? |
@marcshilling if you can just wait a couple of minutes :) |
@yfuks oops, too late! |
@yfuks I did have the @marcshilling I installed module version 0.18.10 and now the app does not crash but also does not really do anything... Does not help because the response data I get is empty string. |
@yfuks that's what I was talking about ^. You fixed the crash but that root cause is that the photo doesn't exist. |
What you mean exactly ? Nothing is returned to RN ?
I'm not sure about that. And avoid crash is still an enhancement :) |
@CodeTitanian can you tell me what kind of image you pick in your gallery ? Image from facebook ? Camera ? .. ? |
@yfuks When I select a photo from "Gallery" it works and brings up the cropping tool (with Same photo as far as I can tell ... Just matters which picture app I go thru. |
@rpastorelle can you open an other issue ? :) |
@yfuks He was just giving you the information you asked for. It is the same issue. |
ok. So now that we have something to work with i can investigate further and try to reproduce. |
Good new i'm finally able to reproduce the issue ! I also know what can i do to fix it. I'm on it. :) |
fix in 0.18.11 So i fix the issue by using the initial image if the crop don't perform. I still need to find out why crop don't work on some app. Can you try the new version and tell me if it resolve your issue ? |
@yfuks Can confirm this has fixed the issue for us. Thanks for the quick turn-around on this. 👍 |
@yfuks the new version works good. Thanks for fixing it! |
I'm getting this exact same error now on version 0.19.2. Any idea what could be causing it? |
@smwoods nothing appears to have changed with the code that was added to fix this, and I can't reproduce. Let me know if you can track it down. |
Hm. I'm running on a galaxy s6, react native version 0.26.3, I've tried uninstalling and reinstalling multiple times, and I'm running the example exactly as written. Every time I select a photo, the app crashes. Any advice on how to begin debugging this at least? |
Reinstalled Android Studio, finally got it working. Still crashes with allowsEditing on but is working otherwise. |
Using "react-native-image-picker": "^0.18.3"
I try to select an image from the device library, when selecting an image - the app crashes. This only happens on the device and not in the simulator.
Here is the error:
The text was updated successfully, but these errors were encountered: