0

我正在尝试使用 Phonegap (cordova) 将 sencha touch 2.0 项目安装到 Android 模拟器中。

我按照教程中提到的步骤尝试了 HelloWorld 示例,它可以工作!

我把我的项目放在assests文件夹下的www目录下,还添加了cordova jar文件、xml文件夹

在主课上,我做了以下事情: super.loadUrl("file:///android_asset/www/index.html");

但是运行应用程序后,它会在控制台中显示以下内容:

[2012-06-11 15:48:27 - PhoneGap] Uploading PhoneGap.apk onto device 'emulator-5554'
[2012-06-11 15:36:13 - PhoneGap] Uploading PhoneGap.apk onto device 'emulator-5554'
[2012-06-11 15:38:10 - PhoneGap] Installing PhoneGap.apk...
[2012-06-11 15:38:12 - PhoneGap] Installation failed due to invalid APK file!
[2012-06-11 15:38:12 - PhoneGap] Please check logcat output for more details.
[2012-06-11 15:38:13 - PhoneGap] Launch canceled!

日志猫:

06-11 13:00:27.003: DEBUG/SntpClient(65): request time failed: java.net.SocketException: Address family not supported by protocol
06-11 13:04:24.309: DEBUG/dalvikvm(141): GC_EXPLICIT freed 1K, 12% free 14374K/16327K, paused 11ms+5ms
06-11 13:05:27.041: DEBUG/SntpClient(65): request time failed: java.net.SocketException: Address family not supported by protocol
06-11 13:06:05.003: INFO/installd(34): free_cache(6710880) avail 4059136
06-11 13:06:05.009: ERROR/installd(34): cannot open /data/secure/data/: No such file or directory
06-11 13:06:05.341: ERROR/installd(34): Couldn't openat cache: No such file or directory
06-11 13:06:05.349: ERROR/installd(34): Couldn't openat cache: No such file or directory
06-11 13:06:05.349: ERROR/installd(34): Couldn't openat cache: No such file or directory
06-11 13:06:05.370: ERROR/installd(34): Couldn't openat cache: No such file or directory
06-11 13:06:05.370: ERROR/installd(34): Couldn't openat cache: No such file or directory
06-11 13:06:05.370: ERROR/installd(34): Couldn't openat cache: No such file or directory
06-11 13:06:05.370: ERROR/installd(34): Couldn't openat cache: No such file or directory
06-11 13:06:05.401: ERROR/installd(34): Couldn't openat cache: No such file or directory
06-11 13:06:05.431: ERROR/installd(34): Couldn't openat cache: No such file or directory
06-11 13:06:05.431: ERROR/installd(34): Couldn't openat cache: No such file or directory
06-11 13:06:05.453: ERROR/installd(34): Couldn't openat cache: No such file or directory
06-11 13:06:05.453: ERROR/installd(34): Couldn't openat cache: No such file or directory
06-11 13:06:05.453: ERROR/installd(34): Couldn't openat cache: No such file or directory
06-11 13:06:05.453: ERROR/installd(34): Couldn't openat cache: No such file or directory
06-11 13:06:05.459: ERROR/installd(34): Couldn't openat cache: No such file or directory
06-11 13:06:05.459: ERROR/installd(34): Couldn't openat cache: No such file or directory
06-11 13:06:05.459: ERROR/installd(34): Couldn't openat cache: No such file or directory
06-11 13:06:05.459: ERROR/installd(34): Couldn't openat cache: No such file or directory
06-11 13:06:05.459: ERROR/installd(34): Couldn't openat cache: No such file or directory
06-11 13:06:05.459: ERROR/installd(34): Couldn't openat cache: No such file or directory
06-11 13:06:05.459: ERROR/installd(34): Couldn't openat cache: No such file or directory
06-11 13:06:05.459: ERROR/installd(34): Couldn't openat cache: No such file or directory
06-11 13:06:05.459: ERROR/installd(34): Couldn't openat cache: No such file or directory
06-11 13:06:05.459: ERROR/installd(34): Couldn't openat cache: No such file or directory
06-11 13:06:05.459: ERROR/installd(34): Couldn't openat cache: No such file or directory
06-11 13:06:05.473: ERROR/installd(34): Couldn't openat cache: No such file or directory
06-11 13:06:05.479: ERROR/installd(34): Couldn't openat cache: No such file or directory
06-11 13:06:05.479: ERROR/installd(34): Couldn't openat cache: No such file or directory
06-11 13:06:05.479: ERROR/installd(34): Couldn't openat cache: No such file or directory
06-11 13:06:05.479: ERROR/installd(34): Couldn't openat cache: No such file or directory
06-11 13:06:05.479: ERROR/installd(34): Couldn't openat cache: No such file or directory
06-11 13:06:05.479: ERROR/installd(34): Couldn't openat cache: No such file or directory
06-11 13:06:05.479: ERROR/installd(34): Couldn't openat cache: No such file or directory
06-11 13:06:05.502: ERROR/installd(34): Couldn't openat cache: No such file or directory
06-11 13:06:05.519: ERROR/installd(34): Couldn't openat cache: No such file or directory
06-11 13:06:05.519: ERROR/installd(34): Couldn't openat cache: No such file or directory
06-11 13:06:05.519: ERROR/installd(34): Couldn't openat cache: No such file or directory
06-11 13:06:05.519: ERROR/installd(34): Couldn't openat cache: No such file or directory
06-11 13:06:05.519: ERROR/installd(34): Couldn't openat cache: No such file or directory
06-11 13:06:05.519: ERROR/installd(34): Couldn't openat cache: No such file or directory
06-11 13:06:05.519: ERROR/installd(34): Couldn't openat cache: No such file or directory
06-11 13:06:05.519: ERROR/installd(34): Couldn't openat cache: No such file or directory
06-11 13:06:05.519: ERROR/installd(34): Couldn't openat cache: No such file or directory
06-11 13:06:05.529: ERROR/installd(34): Couldn't openat cache: No such file or directory
06-11 13:06:05.529: ERROR/installd(34): Couldn't openat cache: No such file or directory
06-11 13:06:05.529: ERROR/installd(34): Couldn't openat cache: No such file or directory
06-11 13:06:05.529: ERROR/installd(34): Couldn't openat cache: No such file or directory
06-11 13:06:05.539: WARN/PackageManager(65): Couldn't clear application caches
06-11 13:06:05.539: INFO/DeviceStorageMonitorService(65): Running low on memory. Sending notification
06-11 13:06:05.871: DEBUG/Tablet/NotificationPanel(266): notificationCount=1
06-11 13:06:06.123: INFO/dalvikvm(266): Jit: resizing JitTable from 512 to 1024
06-11 13:06:06.209: WARN/ActivityManager(65): Unable to start service Intent { act=com.android.email.intent.action.MAIL_SERVICE_CANCEL cmp=com.android.email/.service.MailService }: not found
06-11 13:06:12.769: DEBUG/dalvikvm(286): GC_EXPLICIT freed 67K, 9% free 6420K/6983K, paused 4ms+10ms

我是否必须更新我的 index.html 文件以包含 cordova.js 文件?

4

1 回答 1

0

如果您使用 eclipse 创建原生 android 应用程序,那么在您的 android 模拟器中运行 sencha 应用程序非常简单。

我可以向你展示一些简单的步骤。

1)我建议你使用MDS鼓掌电话间隙http://wiki.phonegap.com/w/page/34483744/PhoneGap%20Eclipse%20PlugIn%20for%20Android来安装phonegap。

2)一旦您完成安装,您将在顶部看到电话间隙图标。

3)然后单击它以创建一个最小的电话间隙项目。

4)然后你会看到索引文件没有必要的东西。你可以替换索引文件如下

    <!DOCTYPE html>
   <html>
    <head>
    <title>The Sencha Touch List Component</title>
   <link rel="stylesheet" href="app.css" type="text/css">

   <script type="text/javascript" src="touch/sencha-touch-all.js"></script>
   <script type="text/javascript" charset="utf-8">
   Ext.Loader.setConfig({
   enabled: true,
   paths: { 'Ext': 'touch/src' }
   });
  </script>
 <script type="text/javascript" src="app.js"></script>
  </head>
  <body></body>
  </html>

5)如果你想使用电话间隙功能,你也可以包含phonegap.js。然后在资产文件夹中你可以创建创建煎茶应用程序所需的文件夹。如应用程序文件夹,样式文件夹,触摸文件夹等必要的东西,如 css 文件和应用程序。在 www 文件夹中。

6)你可以检查配置是否正确,只需在eclipse中检查web浏览器中的index.html文件即可。

7)如果没问题,那么你可以在你的安卓模拟器中运行应用程序,就像你为你的原生应用程序做的那样。

于 2012-06-13T06:28:30.917 回答