环境

AS 3.1.4

情形

类中创建了一个继承自Application的类,并在AndroidManifest.xml注册。编译报错,提示"Suggestion: add ‘tools:replace=“android:name”’ to element at AndroidManifest.xml"

查找原因

通过网络搜索,找到android:icon,android:theme等相似问题的解决方法,确定问题原因是module中同样有一个继承自Application的类。

解决方法

AndroidManifest.xml的根标签下加上 xmlns:tools="http://schemas.android.com/tools",然后在application标签下加入tools:replace="android:name"。如下所示

<manifest xmlns:android="http://schemas.android.com/apk/res/android"         xmlns:tools="http://schemas.android.com/tools"         package="com.**">   <application android:name="com.**.App"                android:allowBackup="true"                android:icon="@mipmap/app_icon"                android:label="@string/app_name"                android:supportsRtl="true"                android:theme="@style/AppTheme"                tools:replace="android:name">   application>manifest>

更多相关文章

  1. android中include标签的使用
  2. 【Android】application标签说明
  3. android中application标签说明
  4. Android studio 启动出现错误AAPT: error: resource android:att
  5. 相对布局RelativeLayout的妙用:提示标签在输入框内
  6. android流式布局热门标签的实现

随机推荐

  1. Android(安卓)System Property
  2. 【Android】listview选中行字体变大
  3. Android(安卓)manifest文件中的标签详细
  4. Android中Looper的实现原理
  5. [置顶] Android的monkey测试
  6. Android数据库之SQLite数据库zz
  7. Android(安卓)ApiDemos示例解析(77):Grap
  8. [置顶] android webview 更改显示的分辨
  9. Android各种信息的显示
  10. Android基于SOAP标准调用Webservice实现