[TIMOB-9362] Android: first use of camera crashes on SDK 2.0.1+ (works on 1.8.2-)
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | High |
Status | Closed |
Resolution | Cannot Reproduce |
Resolution Date | 2012-06-19T18:10:04.000+0000 |
Affected Version/s | Release 2.0.1 |
Fix Version/s | n/a |
Components | Android |
Labels | community, core, regression |
Reporter | Parand Darugar |
Assignee | Opie Cyrus |
Created | 2012-06-01T12:39:32.000+0000 |
Updated | 2017-03-30T21:28:17.000+0000 |
Description
There is a consistent crash when using the camera on Android:
- Install your application (eg. kitchensink) by downloading the .apk (NOT by deploying to the Android device via Eclipse).
- The first time you use the camera, after you've taken the picture, as soon as you hit "Save", the app will crash before your camera success callback is called
Once you restart the app the camera save function works fine - ie. the crash only occurs on first use of camera.
To isolate this I created the simplest possible app that only fires up the camera and takes a picture. The camera code is taken directly from KitchenSink. You can also replicate the bug using KitchenSink.
The app works fine when built using the 1.7.2 and 1.8.2 SDK, and crashes on first use when built with the 2.0.1 or 2.0.2 SDK.
So it seems somewhere between 1.8.2 and 2.0.1 the camera code for Android broke.
can confirm this on SDK 2.0.2 too. Tested on Samsung Galaxy S -> same behaviour.
From the behavior described in the ticket, it's very similar to TIMOB-8514.
Unable to reproduce the failure against master. Ran the following app deployed via tistudio and also manually copied apk to device then installed via file manager which should be the same process as downloading the apk. Beyond the expected restart of app upon first launch, the behavior was correct through preview, capture to saving. If error still persists and ticket is re-opened, please attached exact test case used to reproduce the error.
Should be noted that I tried the same test inside a heavy weight window with the same results.
This is definitely reproducible, even with kitchen sink. There's even a comment on the question I asked in Q&A with someone else reporting the same issue: http://developer.appcelerator.com/question/137640/android-first-time-use-of-camera-crashes-2nd-time-onwards-works Here's the exact code the produces the problem: --------------- var window = Titanium.UI.currentWindow; function camera_receipt() { Titanium.API.info('############ showing camera'); Titanium.Media.showCamera({ success: function(event) { Ti.API.info('--- receipt.js: Camera SUCCESS'); var cropRect = event.cropRect; var receipt_image = event.media; }, cancel: function() { Ti.API.info('--- receipt.js: Camera CANCEL'); window.close(); }, error:function(error) { Ti.API.info('--- receipt.js: Camera ERROR'); var a = Titanium.UI.createAlertDialog({title:'Camera'}); if (error.code == Titanium.Media.NO_CAMERA) { a.setMessage('Device does not have camera capabilities'); } else { a.setMessage('Unexpected error: ' + error.code); } a.show(); window.close(); }, allowImageEditing:false, saveToPhotoGallery: Ti.Platform.osname == "iphone"? false: true, mediaTypes:[Ti.Media.MEDIA_TYPE_PHOTO] }); } camera_receipt(); ---------------
We need additional information: * Was this test performed against master (currently master@63645c4) ? * We need a list of tested devices. This could be either a 4.x or a device-specific issue. When this information is provided please reopen this ticket.
I had this crash on a Samsung Galaxy S Plus (I-9001) with Android 2.3
Crashes on 4 separate phones. Mine is a Galaxy Vibrant running 2.2, the other three I don't have handy but I can find if needed. It's crashed on every phone we've tried it on regardless of android version.
This was tested on 2.0.1 and 2.0.2 where it crashes, and on 1.7.2 and 1.8.2 where it does not crash.
@Parand - Can you please test it quickly with 2.1.0 (master) build? We have not been able to reproduce this issue so it would help us narrow down the issue.
@Neeraj, happy to. I looked briefly at how to build appcelerator from source but didn't get far, is there a 2.1.0 build available somewhere I can try? This and one more issue are holding up releasing my app so I'm very motivated to help ;-)
@Parand - http://builds.appcelerator.com.s3.amazonaws.com/index.html. Use "master" from the drop down.
Tried building with SDK version 2.1.0v20120619132308 and I'm happy to report the issue is no longer there - using the camera for the first time does not cause a crash. Looks like whatever the issue was has been resolved in the lastest code base. Thank you guys.
Reported has confirmed that this issue cannot be reproduced with the latest 2.1.0 build.
Closing ticket as I am unable to reproduce the issue using the following environment; Pixel (7.1) MacOS 10.11.6 (15G31) Studio 4.8.1.201612050850 Ti SDK 6.0.3 GA Appc NPM 4.2.8 Appc CLI 6.1.0 Ti CLI 5.0.11 Alloy 1.9.5 Arrow 1.10.1 Xcode 8.2 (8C38) Node v4.6.0 Java 1.7.0_80