当我尝试运行我的应用时:
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>
这段代码有什么问题? 在它出现之前我只是想添加新活动......
答案 0 :(得分:3)
&LT; / uses-sdk&gt;清除清单末尾的此标记并更改此
<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密钥添加到您的应用程序
下的链接和主题答案 1 :(得分:1)
这就是你的Manifest应该是这样的:
请注意各种标签的打开和关闭方式。并在必要时嵌套。
另外,请阅读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>