android studio 引入arr的问题

1.合并AndroidManifest错误

D:\AndroidStudioProjects\androidrongflysip\rongflymqtt\src\main\AndroidManifest.xml:96:9-45 Error:
Attribute application@icon value=(@drawable/ic_launcher) from AndroidManifest.xml:96:9-45
is also present at [:app-debug:] AndroidManifest.xml:29:9-50 value=(@mipmap/ic_launcher_circle).
Suggestion: add 'tools:replace="android:icon"' to <application> element at AndroidManifest.xml:93:5-1486:19 to override.
See http://g.co/androidstudio/manifest-merger for more information about the manifest merger.
:rongflymqttrocessDevDebugManifest FAILED
Error:Execution failed for task ':rongflymqttrocessDevDebugManifest'.
> Manifest merger failed : Attribute application@icon value=(@drawable/ic_launcher) from AndroidManifest.xml:96:9-45
is also present at [:app-debug:] AndroidManifest.xml:29:9-50 value=(@mipmap/ic_launcher_circle).
Suggestion: add 'tools:replace="android:icon"' to <application> element at AndroidManifest.xml:93:5-1486:19 to override.


AS的Gradle插件默认会启用Manifest Merger Tool,若Library项目中也定义了与主项目相同的属性(例如默认生成的android:icon和android:theme),则此时会合并失败,并报上面的错误。java

解决办法有2种android

方法1: 在Manifest.xml的application标签下添加tools:replace="android:icon, android:theme"(多个属性用,隔开,而且记住在manifest根标签上加入xmlns:tools="http://schemas.android.com/tools",不然会找不到namespace哦)app

多个冲突这么写 ide

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

 

再同步Gradle,问题解决。ui

 

2.android xml 命名空间错误

这种自动查找的写法,可能会报spa

No resource identifier found for attribute 'srcCompat' in package 'com.feinno.rongfly'
E:\fetionworkspace\androidrongflysip\rongflymqtt\build\intermediates\exploded-aar\publibrary-debug\res\layout\z_recyclerview.xml

这是由于自动查找会找当前包下的命名空间,会找到主端的包名下。插件

因此引入的库aar须要直接命名成本身的包名debug

3.主题设置问题

若是使用了 v7的一些空间,而项目主题没有使用v7的主题则会报code

Caused by: android.view.InflateException: Binary XML file line #13: Error inflating class android.support.v7.widget.CardView

改为v7的主题就能够了

相关文章
相关标签/搜索