Android Studio報:“Attribute application@theme or @ icon ”問題的解決
前言
Android Studio是Google開發(fā)的一款面向Android開發(fā)者的IDE,支持Windows、Mac、Linux等操作系統(tǒng),基于流行的Java語言集成開發(fā)環(huán)境IntelliJ搭建而成。
發(fā)現(xiàn)問題
最近在做項目的時候需要導(dǎo)入第三方庫時碰到這個問題
Error:Execution failed for task ':app:processDebugManifest'. > Manifest merger failed : Attribute application@theme value=(@style/AppTheme.NoActionBar) from AndroidManifest.xml:21:9-52is also present at [MyChaass:mymusic:unspecified] AndroidManifest.xml:17:9-40 value=(@style/AppTheme).Suggestion: add'tools:replace="android:theme"' to <application> element at AndroidManifest.xml:15:5-37:19 to override.
原因是我們的主項目中默認(rèn)會定義了 android:icon=""
,當(dāng)我們引入的第三方庫中也定義
了這種標(biāo)簽的時候,二者合并失敗就會出現(xiàn)此問題。
解決方法
解決辦法是在 <application>
標(biāo)簽中 添加 tools:replace="android:icon"
.
首先要在 <manifest>
標(biāo)簽中增加一個 tools 的命名空間 :
xmlns:tools=http://schemas.android.com/tools
與此相同的問題還有 theme ,解決辦法同樣是增加 tools:replace="android:theme"
,
不過當(dāng)二者都合并失敗時,中間應(yīng)該用","隔開 :
tools:replace="android:icon,android:theme"
manifest文件:
<application android:allowBackup="true" android:icon="@mipmap/christ_icon" android:label="@string/app_name" android:supportsRtl="true" android:name=".App" tools:replace="android:icon,android:theme" //加這句即可 android:theme="@style/AppTheme.NoActionBar"> </application>
增 加 以上代碼 即可解決問題。
總結(jié)
以上就是這篇文章的全部內(nèi)容了,希望本文的內(nèi)容對大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價值,如果有疑問大家可以留言交流,謝謝大家對腳本之家的支持。
- Android Studio 報錯failed to create jvm error code -4的解決方法
- 詳解Androidstudio3.0 關(guān)于Gradle報錯的問題(小結(jié))
- Android Studio啟動報錯Java 1.8 or later is required的解決方法
- Android Studio 報錯“app:processDebugResources"解決方法
- Android Studio報錯Manifest merger failed with multiple errors
- 解決Android studio 2.3升級到Android studio 3.0 后apt報錯問題
相關(guān)文章
Android中實現(xiàn)滑動的七種方式總結(jié)
這篇文章主要介紹了Android中實現(xiàn)滑動的七種方式總結(jié),具有一定的參考價值,感興趣的小伙伴們可以參考一下。2017-02-02Android基于TextView實現(xiàn)跑馬燈效果
這篇文章主要為大家詳細(xì)介紹了Android基于TextView實現(xiàn)跑馬燈效果的相關(guān)資料,具有一定的參考價值,感興趣的小伙伴們可以參考一下2017-03-03android輕量級無侵入式管理數(shù)據(jù)庫自動升級組件
這篇文章主要為大家介紹了android輕量級無侵入式管理數(shù)據(jù)庫自動升級組件詳解,有需要的朋友可以借鑒參考下,希望能夠有所幫助,祝大家多多進(jìn)步,早日升職加薪2023-02-02Android在不使用數(shù)據(jù)庫的情況下存儲數(shù)據(jù)的方法
這篇文章主要介紹了Android在不使用數(shù)據(jù)庫的情況下存儲數(shù)據(jù)的方法,涉及Android存儲數(shù)據(jù)的相關(guān)技巧,需要的朋友可以參考下2015-04-04Flutter使用RepositoryProvider解決跨組件傳值問題
在實際開發(fā)過程中,經(jīng)常會遇到父子組件傳值的情況。本文將利用RepositoryProvider解決跨組件傳值的問題,感興趣的小伙伴可以了解一下2022-04-04listview與SQLite結(jié)合實現(xiàn)記事本功能
這篇文章主要為大家詳細(xì)介紹了listview與SQLite結(jié)合實現(xiàn)記事本功能,具有一定的參考價值,感興趣的小伙伴們可以參考一下2017-12-12