运行第一个Android应用程序的问

时间:2014-06-27 22:20:41

标签: android eclipse

我正在阅读developer.android.com上的教程,并且我已经达到了要求我运行程序的程度。我右键单击项目资源管理器中的项目,然后运行as并单击android应用程序。控制台显示以下内容

[2014-06-27 15:15:23 - myFirstApp] Android Launch!
[2014-06-27 15:15:23 - myFirstApp] adb is running normally.
[2014-06-27 15:15:23 - myFirstApp] No Launcher activity found!
[2014-06-27 15:15:23 - myFirstApp] The launch will only sync the application package on the device!
[2014-06-27 15:15:23 - myFirstApp] Performing sync
[2014-06-27 15:15:23 - myFirstApp] Automatic Target Mode: Unable to detect device compatibility. Please select a target device.

如果你需要查看androidmanifest.xml文件,那么它就是

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.myfirstapp"
    android:versionCode="1"
    android:versionName="1.0" >

    <uses-sdk
        android:minSdkVersion="8"
        android:targetSdkVersion="21" />

    <application
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme" >
    </application>

</manifest>

1 个答案:

答案 0 :(得分:1)

您缺少活动代码,如:

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.myfirstapp"
    android:versionCode="1"
    android:versionName="1.0" >

    <uses-sdk
        android:minSdkVersion="8"
        android:targetSdkVersion="21" />

    <application
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme" >

    ***<activity
        android:name="com.example.myfirstapp.YourActivity"
        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>