简体   繁体   English

Android 4.1.2,三星银河S3,HTC上的Phonegap相机崩溃

[英]Phonegap camera crash on android 4.1.2, samsung galaxy s3, HTC

I think a lot of developers are familier with this problem of phonegap crashes/restarts after getting a picture from camera / library on android 4.1.2. 我认为许多开发人员对于从Android 4.1.2上的相机/库中获取图片后出现的phonegap崩溃/重新启动的问题更加熟悉。

After many searches of many solutions I want to put some order into this problem and I wish you could help me understand what is the current solution. 在搜索了许多解决方案之后,我想对这个问题进行一些整理,希望您能帮助我了解当前的解决方案。 Note: the current stable phonegap version is 2.9.0. 注意:当前稳定的phonegap版本是2.9.0。

  1. Using fileURI and not dataURL, because the encoded base64 is too big for the DOM to handle. 使用fileURI而不使用dataURL,因为编码的base64太大,DOM无法处理。

  2. Editing (not via phonegap build config.xml) the android manifest file and add the following line to every activity: 编辑(不通过phonegap build config.xml)android清单文件,并将以下行添加到每个活动中:

 android:alwaysRetainTaskState="true" android:launchMode="singleTask". 
  1. Limit the resolution using targetWidth/targetHeight, because the image is to big which causes memory over load. 使用targetWidth / targetHeight限制分辨率,因为图像过大会导致内存过载。 and reducing quality.. 并降低质量

  2. Switch off the 关掉

"Do not keep actitivies" “不要保留演员”

option in android settings.. which is ofcourse not a real solutions becaues we can't ask users to do that.. Android设置中的..当然不是真正的解决方案,因为我们不能要求用户这样做。

  1. Again, editing the android manifest (with discarding phonegap build service) and add: 再次,编辑android清单(放弃phonegap构建服务)并添加:
 android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale" <uses-feature android:name="android.hardware.camera" android:required="false"/> <uses-sdk android:minSdkVersion="7" android:targetSdkVersion="10"/> <activity android:configChanges="orientation|keyboardHidden" /> 
  1. Using an external camera plugin (not phonegap's): 使用外部摄像头插件(不是phonegap的插件):

links to all these solutions are here: http://community.phonegap.com/nitobi/topics/phonegap_camera_crash_on_android_4_1_2_samsung_galaxy_s3_htc 所有这些解决方案的链接都在这里: http : //community.phonegap.com/nitobi/topics/phonegap_camera_crash_on_android_4_1_2_samsung_galaxy_s3_htc

Now.. After this literature review.. Does anyone know which combination works? 现在..在查阅了这篇文献之后..有人知道哪种组合有效吗? please help! 请帮忙!

I had a similar problem. 我有一个类似的问题。 You require the following to get this to work: Make sure "uses-feature" tag appears after "application" tag. 您需要满足以下条件才能使它起作用:确保“ uses-feature”标签出现在“ application”标签之后。

<uses-feature android:name="android.hardware.camera" android:required="false"/>
<uses-feature android:name="android.hardware.camera.autofocus" android:required="false"/>

<application 
......

I hope this resolves your issue. 希望这能解决您的问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM