2013-09-05 203 views
4

我遵循基本Phonegap教程(Eclipse,Android SDK,ADT Phonegap)中的所有步骤,我在assets/www文件夹中创建了index.html页面(来自phonegap站点的代码)和cordova-2.2.0.jscordova-2.2.0.jar,当我跑它,它表明这个消息康寿屏幕上:phonegap简单的例子不能在android模拟器中工作

[2013-09-05 12:44:14 - phonegape-test] ------------------------------ 
[2013-09-05 12:44:14 - phonegape-test] Android Launch! 
[2013-09-05 12:44:14 - phonegape-test] adb is running normally. 
[2013-09-05 12:44:14 - phonegape-test] No Launcher activity found! 
[2013-09-05 12:44:14 - phonegape-test] The launch will only sync the application package on the device! 
[2013-09-05 12:44:14 - phonegape-test] Performing sync 
[2013-09-05 12:44:14 - phonegape-test] Automatic Target Mode: launching new emulator with compatible AVD 'STest' 
[2013-09-05 12:44:14 - phonegape-test] Launching a new emulator with Virtual Device 'STest' 
[2013-09-05 12:44:27 - phonegape-test] New emulator found: emulator-5554 
[2013-09-05 12:44:27 - phonegape-test] Waiting for HOME ('android.process.acore') to be launched... 
[2013-09-05 12:46:25 - phonegape-test] HOME is up on device 'emulator-5554' 
[2013-09-05 12:46:25 - phonegape-test] Uploading phonegape-test.apk onto device 'emulator-5554' 
[2013-09-05 12:46:26 - phonegape-test] Installing phonegape-test.apk... 
[2013-09-05 12:47:35 - phonegape-test] Success! 
[2013-09-05 12:47:35 - phonegape-test] \phonegape-test\bin\phonegape-test.apk installed on device 
[2013-09-05 12:47:35 - phonegape-test] Done! 

,但应用程序没有作用,我没有找到我的应用程序图标lancher!请你帮助我!

编辑MainActivity.java

package com.example.phonegape; 

import android.os.Bundle; 
import android.view.Menu; 
import org.apache.cordova.*; 
//import com.phonegap.DroidGap; 

public class MainActivity extends DroidGap { 

    @Override 
    public void onCreate(Bundle savedInstanceState) { 
     super.onCreate(savedInstanceState); 
     super.init(); 
     super.loadUrl("file:///assets/www/index.html"); 
    } 

    @Override 
    public boolean onCreateOptionsMenu(Menu menu) { 
     // Inflate the menu; this adds items to the action bar if it is present. 
     getMenuInflater().inflate(R.menu.main, menu); 
     return true; 
    } 

} 
+0

你说的 “不工作” 是什么意思?有没有空白的屏幕或什么?应用程序中断?请明确说明。 – Math

+0

没有空白屏幕,没有应用程序中断!模拟器已启动且没有任何事情发生 – Nomade

+0

你能发布你的活动吗? (我想你只有一个吧?) – Math

回答

0

你必须不断尝试,直到您的控制台说:“安装”,一个可能的工作就是运行一个仿真器,然后,如果什么也没发生,离开在第二个模拟器上开始另一个运行,有时候会有这个技巧。一般来说,adt模拟器很糟糕,但我的建议是得到一个便宜的android手机。

+0

感谢您的回复Kangoroo :):D – Nomade

0

有时应用程序图标不会显示在模拟器中。您可以尝试下列选项之一:

  1. 打开仿真器,尝试在相同的仿真器中再次启动应用程序。

  2. 清理所有项目,并尝试擦除模拟器中的所有数据(选项应该在AVD管理器中),然后构建您将需要测试的唯一项目。应用程序图标应该在模拟器的DEFINITELY中。

  3. 模拟器配置低。没有高端仿真器配置。我读为500 MB RAM和64 VM堆。内部存储应该是200.在英特尔处理器上运行它最近的Android版本而不是ARM处理器。如果您尚未在Bios中启用虚拟化,您将在控制台中收到Hex错误。但是,不要为此烦恼。如果你仍然觉得你需要知道,你可以检查以前回答的问题。

让我知道,如果这个工程。我遇到了问题,上述解决方案中的一个解决了它!

谢谢!

+0

感谢您的回复,第一个解决方案不起作用。第二次,我关闭了所有其他项目,它不工作!我不明白“清理所有项目”的含义 – Nomade

+1

在Eclipse中,取消选中项目菜单中的自动生成选项。然后选择Project-> Clean Project,在出现的窗口中,只选择您想要清理的项目并构建选定的项目。但是之前或之前,请注意擦除模拟器中的所有用户数据或更好地启动新的设备模拟器,然后尝试在该模拟器中执行您的项目。 – Mannii88

+0

@nomade增加了第三个选项......你能否也请检查一下..? – Mannii88

0
  1. 您是否正在寻找正确的AVD - ?

  2. 你可以检查项目是否存在问题。检查 “问题” 视图

    窗口 - >显示视图 - >问题或窗口 - >显示视图 - >其他 - >问题

  3. 尝试修复了Android特性:右键单击项目 - > Android的工具 - >修复项目属性

 

By cleaning project it means select 
Steps: 
    1. Select the menu Project->Clean 
    2. Build Project: Project -> Build 
+0

我做到了。仍然有这个消息红色时,我在模拟器上的应用程序: [2013-09-05 16:34:27 - phonegape测试]没有启动器活动发现! [2013-09-05 16:34:27 - phonegape-test]此次推出只会同步设备上的应用程序包! – Nomade

相关问题