错误:任务执行失败?

时间:2017-07-24 16:17:34

标签: android android-manifest android-build

我尝试导入项目我得到这样的错误,我花了一天但我无法解决请帮帮我。

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

我认为AndroidManifest文件中有问题,但我不知道在哪里,我已经尝试过google建议。

这是我的AndroidManifest.xml,

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.akira21.vault.musallah"
    android:versionCode="11"
    android:versionName="1.0.11">

    <uses-sdk
        android:minSdkVersion="16"
        android:targetSdkVersion="24" />

    <uses-feature
        android:glEsVersion="0x00020000"
        android:required="true" />

    <uses-permission android:name="android.permission.CALL_PHONE" />
    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
    <uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" />
    <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
    <uses-permission android:name="android.permission.SEND_SMS" />

    <permission
        android:name="com.akira21.vault.musallah.permission.MAPS_RECEIVE"
        android:protectionLevel="signature" />

    <uses-permission android:name="com.akira21.vault.musallah.permission.MAPS_RECEIVE" />

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

    <application
        android:name="android.support.multidex.MultiDexApplication"
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme">

        <!-- android:debuggable="false" > -->
        <activity
            android:name=".SplashActivity"
            android:exported="true"
            android:label="@string/app_name"
            android:screenOrientation="portrait"
            android:theme="@android:style/Theme.Black.NoTitleBar">
        <!--    <intent-filter>
                <data
                    android:host="@string/app_link"
                    android:scheme="http" />

                <action android:name="android.intent.action.VIEW" />

                <category android:name="android.intent.category.DEFAULT" />
                <category android:name="android.intent.category.BROWSABLE" />
            </intent-filter>
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

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

        <!-- Main activity -->
        <activity
            android:name=".MainActivity"
            android:label="@string/app_name"
            android:screenOrientation="portrait"></activity>
        <activity
            android:name=".LoginActivity"
            android:label="@string/app_name"
            android:screenOrientation="portrait"
            android:theme="@android:style/Theme.Black.NoTitleBar"></activity>
        <activity
            android:name=".WebViewActivity"
            android:label="@string/app_name"
            android:screenOrientation="portrait"></activity>
        <activity
            android:name=".AddLocationActivity"
            android:label="@string/app_name"
            android:screenOrientation="portrait"
            android:windowSoftInputMode="stateHidden"></activity>
        <activity
            android:name=".LocationDetailActivity"
            android:label="@string/app_name"
            android:screenOrientation="portrait"></activity>
        <activity
            android:name=".SelectFiltersActivity"
            android:label="@string/app_name"
            android:screenOrientation="portrait"></activity>
        <activity
            android:name=".SelectLocationTypeActivity"
            android:label="@string/app_name"
            android:screenOrientation="portrait"></activity>
        <activity
            android:name=".SelectPrayerRoomTypeActivity"
            android:label="@string/app_name"
            android:screenOrientation="portrait"></activity>
        <activity
            android:name=".SelectBuildingTypeActivity"
            android:label="@string/app_name"
            android:screenOrientation="portrait"></activity>
        <activity
            android:name=".CalculationMethodsActivity"
            android:label="@string/app_name"
            android:screenOrientation="portrait"></activity>
        <activity
            android:name=".JuristicMethodsActivity"
            android:label="@string/app_name"
            android:screenOrientation="portrait"></activity>
        <activity
            android:name=".LocationDetailsActionBarActivity"
            android:label="@string/app_name"
            android:screenOrientation="portrait"></activity>
        <activity
            android:name=".PostReviewActivity"
            android:label="@string/app_name"
            android:screenOrientation="portrait"></activity>
        <activity
            android:name=".LocationFlagActivity"
            android:label="@string/app_name"
            android:screenOrientation="portrait"></activity>
        <activity
            android:name=".PrayerAlarmActivity"
            android:label="@string/app_name"
            android:screenOrientation="portrait"></activity>
        <activity
            android:name="com.facebook.FacebookActivity"
            android:configChanges="keyboard|keyboardHidden|screenLayout|screenSize|orientation"
            android:label="@string/app_name" />
        // android:theme="@android:style/Theme.Translucent.NoTitleBar"
        <meta-data
            android:name="com.google.android.gms.version"
            android:value="@integer/google_play_services_version" />
        <meta-data
            android:name="com.google.android.maps.v2.API_KEY"
            android:value="AIzaSyB_asl2uIc2L2TAjFqDOOJiCtW55aaea_0" />
        <meta-data
            android:name="com.facebook.sdk.ApplicationId"
            android:value="@string/app_facebook_id" />
        <meta-data
            android:name="net.hockeyapp.android.appIdentifier"
            android:value="${HOCKEYAPP_APP_ID}" />

        <receiver
            android:name=".AlarmReceiver"
            android:process=":remote" />

        <activity android:name=".SplashOne"
            android:exported="true"
            android:label="@string/app_name"
            android:screenOrientation="portrait"
            android:theme="@android:style/Theme.Black.NoTitleBar">




            <intent-filter>
                <data
                    android:host="@string/app_link"
                    android:scheme="http" />

                <action android:name="android.intent.action.VIEW" />

                <category android:name="android.intent.category.DEFAULT" />
                <category android:name="android.intent.category.BROWSABLE" />
            </intent-filter>
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

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



        </activity>
    </application>

</manifest>

这是我的build.gradle:

apply plugin: 'com.android.application'

repositories {
    mavenCentral()
}

dependencies {
    compile fileTree(dir: 'libs', include: '*.jar')
    compile project(':android-maps-utils:library')
    compile 'com.facebook.android:facebook-android-sdk:[4,5)'
    compile 'com.android.support:appcompat-v7:26.0.0-alpha1'
    compile 'com.google.android.gms:play-services:10.2.4'
    compile 'com.android.support:multidex:1.0.1'
    compile 'net.hockeyapp.android:HockeySDK:4.0.0'
    compile 'com.google.android.gms:play-services-ads:10.2.4'
    compile 'com.google.android.gms:play-services-identity:10.2.4'
    compile 'com.google.android.gms:play-services-gcm:10.2.4'
}

android {
    signingConfigs {
        config {
            keyAlias 'musallah_key'
            keyPassword 'musallah323'
            storeFile file('/Users/sandeshjain/AndroidStudioProjects/Musallah/musallah/keystore/musallah_keystore_release/musallah_keystore')
            storePassword 'musallah323'
        }
    }
    compileSdkVersion 24
    buildToolsVersion '25.0.0'
    useLibrary 'org.apache.http.legacy'
    sourceSets {
        main {
            manifest.srcFile 'AndroidManifest.xml'
            java.srcDirs = ['src']
            resources.srcDirs = ['src']
            aidl.srcDirs = ['src']
            renderscript.srcDirs = ['src']
            res.srcDirs = ['res']
            assets.srcDirs = ['assets']
        }

        // Move the tests to tests/java, tests/res, etc...
        instrumentTest.setRoot('tests')

        // Move the build types to build-types/<type>
        // For instance, build-types/debug/java, build-types/debug/AndroidManifest.xml, ...
        // This moves them out of them default location under src/<type>/... which would
        // conflict with src/ being used by the main source set.
        // Adding new build types or product flavors should be accompanied
        // by a similar customization.
        debug.setRoot('build-types/debug')
        release.setRoot('build-types/release')
    }
    defaultConfig {
        multiDexEnabled true
        applicationId "com.akira21.vault.musallah"
        manifestPlaceholders = [HOCKEYAPP_APP_ID: "27024aec8a244b6ba908a10e662ab3e1"]
    }
    buildTypes {
        release {
            signingConfig signingConfigs.config
        }
    }
}

谢谢你。

1 个答案:

答案 0 :(得分:1)

在build.gridle

中添加以下代码
configurations.all {
    resolutionStrategy.eachDependency { DependencyResolveDetails details ->
        def requested = details.requested
        if (requested.group == 'com.android.support') {
            if (!requested.name.startsWith("multidex")) {
                details.useVersion '25.3.0'
            }
        }
    }
}

我希望这对你有所帮助,一切顺利。