Eclipse上的Android手机间隙应用程序

时间:2012-06-28 13:22:38

标签: android cordova

  

可能重复:
  adding jquery.min.js file to phonegap eclipse application

我一直在尝试使用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的建议

Activity.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);
}
}

的Manifest.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!

2 个答案:

答案 0 :(得分:1)

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

如果不起作用,请使用您的活动代码以及AndroidManifest.xml的内容更新您的问题。

答案 1 :(得分:1)

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

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