AAPT2 错误:检查日志以获取详细信息:未知元素 <action>成立 [英] AAPT2 error: check logs for details: unknown element <action> found

查看:23
本文介绍了AAPT2 错误:检查日志以获取详细信息:未知元素 <action>成立的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是我的 debug\AndroidManifest.xml

出现很多错误,比如

此处不允许元素操作.
此处不允许使用元素类别.
此处不允许使用 android:versionCode 属性.
此处不允许使用 android:versionName 属性.
此处不允许使用 android:theme 属性.和这么多.

Element action is not allowed here.
Element category is not allowed here.
Attribute android:versionCode is not allowed here.
Attribute android:versionName is not allowed here.
Attribute android:theme is not allowed here. and so many.

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

        <uses-sdk
            android:minSdkVersion="16"
            android:targetSdkVersion="26" />

        <uses-permission android:name="android.permission.INTERNET" />
        <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />

        <application
            android:allowBackup="true"
            android:debuggable="true"
            android:icon="@drawable/logo_remaking2"
            android:label="@string/label"
            android:supportsRtl="true"
            android:theme="@style/AppTheme" >
            <activity
                android:name="com.company.sqh.adio.MainActivity"
                android:icon="@drawable/logo_remaking2" >
                <intent-filter>
                    <action android:name="android.intent.action.MAIN" />

                    <category android:name="android.intent.category.LAUNCHER" />
                </intent-filter>
            </activity>
            <activity android:name="com.company.sqh.adio.registraion_form" >
                <intent-filter>
                    <action android:name="com.company.sqh.adio.registraion_form" />

                    <category android:name="android.intent.category.DEFAULT" />
                </intent-filter>
            </activity>
            <activity android:name="com.company.sqh.adio.contact_us" >
                <intent-filter>
                    <action android:name="com.company.sqh.adio.contact_us" />

                    <category android:name="android.intent.category.DEFAULT" />
                </intent-filter>
            </activity>
            <activity android:name="com.company.sqh.adio.about_us" >
                <intent-filter>
                    <action android:name="com.company.sqh.adio.about_us" />

                    <category android:name="android.intent.category.DEFAULT" />
                </intent-filter>
            </activity>
            <activity android:name="com.company.sqh.adio.ProfileActivity" />

            <action android:name="com.company.sqh.adio.ProfileActivity" />

            <category android:name="android.intent.category.DEFAULT" />

            <activity android:name="com.company.sqh.adio.EmplyReg" />
            <activity android:name="com.company.sqh.adio.SubCategory" />
            <activity android:name="com.company.sqh.adio.User_Profile" />
            <activity android:name="com.company.sqh.adio.Emp_list" />
            <activity android:name="com.company.sqh.adio.Forgot_Pass" />

            <meta-data
                android:name="android.support.VERSION"
                android:value="26.1.0" /> <!-- Include the AdActivity and InAppPurchaseActivity configChanges and themes. -->
            <activity
                android:name="com.google.android.gms.ads.AdActivity"
                android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize"
                android:theme="@android:style/Theme.Translucent" />
            <activity
                android:name="com.google.android.gms.ads.purchase.InAppPurchaseActivity"
                android:theme="@style/Theme.IAPTheme" />
            <activity
                android:name="com.google.android.gms.common.api.GoogleApiActivity"
                android:exported="false"
                android:theme="@android:style/Theme.Translucent.NoTitleBar" />

            <meta-data
                android:name="com.google.android.gms.version"
                android:value="@integer/google_play_services_version" />
            <meta-data
                android:name="android.arch.lifecycle.VERSION"
                android:value="27.0.0-SNAPSHOT" />
        </application>

    </manifest>

请检查这个

推荐答案

AndroidManifest.xml:15:错误:发现未知元素.

AndroidManifest.xml:15: error: unknown element found.

标签放错了位置.

为了改进增量资源处理,Android 插件 3.0.0 默认启用 AAPT2.在之前版本的 AAPT 中,嵌套在 Android 清单中错误节点中的元素要么被忽略,要么导致警告.
要解决此问题,请确保您的清单元素嵌套正确.如需了解详情,请阅读清单文件结构.

To improve incremental resource processing, Android plugin 3.0.0 enables AAPT2 by default. In previous versions of AAPT, elements nested in incorrect nodes in the Android manifest are either ignored or result in a warning.
To resolve the issue, make sure your manifest elements are nested correctly. For more information, read Manifest file structure.

您必须修改您的清单:

 <action android:name="com.company.sqh.adio.ProfileActivity" />         
 <category android:name="android.intent.category.DEFAULT" />

它们应该包含在 标签中.

They should be included inside an <activity> tag.

您可以在此处阅读更多信息.

这篇关于AAPT2 错误:检查日志以获取详细信息:未知元素 &lt;action&gt;成立的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆