Search code examples
androidgradlemanifest

Error in gradle


Getting gradle issue while sync. app level gradle files

Manifest.xml

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

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

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

</manifest>

build.gradle

    android {
    compileSdkVersion 26
    defaultConfig {
        applicationId "com.aparna.search_recy"
        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 {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    //noinspection GradleCompatible
    implementation 'com.android.support:appcompat-v7:26.1.0'
    compile 'com.android.support:support-v13:26.1.0'
    implementation 'com.android.support:design:26.1.0'
    implementation 'com.android.support.constraint:constraint-layout:1.0.2'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test:runner:1.0.1'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
    compile 'com.mcxiaoke.volley:library:1.0.19'
    compile 'com.android.support:recyclerview-v7:+'
    compile 'com.android.support:cardview-v7:26.0.2'
}

ERROR:

Error:Execution failed for task ':app:processDebugManifest'.

Manifest merger failed : Attribute meta-data#android.support.VERSION@value value=(26.1.0) from [com.android.support:support-v13:26.1.0] AndroidManifest.xml:28:13-35 is also present at [com.android.support:cardview-v7:26.0.2] AndroidManifest.xml:25:13-35 value=(26.0.2). Suggestion: add 'tools:replace="android:value"' to element at AndroidManifest.xml:26:9-28:38 to override.


Solution

  • First you may add missing buildToolVersion below compileSdkVersion then use same version also missing compile 'com.android.support:recyclerview-v7: version so add this check below code

          android {
        compileSdkVersion 26
        buildToolsVersion "26.0.1" //change here
        defaultConfig {
            applicationId "com.aparna.search_recy"
            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 {
        implementation fileTree(dir: 'libs', include: ['*.jar'])
        //noinspection GradleCompatible
        implementation 'com.android.support:appcompat-v7:26.1.0'
        compile 'com.android.support:support-v13:26.1.0'
        implementation 'com.android.support:design:26.1.0'
        implementation 'com.android.support.constraint:constraint-layout:1.0.2'
        testImplementation 'junit:junit:4.12'
        androidTestImplementation 'com.android.support.test:runner:1.0.1'
        androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
        compile 'com.mcxiaoke.volley:library:1.0.19'
        compile 'com.android.support:recyclerview-v7:26.1.0' //change here
        compile 'com.android.support:cardview-v7:26.1.0'
    }
    

    finally clean and rebuild project if this not worked goto File->Invalidate Caches / Restart