升级到android studio 3.0时,Gradle Manifest合并失败

时间:2017-10-29 09:06:53

标签: android gradle synchronization manifest

在2个月未完成应用后返回Android Studio完成应用。升级到Android Studio 3.0,现在我的Gradle没有同步,我有一些我似乎无法解决的错误。

错误是:

> Error:Execution failed for task ':app:processDebugManifest'.
> > Manifest merger failed : Attribute meta-data#android.support.VERSION@value value=(25.4.0) from
> [com.android.support:design:25.4.0] AndroidManifest.xml:28:13-35      is
> also present at [com.android.support:support-v4:26.1.0]
> AndroidManifest.xml:28:13-35 value=(26.1.0).      Suggestion: add
> 'tools:replace="android:value"' to <meta-data> element at
> AndroidManifest.xml:26:9-28:38 to override.

我的应用Gradle是这样的:

apply plugin: 'com.android.application'

android {

    packagingOptions {
        exclude 'META-INF/DEPENDENCIES.txt'
        exclude 'META-INF/LICENSE.txt'
        exclude 'META-INF/NOTICE.txt'
        exclude 'META-INF/NOTICE'
        exclude 'META-INF/LICENSE'
        exclude 'META-INF/DEPENDENCIES'
        exclude 'META-INF/notice.txt'
        exclude 'META-INF/license.txt'
        exclude 'META-INF/dependencies.txt'
        exclude 'META-INF/LGPL2.1'
    }

    compileSdkVersion 25
    buildToolsVersion '26.0.2'
    defaultConfig {
        applicationId "shomrim.warpcodes.com.shomrim"
        minSdkVersion 19
        targetSdkVersion 25
        versionCode 1
        versionName "1"

        manifestPlaceholders = [onesignal_app_id: "(not showing it)",
                                // Project number pulled from dashboard, local value is ignored.
                                onesignal_google_project_number: "REMOTE"]

        packagingOptions {
            exclude 'META-INF/NOTICE'
            exclude 'META-INF/LICENSE'
        }

        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"

        manifestPlaceholders = [manifestApplicationId: "${applicationId}",
                                onesignal_app_id: "(not showing it)",
                                onesignal_google_project_number: "(not showing it)"]

        // Enabling multidex support.
        multiDexEnabled true

    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    compile 'de.hdodenhof:circleimageview:2.1.0'
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'

    })

    compile 'com.firebaseui:firebase-ui-storage:2.2.0'
    compile 'com.firebaseui:firebase-ui:2.2.0'

    //compile 'com.google.android.gms:play-services:11.4.2'
    compile 'com.google.android.gms:play-services-location:11.4.2'
    compile 'com.google.android.gms:play-services-maps:11.4.2'
    // Required for OneSignal, even if you have added FCM.
    compile 'com.google.android.gms:play-services-gcm:11.4.2'
    // Required for geotagging
    compile 'com.google.android.gms:play-services-location:11.4.2'

    compile 'com.android.support:design:25.4.0'
    compile 'com.android.support:cardview-v7:25.4.0'
    compile 'com.android.support:recyclerview-v7:25.4.0'
    compile 'com.android.support:support-v13:25.4.0'
    compile 'com.android.support:appcompat-v7:25.4.0'

    compile 'com.google.firebase:firebase-storage:11.4.2'
    compile 'com.google.firebase:firebase-core:11.4.2'
    compile 'com.google.firebase:firebase-auth:11.4.2'
    compile 'com.google.firebase:firebase-database:11.4.2'
    compile 'com.google.firebase:firebase-messaging:11.4.2'

    compile 'com.android.support:multidex:1.0.2'
    testCompile 'junit:junit:4.12'
    compile 'com.firebase:firebase-client-android:2.5.2'

    // OneSignal SDK
    compile 'com.onesignal:OneSignal:3.6.5'

    //compile 'com.google.android.gms:play-services-appindexing:10.0.1'
    compile 'com.github.bumptech.glide:glide:3.7.0'

}

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

这是我的清单文件:

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

    <uses-feature android:name="android.hardware.camera" />
    <uses-feature android:name="android.hardware.camera.autofocus" />
    <uses-permission android:name="android.permission.CALL_PHONE" />
    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
    <uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" />
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.RECORD_AUDIO" />
    <uses-permission android:name="android.permission.CAPTURE_AUDIO_OUTPUT" />
    <uses-permission android:name="android.permission.CAMERA" />

    <application
        android:name=".MyApplication"
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:supportsRtl="true"
        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>
        <activity android:name=".RegistrationActivity" />
        <activity android:name=".WatchmenTowerActivity" />
        <activity android:name=".LoginActivity" />
        <activity android:name=".UserProfileActivity" />
        <!--
                  android:name="android.support.multidex.MultiDexApplication"


             The API key for Google Maps-based APIs is defined as a string resource.
             (See the file "res/values/google_maps_api.xml").
             Note that the API key is linked to the encryption key used to sign the APK.
             You need a different API key for each encryption key, including the release key that is used to
             sign the APK for publishing.
             You can define the keys for the debug and release targets in src/debug/ and src/release/.

              //<service android:name=".GPSTracker$GPSTracker" />
        -->
        <meta-data
            android:name="com.google.android.geo.API_KEY"
            android:value="@string/google_maps_key" />

        <activity
            android:name=".MapsActivity"
            android:label="@string/title_activity_maps" />
        <activity android:name=".GroupsActivity" />
        <activity android:name=".DatabaseActivity" />
        <activity android:name=".OperationsActivity" />

        <service
            android:name=".MyService"
            android:enabled="true"
            android:exported="true" />
        <!--
 ATTENTION: This was auto-generated to add Google Play services to your project for
     App Indexing.  See https://g.co/AppIndexing/AndroidStudio for more information.
        -->
<!--
        <meta-data
            android:name="com.google.android.gms.version"
            android:value="@integer/google_play_services_version" />
-->
        <provider
            android:name="android.support.v4.content.FileProvider"
            android:authorities="shomrim.warpcodes.com.shomrim.fileprovider"
            android:exported="false"
            android:grantUriPermissions="true">

            <!--
            <meta-data
                android:name="android.support.FILE_PROVIDER_PATHS"
                android:resource="@xml/file_paths"></meta-data>
                -->
        </provider>

    </application>

</manifest>

我遗漏了一些简单的东西,请帮助我理解它是什么。尝试多次更改版本,没有用。

感谢。

0 个答案:

没有答案