我正在尝试将应用程序添加到我的清单,但收到并收到错误:attribute Android: name is not allowed here
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.test.app" >
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:screenOrientation="portrait"
android:name="com.test.app.activity.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>
<meta-data android:name="com.google.android.gms.version"
android:value="@integer/google_play_services_version" />
</application>
<application
android:name="com.test.app.connection.AppController" <--- problem
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<!-- all activities and other stuff -->
</application>
</manifest>
答案 0 :(得分:1)
属性Android:此处不允许使用名称
因为您尝试在application
标记内添加application
标记AndroidManifest.xml
只允许使用单个application
标记,其中包含其他应用程序组件,如Activities,Services,BroadcastReceiver,...
请删除第二个application
代码,并在name
个icon
中添加application
, <application
android:name="com.test.app.connection.AppController"
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<!-- add application components here -->
</application>
,...等所有属性:
{{1}}
答案 1 :(得分:1)
http://developer.android.com/guide/topics/manifest/manifest-intro.html
如上所示,您的应用程序只能有一个应用程序标记,尽可能多地使用Android文档!最好!
答案 2 :(得分:0)
将android:name属性添加到清单文件中的现有应用程序标记
android:name="com.test.app.connection.AppController"