manifest.xml中label应用名报错

Error:Execution failed for task ':app:processDebugManifest'.
> Manifest merger failed : Attribute application@label value=(@string/app_name) from AndroidManifest.xml:18:9-42
    is also present at [org.litepal.android:core:1.6.0] AndroidManifest.xml:13:9-41 value=(@string/app_name).
    Suggestion: add 'tools:replace="android:label"' to <application> element at AndroidManifest.xml:14:5-67:19 to override.

这个错误是因为你导入的一些第三方的库定义了与主项目相同的属性。 
上面的提示就是litepal这个库和主项目AndroidManifest文件中的label属性有冲突。而且提示用也给出了解决的方法就是在AndroidManifestapplication节点下加上tools:replace="android:label"

 <application
        android:name=".base.MyApplication"
        android:allowBackup="true"
        android:icon="@mipmap/logo_128"
        android:label="@string/app_name"
        android:screenOrientation="portrait"
        android:supportsRtl="true"
        android:theme="@style/Theme.AppCompat.Light.NoActionBar"
        tools:replace="android:icon, android:label, android:theme">
        ...
    </application>

如果加上之后,可以编译了,但是APP的名字还是使用了第三方库中的app_name,我们可以这样解决,在自己的strings.xml中将app_name换一下,比如换成app_name_

<string name="app_name_">移动APP</string>

然后清单文件就如下了

 <application
        android:name=".base.MyApplication"
        android:allowBackup="true"
        android:icon="@mipmap/logo_128"
        android:label="@string/app_name_"
        android:screenOrientation="portrait"
        android:supportsRtl="true"
        android:theme="@style/Theme.AppCompat.Light.NoActionBar"
        tools:replace="android:icon, android:label, android:theme">
        ...
    </application>

这样再运行就能用回自己的命名了。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值