0

当我尝试运行我的应用程序时:

No Launcher activity found!
The launch will only sync the application package on the device!

我已经阅读了有关类似问题的所有问题,我更改了manifest.xml,但每次都遇到相同的错误。我坚持了一个小时试图解决这个问题,但没有任何效果。

这是我的清单片段:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.mosbin"
android:versionCode="1"
android:versionName="1.0" >

<uses-sdk
    android:minSdkVersion="8"
    android:targetSdkVersion="17" >
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" />
    <!-- External storage for caching. -->
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
    <!-- My Location -->
    <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />

    <!-- Maps API needs OpenGL ES 2.0. -->
    <uses-feature
        android:glEsVersion="0x00020000"
        android:required="true" />

    <meta-data
        android:name="com.google.android.maps.v2.API_KEY"
        android:value="YOUR_OWN_KEY" />
    />

    <application
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme" >
        <activity
            android:name="com.example.mosbin.MainActivity"
            android:label="@string/app_name" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>

        </activity>
        <activity
            android:name="com.example.mosbin.Run"
            android:label="@string/title_activity_run"
            android:parentActivityName="com.example.mosbin" >
            <meta-data
                android:name="android.support.PARENT_ACTIVITY"
                android:value="com.example.mosbin" />
        </activity>
        <activity
            android:name=".Stats"
            android:label="@string/title_activity_stats"
            android:parentActivityName="com.example.mosbin" >
            <meta-data
                android:name="android.support.PARENT_ACTIVITY"
                android:value="com.example.mosbin" />
        </activity>
    </application>
</uses-sdk>

这段代码有什么问题?在它出现之前,我只想添加新的活动......

4

2 回答 2

3

</uses-sdk > 在清单末尾清除此标记并更改此标记

<uses-sdk
        android:minSdkVersion="8"
        android:targetSdkVersion="17" > missing / here

至 :

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

也将这些放入您的应用程序标签中:

<meta-data
            android:name="com.google.android.maps.v2.API_KEY"
            android:value="YOUR_OWN_KEY" />

https://developers.google.com/maps/documentation/android/start

检查将 API 密钥添加到您的应用程序下的链接和主题

于 2013-05-11T14:46:08.540 回答
1

这就是你的清单应该是这样的:

请注意各种标签是如何打开和关闭的。并在需要的地方嵌套。

另外,请阅读Android Manifest Docs。这将确保将来不会出现混乱。;-)

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.mosbin"
    android:versionCode="1"
    android:versionName="1.0" >

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

    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" />
    <!-- External storage for caching. -->
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
    <!-- My Location -->
    <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />

    <!-- Maps API needs OpenGL ES 2.0. -->
    <uses-feature
        android:glEsVersion="0x00020000"
        android:required="true" />

    <meta-data
        android:name="com.google.android.maps.v2.API_KEY"
        android:value="YOUR_OWN_KEY" />


    <application
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme" >
        <activity
            android:name="com.example.mosbin.MainActivity"
            android:label="@string/app_name" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
        <activity
            android:name="com.example.mosbin.Run"
            android:label="@string/title_activity_run"
            android:parentActivityName="com.example.mosbin" >
            <meta-data
                android:name="android.support.PARENT_ACTIVITY"
                android:value="com.example.mosbin" />
        </activity>
        <activity
            android:name=".Stats"
            android:label="@string/title_activity_stats"
            android:parentActivityName="com.example.mosbin" >
            <meta-data
                android:name="android.support.PARENT_ACTIVITY"
                android:value="com.example.mosbin" />
        </activity>
    </application>

</manifest>
于 2013-05-11T14:47:22.443 回答