我一直在尝试使用 Eclipse 设置和运行我的第一个 Phone Gap 应用程序。这是我正在关注的教程(http://wiki.phonegap.com/w/page/34483744/PhoneGap-Eclipse-PlugIn-for-Android)。但这似乎不起作用。当我启动应用程序时没有任何反应,下面是控制台输出
[2012-06-28 16:14:05 - MyProjectName] ------------------------------
[2012-06-28 16:14:05 - MyProjectName] Android Launch!
[2012-06-28 16:14:05 - MyProjectName] adb is running normally.
[2012-06-28 16:14:05 - MyProjectName] No Launcher activity found!
[2012-06-28 16:14:05 - MyProjectName] The launch will only sync the application package on the device!
[2012-06-28 16:14:05 - MyProjectName] Performing sync
[2012-06-28 16:14:05 - MyProjectName] Automatic Target Mode: using existing emulator 'emulator-5554' running compatible AVD 'AVD15'
[2012-06-28 16:14:08 - MyProjectName] Application already deployed. No need to reinstall.
[2012-06-28 16:14:08 - MyProjectName] \MyProjectName\bin\MyProjectName.apk installed on device
[2012-06-28 16:14:08 - MyProjectName] Done!
已编辑:根据 Rajesh 的建议,选中“创建活动”复选框后的文件和控制台
活动.java
package my.com.phonegap;
import android.app.Activity;
import android.os.Bundle;
public class MyPhonePrjActivity extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
}
}
清单.XML
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="my.com.phonegap"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk android:minSdkVersion="15" />
<application
android:icon="@drawable/ic_launcher"
android:label="@string/app_name" >
<activity
android:name=".MyPhonePrjActivity"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
控制台输出
[2012-06-28 17:54:26 - MyPhonePrj] ------------------------------
[2012-06-28 17:54:26 - MyPhonePrj] Android Launch!
[2012-06-28 17:54:26 - MyPhonePrj] adb is running normally.
[2012-06-28 17:54:26 - MyPhonePrj] Performing my.com.phonegap.MyPhonePrjActivity activity launch
[2012-06-28 17:54:26 - MyPhonePrj] Automatic Target Mode: launching new emulator with compatible AVD 'AVD15'
[2012-06-28 17:54:26 - MyPhonePrj] Launching a new emulator with Virtual Device 'AVD15'
[2012-06-28 17:54:39 - Emulator] emulator: emulator window was out of view and was recentered
[2012-06-28 17:54:39 - Emulator]
[2012-06-28 17:54:39 - HelloAndroid] New emulator found: emulator-5554
[2012-06-28 17:54:39 - HelloAndroid] Waiting for HOME ('android.process.acore') to be launched...
[2012-06-28 17:54:47 - Emulator] NAND: nand_dev_load_disk_state ftruncate failed: Invalid argument
[2012-06-28 17:54:47 - Emulator] savevm: unable to load section nand_dev
[2012-06-28 18:01:23 - HelloAndroid] HOME is up on device 'emulator-5554'
[2012-06-28 18:01:23 - HelloAndroid] Uploading HelloAndroid.apk onto device 'emulator-5554'
[2012-06-28 18:01:23 - HelloAndroid] Installing HelloAndroid.apk...
[2012-06-28 18:03:34 - HelloAndroid] Failed to install HelloAndroid.apk on device 'emulator-5554!
[2012-06-28 18:03:34 - HelloAndroid] (null)
[2012-06-28 18:03:35 - HelloAndroid] Launch canceled!