【问题标题】:Manifest Merger Error on Android StudioAndroid Studio 上的清单合并错误
【发布时间】:2017-06-06 18:44:00
【问题描述】:

我基本上是在尝试从一项活动转移到一项谷歌地图活动。 我将 MapsActivity 文件添加到清单文件中,如下所示:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="mahboob.cmec">

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

    <!--
         The ACCESS_COARSE/FINE_LOCATION permissions are not required to use
         Google Maps Android API v2, but you must specify either coarse or fine
         location permissions for the 'MyLocation' functionality. 
    -->
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />

    <application
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:supportsRtl="true"
        android:theme="@style/AppTheme">
        <activity android:name=".MainActivity">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
        <activity android:name=".menu" />
        <activity android:name=".Reference" />
        <activity android:name=".Registration" />
        <activity android:name=".RegistrationComplete" />
        <activity android:name=".electricitybill" />
        <activity android:name=".GasBill" />
        <activity android:name=".BillReport" />
        <activity android:name=".SetTarget" />
        <activity android:name=".EcoReport" />
        <activity android:name=".MapsActivity" />
        <activity android:name=".ManageContract" />
        <activity android:name=".GraphReport" />

        <!--
             The API key for Google Maps-based APIs is defined as a string resource.
             (See the file "res/values/google_maps_api.xml").
             Note that the API key is linked to the encryption key used to sign the APK.
             You need a different API key for each encryption key, including the release key that is used to
             sign the APK for publishing.
             You can define the keys for the debug and release targets in src/debug/ and src/release/. 
        -->
        <meta-data
            android:name="com.google.android.geo.API_KEY"
            android:value="@string/google_maps_key" />

        <activity
            android:name=".MapsActivity"
            android:label="@string/title_activity_maps"></activity>
    </application>

</manifest>

当我运行代码时,我得到以下输出:

错误:任务“:app:processDebugManifest”执行失败。
> 清单合并失败并出现多个错误,请参阅日志

我不确定问题是什么,我认为我需要将 MapsActivity 类添加到我已经完成的清单文件中。

输出: 信息:Gradle 任务 [:app:clean, :app:generateDebugSources, :app:generateDebugAndroidTestSources, :app:mockableAndroidJar, :app:prepareDebugUnitTestDependencies, :app:assembleDebug] :app:clean :app:preBuild UP-TO-DATE :app:preDebugBuild UP-TO-DATE :app:checkDebugManifest :app:preReleaseBuild UP-TO-DATE :app:prepareComAndroidSupportAnimatedVectorDrawable2340Library :app:prepareComAndroidSupportAppcompatV72340Library :app:prepareComAndroidSupportMediarouterV72200Library :app:prepareComAndroidSupportSupportV42340Library :app:prepareComAndroidSupportSupportVectorDrawable2340Library :app:prepare ComBasgeekballAwesomeValidation13Library :app:prepareComGoogleAndroidGmsPlayServices750Library :app:prepareComGoogleAndroidGmsPlayServicesAds750Library :app:prepareComGoogleAndroidGmsPlayServicesAnalytics750Library :app:prepareComGoogleAndroidGmsPlayServicesAppindexing750Library :app:prepareComGoogleAndroidGmsPlayServicesAppinvite750Library :app:prepareComGoogleAndroidGmsPlayServicesAppstate750Library :app:prepareComGoogleAndroidGmsPlayServicesBase750Library :app:prepare ComGoogleAndroidGmsPlayServicesCast750Library :app:prepareComGoogleAndroidGmsPlayServicesDrive750Library :app:prepareComGoogleAndroidGmsPlayServicesFitness750Library :app:prepareComGoogleAndroidGmsPlayServicesGames750Library :app:prepareComGoogleAndroidGmsPlayServicesGcm750Library :app:prepareComGoogleAndroidGmsPlayServicesIdentity750Library :app:prepareComGoogleAndroidGmsPlayServicesLocation750Library :app:prepareComGoogleAndroidGmsPlayServicesMaps750Library :app:prepareComGoogleAndroidGmsPlayServicesNearby750Library :app:prepareComGoogleAndroidGmsPlayServicesPanorama750Library :app:prepareComGoogleAndroidGmsPlayServicesPlus750Library :app:prepareComGoogleAndroidGmsPlayServicesSafetynet750Library :app:prepareComGoogleAndroidGmsPlayServicesWallet750Library :app:prepareComGoogleAndroidGmsPlayServicesWearable750Library :app:prepare ComMcxiaokeVolleyLibraryAar100Library :app:prepareComNumetriclabzNumandroidchartsNumandroidcharts103Library :app:prepareDebugDependencies :app:compileDebugAidl :app:compileDebugRenderscript :app:generateDebugBuildConfig :app:mergeDebugShaders :app:compileDebugShaders :app:generateDebugAssets :app:mergeDebugAssets :app:generateDebugResValues 最新 :app:generateDebugResources :app:mergeDebugResources :app:processDebugManifest C:\Users\User\Pictures\work\CMEC26\CMEC16\CMEC14\CMEC\app\src\main\AndroidManifest.xml:52:9-54:68 错误: AndroidManifest.xml:52:9-54:68 中的元素 activity#mahboob.cmec.MapsActivity 与 AndroidManifest.xml:36:9-50 中声明的元素重复 C:\Users\User\Pictures\work\CMEC26\CMEC16\CMEC14\CMEC\app\src\main\AndroidManifest.xml 错误: 验证失败,退出 有关清单合并的更多信息,请参阅 http://g.co/androidstudio/manifest-merger。 :app:processDebugManifest 失败 错误:任务“:app:processDebugManifest”执行失败。 > 清单合并失败并出现多个错误,请参阅日志 信息:构建失败 信息:总时间:54.528 秒 信息:1个错误 信息:0 个警告 信息:在控制台中查看完整的输出

【问题讨论】:

  • 你能发布日志吗?您可以在 Android Studio 底部的 Android Monitor 选项卡中找到它们。

标签: android


【解决方案1】:

首先,您可以尝试清理项目然后构建。如果问题没有解决,您可以尝试第二个选项。

其次,这是 Android 开发的一般错误。如果找不到错误,则必须查看 Gradle 控制台信息。但是默认的 gradle 控制台信息很接近。你需要打开它。

  1. 文件->设置
  2. 构建、执行、部署 -> 编译器
  3. --stacktrace --debug -> 写入命令行选项
  4. 好的

然后你可以看看 gradle 控制台。您将看到更多信息。您可以在此处检测错误。

【讨论】:

  • 使用 --stacktrace --debug --scan 获得完整的见解。
  • 是的,可以使用扫描命令,但它会产生一些垃圾冗长,因此可能难以阅读
【解决方案2】:

清单中有两个MapsActivity。删除其中一个。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2020-01-01
    • 1970-01-01
    • 2018-03-20
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多