Android Studio tools:replace的使用

一般是项目中使用的第三方依赖库中的AndroidManifest.xml中跟当前app的AndroidManifest.xml中有重复的某些属性时AS会提示这个,其实你按照他的提示添加就可以解决了,这里只是记录一下。

如三方的依赖中application标签添加了android:theme, android:label可以在当前app中添加:

<application
        android:name=".App"
        android:allowBackup="true"
        android:icon="@drawable/app_icon"
        android:label="@string/app_name"
        android:theme="@style/AppTheme"
        tools:replace="android:theme, android:label">

需要导入tools命名:

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
          xmlns:tools="http://schemas.android.com/tools"
          package="com.bcoder.app">

也可以对activity标签的属性进行替换:

<activity
    android:name=".CaptureActivity"
    android:screenOrientation="portrait"
    tools:replace="screenOrientation" />

发布了96 篇原创文章 · 获赞 57 · 访问量 11万+

猜你喜欢

转载自blog.csdn.net/lyabc123456/article/details/93901780