Sorry, the Android camera encountered a problem. You may need to restart the device

5,827 views
Skip to first unread message

4allth...@gmail.com

unread,
Mar 23, 2012, 1:45:52 PM3/23/12
to eclipse-plugi...@googlegroups.com
OK I have been beating myself over the head with this one.  I have an Asus TF101 running 4.0.3.  I am running the tmt3 demo and this is what I get.  It works fine in the simulator.  I have reviewed all of the files and they are in the right place.

Mike

Libby

unread,
Mar 23, 2012, 4:19:51 PM3/23/12
to eclipse-plugi...@googlegroups.com
Unfortunately I don't have a 4.x device to test on at the moment.

Some things I can think of (assuming you've "restarted device" as suggested):

* Settings > Applications > All > (find "Camera" app and Force Stop)

* Download the free ZXing App (more or less the app / code used for the library)
and see if it works with the ASUS camera.

* Check the Camera app menu - for settings that may make it play nice
with other apps, users.

* Create and install app using "PhoneGap example source" (from wizard: 
Project Contents). Specifically run the Camera and Capture (Image, Video)
examples to see if basic camera access works with PhoneGap on the Asus.

Good Luck - let us know what works!
Libby

4allth...@gmail.com

unread,
Mar 23, 2012, 4:50:08 PM3/23/12
to eclipse-plugi...@googlegroups.com
Both of those worked flawlessly

4allth...@gmail.com

unread,
Mar 23, 2012, 4:58:16 PM3/23/12
to eclipse-plugi...@googlegroups.com
Here is something I found...but I am not sure it applies.  I made the changes, but I just got errors in Eclipse in the CameraConfigurationManager.java

https://github.com/phonegap/phonegap-plugins/issues/371


On Friday, March 23, 2012 1:45:52 PM UTC-4, 4allth...@gmail.com wrote:

Elizabeth Baldwin

unread,
Mar 23, 2012, 10:59:26 PM3/23/12
to eclipse-plugi...@googlegroups.com
An AppLaud Eclipse Issue was created for this:

Issue 75

Summary: the PhoneGap Plugin has not been kept up-to-date
to support Android 4.x. The original application, ZXing, has
updates that have not been migrated to the Barcode Scanner
Library project yet.

Libby

4allth...@gmail.com

unread,
Mar 24, 2012, 1:05:46 AM3/24/12
to eclipse-plugi...@googlegroups.com
Is there a timeframe for this to happen?  sorry, but I am a bit anxious to get this working


On Friday, March 23, 2012 1:45:52 PM UTC-4, 4allth...@gmail.com wrote:

Libby

unread,
Mar 24, 2012, 1:35:49 PM3/24/12
to eclipse-plugi...@googlegroups.com
Best is to watch github issue, or take a stab at it yourself and post
solution on github. I need this myself for a couple projects, but
have a full schedule for the next few weeks.

Libby

Elizabeth Baldwin

unread,
Mar 27, 2012, 12:00:43 PM3/27/12
to eclipse-plugi...@googlegroups.com
Hey 4 -

The attached file should give no errors. I won't have time to try
it until today or tomorrow - if you try it let us know how it works!

Libby
CameraConfigurationManager.java

Captain Qurik

unread,
May 20, 2012, 10:14:03 AM5/20/12
to Eclipse Plugin for PhoneGap
Hi there, I had the same issue, and this is the fix (in my case).

Open Eclipse project where you have the ZXing plugin installed, and
navigate to:
CaptureActivity > src > com.google.zxing.client.android.camera >
CameraConfigurationManager.java

In CameraConfigurationManager.java look for ... (line: 178 or there
about)
private void setFlash(Camera.Parameters parameters) { .... }

and replace it with ...

private void setFlash(Camera.Parameters parameters) {

// getFlashMode() returns NULL if flash mode setting is not supported
// https://github.com/phonegap/phonegap-plugins/issues/371
Log.d(TAG, "Check supported flash modes: " +
parameters.getSupportedFlashModes());
if(parameters.getFlashMode() == null ||
parameters.getSupportedFlashModes() == null) {
Log.w(TAG, "Cannot set flash mode. Unsupported by this device.");
return;
}


// This is a hack to turn the flash off on the Samsung Galaxy and the
Behold II
// as advised by Samsung, neither of which respected the official
parameter.
if (Build.MODEL.contains("Behold II") && CameraManager.SDK_INT == 3)
{ // 3 = Cupcake
parameters.set("flash-value", 1);
} else {
parameters.set("flash-value", 2);
}

// This is the standard setting to turn the flash off that all
devices should honor.
parameters.set("flash-mode", "off");
}

I have not tested is on other Android devices but it will probably
work fine. If i find it causes troubles I will post again.

Have fun!
Bruce
Reply all
Reply to author
Forward
0 new messages