LoginSignup
4
6

More than 5 years have passed since last update.

Androidのビルド時にライブラリのthemeとコンフリクトしたときの対処法

Last updated at Posted at 2015-03-19

とあるライブラリを組み込んだとき、ライブラリ側のAndroidManifest.xmlでもandroid:themeが指定されているとき次のようなエラーメッセージが出た。

Error:(17, 9) Attribute application@theme value=(@style/HogeHome) from AndroidManifest.xml:17:9
Error:(17, 9) Execution failed for task ':app:processDebugManifest'.
> Manifest merger failed : Attribute application@theme value=(@style/AppThemeHome) from AndroidManifest.xml:17:9
    is also present at com.fugafuga:1.2.3.4:31:9 value=(@style/FugaSdkTheme)
    Suggestion: add 'tools:replace="android:theme"' to <application> element at AndroidManifest.xml:10:5 to override

android:themeがコンフリクトしているなら、ごもっともなエラーメッセージだと思う。
幸い「Suggestion: add 'tools:replace="android:theme"' to element」と出ているので
言われた通りに'tools:replace="android:theme"'を追加した。

しかし動かない。

なんでかな〜と思ってManifest Mergerのドキュメントを見ていると、'tools:node=”replace”'を見つけた。
'tools:node=”replace”'と'tools:replace="android:theme"'の両方をapplicationに付加したらやっとビルドが通った。

4
6
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
4
6