Titanium JIRA Archive
Appcelerator Community (AC)

[AC-3148] Camera always crashes Kitchen Sink on Android 2.2

GitHub Issuen/a
TypeBug
Priorityn/a
StatusClosed
ResolutionInvalid
Resolution Date2012-05-11T15:41:21.000+0000
Affected Version/sn/a
Fix Version/sn/a
ComponentsTitanium SDK & CLI
Labelsandroid, camera, crash
ReporterMal Broadbent
AssigneeShak Hossain
Created2012-05-01T13:25:03.000+0000
Updated2016-03-08T07:48:13.000+0000

Description

Problem

When running the "Camera Basic" test in KitchenSink for Android (2.2 APIs), the camera always crashes with either of these error messages: - "The camera stopped unexpectedly". - Activity Camera (in application camera) is not responding The camera should work without crashing.

Test case

Compile KitchenSink with Titanium 1.6.2, Android APIs 2.2. Run the "Camera Basic" test The app will crash

Discussions

http://developer.appcelerator.com/question/134453/the-application-camera-has-stopped-unexpectedy---android-22 http://developer.appcelerator.com/question/55301/bug-android-apis-22-crashes-when-using-the-camera

Comments

  1. Mauro Parra-Miranda 2012-05-02

    Hello, are you using the latest Kitchen Sink? It's designed for SDK version 1.8x and 2.0x. Best, Mauro
  2. Mal Broadbent 2012-05-03

    Hi Mauro Thanks for response. This is still a problem with SDK 1.81. I am using the latest Kitchen sink (downloaded from Github 1 May 2012). When using Android Emulator with APIs 2.2, the camera test fails with SDK 1.81. I have just tried it now with 1.81 and get the error message "Unexpected error:0" when running the "Camera Basic" test. Thanks Mal
  3. Nikhil Sharma 2012-05-10

    Hi Mal, I tested the latest kitchen sink with Ti SDK 1.8.1 and ran it on the android emulator(API 2.2). The basic camera feature is working fine. The application is not crashing. Did you clean build the project before running it on SDK 1.8.1? Please clean build it and then run. Regards, Nikhil
  4. Nikhil Sharma 2012-05-11

    Can't reproduce it with the latest version of the kitchen sink and Ti SDK 1.8.1
  5. Mostafizur Rahman 2013-12-26

    Hello , We tested this issue with code bellow. It’s working well in android.Please check this issue with latest SDK tools. Please update the ticket with your sample if you continue to get the crash. If we don't hear back from you, we will assume the issue is invalid and the ticket can be closed.

    Test Environment:

    Mac OSX 10.8.5 Titanium SDK 3.2.0.GA, Android SDK: 2.3.3, Ti CLI 3.2.0

    Test Code

       var win1 = Titanium.UI.createWindow();
        
       
       var anImageView = Ti.UI.createImageView({
       
       });
       win1.add(anImageView);
       
       var controlview = Ti.UI.createView({
       	width : Ti.UI.FILL,
       	height : Ti.UI.SIZE,
       	top : 20,
       });
       
       win1.add(controlview);
       
       var frmcamera = Ti.UI.createButton({
       	backgroundImage : 'none',
       	backgroundColor : '#ff0000',
       	title : L('take pic'),
       	color : '#fff',
       	width : 80,
       	height : 50,
       	left : 10,
       });
       
       frmcamera.addEventListener('click', function() {
       	fireUpTheCamera();
       });
       
       controlview.add(frmcamera);
       
       function fireUpTheCamera() {
       	Titanium.Media.showCamera({
       
       		success : function(event) {
       			var cropRect = event.cropRect;
       			var image = event.media;
       
       			Ti.API.debug('Our type was: ' + event.mediaType);
       			if (event.mediaType == Ti.Media.MEDIA_TYPE_PHOTO) {
       				anImageView.image = image; 
       			} else {
       				alert("got the wrong type back =" + event.mediaType);
       			}
       		},
       		cancel : function() {
       		},
       		error : function(error) { 
       			var a = Titanium.UI.createAlertDialog({
       				title : 'Camera'
       			});
        
       			if (error.code == Titanium.Media.NO_CAMERA) {
       				a.setMessage('Please run this test on device');
       			} else {
       				a.setMessage('Unexpected error: ' + error.code);
       			}
        
       			a.show();
       		},
       		saveToPhotoGallery : true,
       		allowEditing : false,
       		mediaTypes : [Ti.Media.MEDIA_TYPE_PHOTO]
       	});
       }
       
       win1.open();
       
       
       

    Step to Test

    Create a simple project

    Update app.js file with test code

    Run on android device (minimum SDK level 10 for 3.2.0.GA)

    Clicked on “take pic” red color button

    After capturing photo will display in window

    Thanks

JSON Source