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的主題就能夠了

相關文章
相關標籤/搜索