简体   繁体   English

Android:清单合并失败

[英]Android: Manifest merger failed

I seem to be getting the error of: 我似乎收到以下错误:

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:exifinterface:25.3.1] AndroidManifest.xml:24:9-31 value=(25.3.1). 错误:任务':app:processDebugManifest'的执行失败。>清单合并失败:来自[com.android.support:appcompat-v7的属性元数据#android.support.VERSION@value value =(26.0.0-alpha1) :26.0.0-alpha1] AndroidManifest.xml:27:9-38也出现在[com.android.support:exifinterface:25.3.1] AndroidManifest.xml:24:9-31 value =(25.3.1)。 Suggestion: add 'tools:replace="android:value"' to element at AndroidManifest.xml:25:5-27:41 to override. 建议:在AndroidManifest.xml:25:5-27:41的元素上添加'tools:replace =“ android:value”'以进行覆盖。

It seems as though this error is caused, when I include an image cropping library of: compile 'com.theartofdev.edmodo:android-image-cropper:2.4.+' 当我包括以下图像裁剪库时,似乎是导致了此错误:编译'com.theartofdev.edmodo:android-image-cropper:2.4。+'

Gradle build Gradle构建

apply plugin: 'com.android.application'

android {
    compileSdkVersion 26
    buildToolsVersion "26.0.1"

    defaultConfig {
        applicationId "com.myproj.blogapp"
        minSdkVersion 21
        targetSdkVersion 26
        versionCode 1
        versionName "1.0"
        multiDexEnabled true
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}


dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    testCompile 'junit:junit:4.12'
    compile 'com.android.support:appcompat-v7:26.0.0-alpha1'
    compile 'com.android.support:design:26.0.0-alpha1'
    compile 'com.android.support:cardview-v7:26.0.+'
    compile 'com.android.support:recyclerview-v7:26.0.+'
    compile 'com.squareup.picasso:picasso:2.5.2'


    compile 'com.google.firebase:firebase-core:11.0.4'
    compile 'com.google.firebase:firebase-database:11.0.4'
    compile 'com.google.firebase:firebase-appindexing:11.0.4'
    compile 'com.google.firebase:firebase-storage:11.0.4'
    compile 'com.google.firebase:firebase-crash:11.0.4'
    compile 'com.google.firebase:firebase-auth:11.0.4'
    compile 'com.firebase:firebase-client-android:2.3.1'
    compile 'com.squareup.okhttp:okhttp:2.7.5'
    compile 'com.theartofdev.edmodo:android-image-cropper:2.4.+' //This dependency causing error

    // FirebaseUI Database only
    compile 'com.firebaseui:firebase-ui-database:2.1.1'

}
apply plugin: 'com.google.gms.google-services'

Manifest.xml Manifest.xml

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

    <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />

    <application
        tools:node="replace"
        android:name=".SimpleBlog"
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="PT Mosque"
        android:supportsRtl="true"
        android:theme="@style/AppTheme">
        <activity
            android:name=".MainActivity"
            android:label="Feed">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
        <activity
            android:name="com.theartofdev.edmodo.cropper.CropImageActivity"
            android:theme="@style/Base.Theme.AppCompat" />
        <activity
            android:name=".PostActivity"
            android:windowSoftInputMode="adjustResize" />
        <activity
            android:name=".timetable"
            android:label="Salah Times"
            android:windowSoftInputMode="adjustResize" />
        <activity android:name=".RegisterActivity" />
        <activity android:name=".LoginActivity" />
        <activity android:name=".SetupActivity"></activity>
    </application>

</manifest>

Change 更改

 compile 'com.android.support:appcompat-v7:26.0.0-alpha1'
 compile 'com.android.support:design:26.0.0-alpha1'
 compile 'com.theartofdev.edmodo:android-image-cropper:2.4.+'

to

 compile 'com.android.support:appcompat-v7:26.+'
 compile 'com.android.support:support-v4:26.+'
 compile ('com.theartofdev.edmodo:android-image-cropper:2.4.+'){

        exclude group: 'com.android.support'  
}

Add this to 将此添加到

xmlns:tools="http://schemas.android.com/tools" Add this to xmlns:tools =“ http://schemas.android.com/tools”将此添加到

tools:node="replace" 工具:节点=“替换”

Image cropper library requires older version of support library than your app. 图像裁剪器库需要比您的应用程序更旧的支持库。 There's a fresh bug filled in the issues for the library already but it's not fixed yet. 该库的问题已经有一个新的错误,但尚未修复。

You can downgrade support library version used by your app ( to 25.3.1 ) and wait for a fix. 您可以将应用程序使用的支持库版本降级(至25.3.1),然后等待修复。

EDIT: you would need to lower build target accordingly. 编辑:您需要相应地降低构建目标。 There's another bug for build target on github . github上还有一个构建目标错误

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM