在Android Studio中合并清单文件时面对错误



我在项目中添加了Paytm SDK,现在我正面临合并清单文件的问题,因为库有自己的清单文件。

所以我得到

> Error:Execution failed for task ':app:processDebugManifest'.
> Manifest merger failed : Attribute application@icon value=(@mipmap/logo) from AndroidManifest.xml:19:9-42
    is also present at [com.paytm.pgsdk:pgsdk:1.0.6] AndroidManifest.xml:12:9-45 value=(@drawable/ic_launcher).
    Suggestion: add 'tools:replace="android:icon"' to <application> element at AndroidManifest.xml:16:5-178:19 to override.

但是在添加工具:replact =" Android:icon" 中,我的应用程序标签中,我的应用程序在运行时崩溃了以下例外。

引起的:java.lang.illegalstateException:您需要使用 theme.AppCompat主题(或后代(与此活动。

这是我的清单文件。

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="com.example.demo">
<application
    android:name="android.support.multidex.MultiDexApplication"
    android:allowBackup="true"
    tools:replace="android:icon"
    android:icon="@mipmap/login_logo"
    android:label="@string/app_name"
    android:largeHeap="true"
    android:supportsRtl="true"
    android:theme="@style/AppTheme">
    .
    .
    .
    </application>

只需从您的应用程序清单中删除icon="@mipmap/login_logo"theme="@style/AppTheme",然后使用您的应用徽标替换Paytm SDK中的可绘制的IC_Launcher,那将做到。

应用程序将合并两种清单,您将获得所需的主题,徽标将从Paytm的清单中获取,因此您将用您的IC_Launcher替换他们的IC_Launcher。

最后,我通过从SDK中删除Apptheme的样式来解决该主题问题。

最新更新