English 中文(简体)
PhoneGap应用程序在Android上没有响应
原标题:PhoneGap app is unresponsive on Android

我创建了一个简单的PhoneGap应用程序,现在只需在点击按钮时拍摄一张照片,然后在同一页面上的图像中显示图片。我已经构建了iOS和Android版本,iOS版本运行良好。另一方面,Android版本突出显示按钮,但从不切换到相机活动。可能是什么问题?

我的第一个想法是问题出在我的index.html文件中的Javascript代码中。因此,我将index.html的内容完全替换为PhoneGap API相机参考页面。此页面显示四个按钮,每个按钮都会触发一个Javascript函数,该函数使用PhoneGap以一种或另一种方式获取图像。该应用程序构建无误,并在我的测试设备(HTC Evo 4G)上启动。然而,再次点击任何按钮都会突出显示该按钮,但不会发生其他任何事情。

我使用的是最近下载的PhoneGap 0.95,最新的Android SDK(两天前下载并安装),以及带有ADT插件的Eclipse。

有人能给我一些关于如何开始调试的想法吗?

编辑:值得一提的是,我根据PhoneGap中的步骤设置了我的Android项目Android入门指南。我根据那里的说明修改了AndroidManifest.xml文件,并使用了说明中的文本,因此<;支持屏幕…/>;块后的第一行是:

<uses-permission android:name="android.permission.CAMERA" />
最佳回答

Caleb>;

我被phonegap android+HTC EVO 4G完全相同的问题绊倒了。

也许你已经想明白了。以防万一,

默认示例应用程序不工作的根本原因是example_android文件夹中生成的index.html文件中javascript src的url不正确。

  -- PROBLEM: I noticed that index.html in the example_android folder  is linking to a js file don t exist. 
      type="text/javascript" charset="utf-8" src="phonegap.0.9.5.min.js"
  changed it to    
      type="text/javascript" charset="utf-8" src="phonegap.0.9.5.js"

在我从src-attrib中删除“.min”后,重建android应用程序并重新部署到我的android手机。一切都开始好起来了。

问题回答

尝试通过运行相机应用程序并选择设置按钮来降低保存的相机图像的分辨率。

PhoneGap示例应用程序中的相机按钮通常会崩溃,直到我降低分辨率。

我还没有调试它,但我猜在默认Evo相机分辨率(我手机上的5M)的某个地方内存溢出了

Try uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" in your manifest file and use destinationType: Camera.DestinationType.FILE_URI for phonegap s getPicture call. I had the same problem and adding WRITE_EXTERNAL_STORAGE permission worked for me.





相关问题
selected text in iframe

How to get a selected text inside a iframe. I my page i m having a iframe which is editable true. So how can i get the selected text in that iframe.

How to fire event handlers on the link using javascript

I would like to click a link in my page using javascript. I would like to Fire event handlers on the link without navigating. How can this be done? This has to work both in firefox and Internet ...

How to Add script codes before the </body> tag ASP.NET

Heres the problem, In Masterpage, the google analytics code were pasted before the end of body tag. In ASPX page, I need to generate a script (google addItem tracker) using codebehind ClientScript ...

Clipboard access using Javascript - sans Flash?

Is there a reliable way to access the client machine s clipboard using Javascript? I continue to run into permissions issues when attempting to do this. How does Google Docs do this? Do they use ...

javascript debugging question

I have a large javascript which I didn t write but I need to use it and I m slowely going trough it trying to figure out what does it do and how, I m using alert to print out what it does but now I ...

Parsing date like twitter

I ve made a little forum and I want parse the date on newest posts like twitter, you know "posted 40 minutes ago ","posted 1 hour ago"... What s the best way ? Thanx.

热门标签