Suggestion: add 'tools:replace="android:value"' to <meta-data> element at AndroidManifest.xml:25:5-2...

记录下来少走些坑吧

一:不管用
tools:replace="android:icon,android:theme"
xmlns:tools="http://schemas.android.com/tools"
二:(不管用)

defaultConfig 中添加 multiDexEnabled true

三 (不管用)

在build.gradle根标签上加上useOldManifestMerger true (懒人方法)

四 (不管用)
    1. <meta-data android:name="UMENG_APPKEY" android:value="*****"
五:(不管用)
<user-sdk tools:overrideLibrary="自己需要强制替换的库"/>

六:试图将版本号改成一致的,可是jar包中的根本不能改

七:(解决了)
//Suggestion: add 'tools:replace="android:value"' to <meta-data> element at AndroidManifest.xml:25:5-27:41 to override.
configurations.all {
resolutionStrategy.eachDependency { DependencyResolveDetails details ->
def requested = details.requested
if (requested.group == 'com.android.support') {
if (!requested.name.startsWith("multidex")) {
details.useVersion '25.3.0'
}
}
}
}
Android 开发中,解决 AndroidManifest.xml 文件应用主题属性冲突,即 `Attribute application@theme value=(@style/Theme.MyBase)` 与 `[liji.library.dev:citypickerview:3.1.1] AndroidManifest.xml` 中的 `@style/AppTheme` 冲突,可采用以下方法: #### 方法一:使用 `tools:replace` 属性 在主项目的 `AndroidManifest.xml` 中加入 `xmlns:tools="http://schemas.android.com/tools"`,然后在 `<application>` 标签中使用 `tools:replace` 属性来替换冲突的主题属性。示例代码如下: ```xml <manifest package="xxx" xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools"> <application android:name=".App" android:allowBackup="true" android:icon="@mipmap/ic_launcher" android:label="@string/app_name" android:networkSecurityConfig="@xml/network_https_config" android:roundIcon="@mipmap/ic_launcher_round" android:supportsRtl="true" android:theme="@style/Theme.MyBase" tools:replace="android:theme"> <!-- 其他组件 --> </application> </manifest> ``` 这样可以确保主项目的主题覆盖第三方库的主题。 #### 方法二:统一主题 将主项目和第三方库的主题统一。可以在 `styles.xml` 中定义一个新的主题,让主项目和第三方库都使用这个主题。例如: ```xml <style name="AppTheme" parent="Theme.MyBase"> <!-- 可以在这里添加其他样式属性 --> </style> ``` 然后在主项目的 `AndroidManifest.xml` 中设置 `android:theme="@style/AppTheme"`,同时检查第三方库是否可以通过配置使用这个主题。 #### 方法三:使用 `tools:node="replace"` 在主项目的 `AndroidManifest.xml` 中使用 `tools:node="replace"` 来替换第三方库的 `<application>` 标签。示例如下: ```xml <manifest package="xxx" xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools"> <application android:name=".App" android:allowBackup="true" android:icon="@mipmap/ic_launcher" android:label="@string/app_name" android:networkSecurityConfig="@xml/network_https_config" android:roundIcon="@mipmap/ic_launcher_round" android:supportsRtl="true" android:theme="@style/Theme.MyBase" tools:node="replace"> <!-- 其他组件 --> </application> </manifest> ``` 这种方法会完全替换第三方库的 `<application>` 标签及其属性。
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符  | 博主筛选后可见
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值