0

可能重复:
将 jquery.min.js 文件添加到 phonegap eclipse 应用程序

我一直在尝试使用 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!
4

2 回答 2

1

那个wiki可能已经过时了。按照此网址获取有关在 Android 上设置您的第一个应用程序的说明:

http://docs.phonegap.com/en/1.8.1/guide_getting-started_android_index.md.html#Getting%20Started%20with%20Android

于 2012-06-28T14:00:23.127 回答
1

您的项目似乎没有启动器活动。如果您在创建项目时没有创建活动,则可能会发生这种情况 - 可能是您忘记选中“创建活动”复选框。请确认您正在创建活动。

如果这不起作用,请使用您的活动代码以及AndroidManifest.xml.

于 2012-06-28T13:57:16.937 回答