在添加Facebook Android SDK时获取清单合并问题

时间:2017-08-25 06:41:40

标签: android facebook android-manifest

我正在尝试使用facebook登录创建。但是当我在gradle中添加依赖项时,它给出了如下错误:

Error:Execution failed for task ':app:processDebugManifest'.
> Manifest merger failed : Attribute meta-data#android.support.VERSION@value value=(26.0.0-alpha1) from [com.android.support:appcompat-v7:26.0.0-alpha1] AndroidManifest.xml:27:9-38
    is also present at [com.android.support:cardview-v7:25.3.1] AndroidManifest.xml:24:9-31 value=(25.3.1).
    Suggestion: add 'tools:replace="android:value"' to <meta-data> element at AndroidManifest.xml:25:5-27:41 to override.

如此多的SO答案建议添加tools:replace="android:value"(SO问题有不同的价值问题,但主题,图标等)。所以我在我的应用程序标签中添加了它。现在我收到了这个错误:

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

我正在使用最新的android工作室,它有一些版本问题,我已经看到很多其他依赖项。虽然我添加了facebook android SDK 4.0.0但它不需要添加tools:replace="android:value"并且gradle内置很好但是很旧SDK没有打开Goog​​le Chrome的CustomTabActivity功能。我该怎么办?

在我当前的manifest和build.gradle(app level)文件下面:

的build.gradle

apply plugin: 'com.android.application'

android {
    compileSdkVersion 26
    buildToolsVersion "26.0.1"
    defaultConfig {
        applicationId "com.mranuran.buyhatkeassignmentone"
        minSdkVersion 21
        targetSdkVersion 26
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })
    compile 'com.android.support:appcompat-v7:26.+'
    compile 'com.facebook.android:facebook-android-sdk:[4,5)'
    testCompile 'junit:junit:4.12'
}

的manifest.xml

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    package="com.mranuran.buyhatkeassignmentone">

    <uses-permission android:name="android.permission.INTERNET"/>
    <application
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:roundIcon="@mipmap/ic_launcher_round"
        android:supportsRtl="true"
        tools:replace="android:value"
        android:theme="@style/AppTheme">
        <activity android:name=".MainActivity">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
    </application>

</manifest>

3 个答案:

答案 0 :(得分:0)

在build.gradle文件中尝试 defaultConfig { applicationId "com.user.googlemapdemonew" minSdkVersion 19 targetSdkVersion 25 versionCode 1 versionName "1.0" //Add this multiDexEnabled true testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" } ,如下所示:

compile 'com.android.support:multidex:1.0.0'

和这种依赖;

gem pristine --all

答案 1 :(得分:0)

试试吧!

更改

compile 'com.facebook.android:facebook-android-sdk:[4,5)'

compile ('com.facebook.android:facebook-android-sdk:[4,5)') {
exclude group: 'com.android.support', module: 'support-v7'
exclude group: 'com.android.support', module: 'appcompat-v7'
exclude group: 'com.android.support', module: 'cardview-v7'
}

答案 2 :(得分:0)

尝试

dependencies {
    compile 'com.facebook.android:facebook-android-sdk:4.0.0'
}

而不是

compile 'com.facebook.android:facebook-android-sdk:[4,5)'