close

Error:Execution failed for task ':app:processDebugManifest'.
> Manifest merger failed with multiple errors, see logs

這是今天遇上的錯誤

讓我們點進『See complete output in console』查看一下什麼情況吧!

看到的結果如下

/Users/xxx/Documents/xxx/xxx/app/src/main/AndroidManifest.xml:
96:9-68 Error:
    Attribute activity#com.facebook.FacebookActivity@theme 
    value=(@android:style/Theme.Translucent.NoTitleBar) from 
    AndroidManifest.xml:96:9-68
    is also present at [com.facebook.android:facebook-android
    -sdk:4.18.0] AndroidManifest.xml:32:13-63 value=(@style/
    com_facebook_activity_theme).
    Suggestion: add 'tools:replace="android:theme"' to 
    <activity> element at AndroidManifest.xml:90:5-96:71 to 
    override.
/Users/xxx/Documents/xxx/xxx/app/src/main/AndroidManifest
.xml Error:
    uses-sdk:minSdkVersion 11 cannot be smaller than version
    15 declared in library [com.facebook.android:facebook-
    android-sdk:4.18.0] /Users/yanzewei/Documents/Source
    /Tickets/app/build/intermediates/exploded-aar/com
    .facebook.android/facebook-android-sdk/4.18.0
    /AndroidManifest.xml
    Suggestion: use tools:overrideLibrary="com
    .facebook" to force usage



從Gradle Console中可以看到
這裡有兩個問題

 

問題1、
AndroidManifest.xml 中 96行 的@android:style/Theme.Translucent.NoTitleBar
在com.facebook.android:facebook-android-sdk:4.18.0 中 已宣告過了
因此產生重覆宣告的衝突

解法有兩個步驟
首先加入xmlns:tools="http://schemas.android.com/tools"
再來在<activity>中加入tools:replace="android:theme"
即可解決,如下

<manifest xmlns:android="http://schemas.android.com/apk
                        /res/android"
    xmlns:tools="http://schemas.android.com/tools">
<activity
    。。。。。。
    tools:replace="android:theme"
    android:theme="@android:style/Theme.Translucent
                  .NoTitleBar" />

 

問題2、
library [com.facebook.android:facebook-android-sdk:4.18.0]需要的最小sdk版本為15
這問題只需修改Gradle的minSdkVersion即可

android {
    compileSdkVersion 25
    buildToolsVersion "25.0.0"
    defaultConfig {
        minSdkVersion 15
        targetSdkVersion 25
    }

再來重新Bulid就可以了


arrow
arrow
    全站熱搜

    顏澤偉 發表在 痞客邦 留言(0) 人氣()