Android应用程序 - AndroidManifest.xml不起作用

时间:2014-03-24 19:16:20

标签: android html xml

总是来按摩<接收器>元素必须是<的直接子元素。申请>元件即可。有没有人没有正确的代码?我想宣传LeadBolt ADS。但它比我想象的要困难哈哈。

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

    <uses-sdk
        android:minSdkVersion="14"
        android:targetSdkVersion="19" />

    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
    <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:name="com.example.testmoney.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>

        <service android:name="com.<sdpackagename>.ReEngagementService" >
        </service>
        <service android:name="com.<sdkpackagename>.AdBootReceiverService" >
        </service>

        <receiver android:name="<sdkpackagename>.ReEngagement" >
        <receiver android:name="<com.example.testmoney>.BootReceiver" >
        <intent-filter>
        <action android:name="android.intent.action.BOOT_COMPLETED" />
        </intent-filter>
        </receiver>
        </receiver>

     </application>

2 个答案:

答案 0 :(得分:1)

正确的清单是(您已将结束标记放置在错误的位置,请确保将<sdkpackagename>替换为有效名称):

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

    <uses-sdk
        android:minSdkVersion="14"
        android:targetSdkVersion="19" />

    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
    <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:name="com.example.testmoney.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>

        <service android:name="com.<sdpackagename>.ReEngagementService">
        </service>
        <service android:name="com.<sdkpackagename>.AdBootReceiverService">
        </service>

        <receiver android:name="com.<sdkpackagename>.ReEngagement">
        </receiver>
        <receiver android:name="com.example.testmoney.BootReceiver" >
            <intent-filter>
                <action android:name="android.intent.action.BOOT_COMPLETED" />
            </intent-filter>
        </receiver>


     </application>

</manifest>

答案 1 :(得分:0)

我认为问题是这四行:

    <service android:name="com.&lt;sdpackagename>.ReEngagementService" >
    </service>
    <service android:name="com.&lt;sdkpackagename>.AdBootReceiverService" >
    </service>

    <receiver android:name="&lt;sdkpackagename>.ReEngagement" >
    <receiver android:name="&lt;com.example.testmoney>.BootReceiver" >

删除每行中的&lt;和第一个>,它应该有效。

编辑:试试这个

<uses-sdk
    android:minSdkVersion="14"
    android:targetSdkVersion="19" />

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<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:name="com.example.testmoney.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>

    <service android:name="com.<sdpackagename>.ReEngagementService" >
    </service>
    <service android:name="com.<sdkpackagename>.AdBootReceiverService" >
    </service>

    <receiver android:name="<sdkpackagename>.ReEngagement" >
    </receiver>
    <receiver android:name="<com.example.testmoney>.BootReceiver" >
    <intent-filter>
    <action android:name="android.intent.action.BOOT_COMPLETED" />
    </intent-filter>
    </receiver>


 </application>