简体   繁体   English

这<activity>元素必须是<application>库清单中的元素

[英]The <activity> element must be a direct child of the <application> element In Library Manifest

I am trying to download and run https://github.com/siwangqishiq/ImageEditor-Android application.我正在尝试下载并运行https://github.com/siwangqishiq/ImageEditor-Android应用程序。 It is giving error它给出了错误

Android resource linking failed
C:\Users\salman\Desktop\work\Facemook\ImageEditor-Android-master\demo\build\intermediates\merged_manifests\debug\AndroidManifest.xml:20: error: unexpected element <activity> found in <manifest>.

When I opened file at当我打开文件时

C:\Users\salman\Desktop\work\Facemook\ImageEditor-Android-master\demo\build\intermediates\merged_manifests\debug\AndroidManifest.xml

then file's contents are然后文件的内容是

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

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

    <uses-permission android:name="android.permission.CAMERA" />
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.MOUNT_UNMOUNT_FILESYSTEMS" />

    <uses-feature
        android:name="android.hardware.camera"
        android:required="true" />

    <!-- 图片编辑Activity -->
    <activity android:name="com.xinlan.imageeditlibrary.editimage.EditImageActivity" >
    </activity>

    <application
        android:allowBackup="true"
        android:appComponentFactory="android.support.v4.app.CoreComponentFactory"
        android:debuggable="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:testOnly="true"
        android:theme="@style/Theme.AppCompat.Light.NoActionBar" >
        <activity android:name="com.xinlan.imageeditandroid.MainActivity" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>

        <!-- <activity android:name=".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=".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> -->


        <!-- &lt;!&ndash;选择相册图片Activity&ndash;&gt; -->
        <!-- <activity -->
        <!-- android:name="com.xinlan.imageeditlibrary.picchooser.SelectPictureActivity" -->
        <!-- android:screenOrientation="portrait"> -->
        <!-- </activity> -->


        <!-- &lt;!&ndash;图片编辑Activity&ndash;&gt; -->
        <!-- <activity -->
        <!-- android:name="com.xinlan.imageeditlibrary.editimage.EditImageActivity" -->
        <!-- android:screenOrientation="portrait" -->
        <!-- android:windowSoftInputMode="adjustPan"> -->
        <!-- </activity> -->

    </application>

</manifest>

As you can see this file contains <activity> outside of <application> which is causing error, but this file is merged (created by Android Studio after merging all manifest files) so I cannot (or should not) edit it.如您所见,此文件包含<activity> <application> <activity>之外的<activity>导致错误,但此文件已合并(在合并所有清单文件后由 Android Studio 创建),因此我无法(或不应)对其进行编辑。 Now contents of manifest of library module (again library module) are given below现在库模块(又是库模块)的清单内容如下

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.xinlan.imageeditlibrary" >
    <!--图片编辑Activity-->
    <activity android:name="com.xinlan.imageeditlibrary.editimage.EditImageActivity">
    </activity>
</manifest>

Here you can see real problem.在这里你可以看到真正的问题。 <activity> is outside of any <application> block. <activity>位于任何<application>块之外。 As mentioned, this manifest is of library I cannot surround with <application> .如前所述,这个清单是我不能用<application>包围的库。 How to solve it?如何解决? The <uses-permission> element must be a direct child of the <manifest> root element The <activity> element must be a direct child of the <application> element error Splash Screen Activity - The element must be a direct child of the element [WrongManifestParent] These all refer to main module manifest file, not library module manifest file. <uses-permission> 元素必须是 <manifest> 根元素直接子元素<activity> 元素必须是 <application> 元素错误的直接子元素Splash Screen Activity - 该元素必须是元素的直接子元素[WrongManifestParent]这些都是指主模块清单文件,而不是库模块清单文件。

Solved, just surround with .解决了,只需用 . ie IE

<application>
<activity></activity>
</application>

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 该 <activity> 元素必须是的直接子元素 <application> 元件 - The <activity> element must be a direct child of the <application> element 表现出多个问题,活动元素必须是直接子元素 - manifest multiple problems the activity element must be a direct child 该 <activity> 元素必须是的直接子元素 <application> 元素错误 - The <activity> element must be a direct child of the <application> element error 这<receiver>元素必须是<application>元素 - The <receiver> element must be a direct child of the <application> element 该 <uses-permission> 元素必须是直接的孩子 <manifest> 根元素 - The <uses-permission> element must be a direct child of the <manifest> root element 启动画面活动-元素必须是元素[WrongManifestParent]的直接子元素 - Splash Screen Activity - The element must be a direct child of the element [WrongManifestParent] AndroidManifest.xml-元素必须是的直接子元素 <application> 元素错误 - AndroidManifest.xml - The element must be a direct child of the <application> element error Android签名的APK构建错误: <service> 元素必须是的直接子元素 <application> 元件 - Android signed apk build error : The <service> element must be a direct child of the <application> element Flutter Android 清单意外元素<activity>在发现<manifest><application><activity></activity></application></manifest></activity> - Flutter Android Manifest unexpected element <activity> found in <manifest><application><activity> 必须声明清单元素 - Manifest element must be declared
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM