React-native-fcm: Manifest merger failed Attribute meta-data#android.support.VERSION

Created on 21 Mar 2018  路  9Comments  路  Source: evollu/react-native-fcm

I've just ejected expo project with Expokit and after adding react native fcm I can't build project on Android. First of I have received google service versions clashes but I have resolved it. Now I've got an error which I do not know how to resolve.

Error:Execution failed for task ':app:processDev19DebugManifest'.
> Manifest merger failed : Attribute meta-data#android.support.VERSION@value value=(26.0.1) from [com.android.support:cardview-v7:26.0.1] AndroidManifest.xml:25: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:23:9-25:38 to override.

Every help would be appreciated
React Native 0.52
React Native FCM 14.1.2
Expo 25.0.0

And here is my app/build.gradle

buildscript {
  repositories {
    maven { url 'https://maven.fabric.io/public' }
  }

  dependencies {
    classpath 'io.fabric.tools:gradle:1.+'
  }
}
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
apply plugin: 'com.neenbedankt.android-apt'

repositories {
  maven { url 'https://maven.fabric.io/public' }
}

android {
  compileSdkVersion 26
  buildToolsVersion '26.0.1'

  defaultConfig {
    applicationId 'com.beready'
    targetSdkVersion 25
    versionCode 1
    versionName '0.1.0'
    ndk {
      abiFilters 'armeabi-v7a', 'x86'
    }
    multiDexEnabled true
    testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    // Deprecated. Used by net.openid:appauth
    manifestPlaceholders = [
      'appAuthRedirectScheme': 'host.exp.exponent'
    ]
  }
  dexOptions {
    javaMaxHeapSize System.getenv("DISABLE_DEX_MAX_HEAP") ? null : "8g"
  }
  productFlavors {
    // Define separate dev and prod product flavors.
    dev {
      // dev utilizes minSDKVersion = 21 to allow the Android gradle plugin
      // to pre-dex each module and produce an APK that can be tested on
      // Android Lollipop without time consuming dex merging processes.
      minSdkVersion 21
    }
    devRemoteKernel {
      minSdkVersion 21
    }
    dev19 {
      // For debugging / development on older SDK versions. Increases build
      // time so use 'dev' if not running on older SDKs.
      minSdkVersion 19
    }
    prod {
      // The actual minSdkVersion for the application.
      minSdkVersion 19
    }
  }
  buildTypes {
    debug {
      debuggable true
    }
    release {
      minifyEnabled true
      proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
      zipAlignEnabled true
    }
  }
  signingConfigs {
    debug {
      storeFile file('../debug.keystore')
    }
  }
  lintOptions {
    abortOnError false
  }
}

// Don't use modern jsc-android since it still has some critical bugs that
// crash applications when the string for the JS bundle is loaded and when
// locale-specific date functions are called.
// configurations.all {
//   resolutionStrategy {
//     force 'org.webkit:android-jsc:r216113'
//   }
// }


task exponentPrebuildStep(type: Exec) {
  workingDir '../'
  if (System.getProperty('os.name').toLowerCase().contains('windows')) {
    commandLine 'cmd', '/c', '.\\detach-scripts\\prepare-detached-build.bat'
  } else {
    commandLine './detach-scripts/prepare-detached-build.sh'
  }
}
preBuild.dependsOn exponentPrebuildStep


dependencies {
  compile project(':react-native-fcm')
  compile 'com.google.firebase:firebase-core:10.0.1' //this decides your firebase SDK version
  compile 'com.google.firebase:firebase-messaging:10.0.1'


  compile fileTree(dir: 'libs', include: ['*.jar'])

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

  // Our dependencies
  compile 'com.android.support:appcompat-v7:26.0.1'

  // Our dependencies from ExpoView
  // DON'T ADD ANYTHING HERE THAT ISN'T IN EXPOVIEW. ONLY COPY THINGS FROM EXPOVIEW TO HERE.
  compile 'com.android.support:appcompat-v7:26.0.1'
  compile 'com.facebook.android:facebook-android-sdk:4.7.0'
  compile('com.facebook.android:audience-network-sdk:4.22.1') {
    exclude module: 'play-services-ads'
  }
  provided 'org.glassfish:javax.annotation:3.1.1'
  compile 'com.jakewharton:butterknife:7.0.1'
  compile 'de.greenrobot:eventbus:2.4.0'
  compile 'com.amplitude:android-sdk:2.9.2' // Be careful when upgrading! Upgrading might break experience scoping. Check with Jesse. See Analytics.resetAmplitudeDatabaseHelper
  compile 'com.squareup.picasso:picasso:2.5.2'
  compile 'com.google.android.gms:play-services-gcm:10.0.1'
  compile 'com.google.android.gms:play-services-analytics:10.0.1'
  compile 'com.google.android.gms:play-services-maps:10.0.1'
  compile 'com.google.android.gms:play-services-auth:10.0.1'
  compile 'com.google.android.gms:play-services-location:10.0.1'
  compile 'com.google.android.gms:play-services-ads:10.0.1'
  apt 'com.raizlabs.android:DBFlow-Compiler:2.2.1'
....
compile('host.exp.exponent:expoview:25.0.0@aar') {
    transitive = true
  }


}

// This has to be down here for some reason
apply plugin: 'com.google.gms.google-services'

Most helpful comment

configurations.all {
resolutionStrategy.eachDependency { DependencyResolveDetails details ->
def requested = details.requested
if (requested.group == 'com.android.support') {
if (!requested.name.startsWith("multidex")) {
details.useVersion '26.0.2'
}
}
}
}
NOTE :Add this to your build.gradle and make sure you are using the same versions as '26.0.2'.

All 9 comments

change
compile 'com.android.support:appcompat-v7:26.0.1' to
compile 'com.android.support:appcompat-v7:26.1.0'?

Unfortunately It doesn't work 馃槥

the problem is you have
compile 'com.android.support:appcompat-v7:26.0.1' in your manifest file
and somewhere in some dependency project it has com.android.support:support-v4:26.1.0

try find where the conflict is

Ok, After some trying, stashing and configuring from scratch I make it works at least. I do not know why that problem was occurring. I have followed the instruction every time. It could appear because of some dependency conflict but unfortunately, I don't know which one it was.

cool

configurations.all {
resolutionStrategy.eachDependency { DependencyResolveDetails details ->
def requested = details.requested
if (requested.group == 'com.android.support') {
if (!requested.name.startsWith("multidex")) {
details.useVersion '26.0.2'
}
}
}
}
NOTE :Add this to your build.gradle and make sure you are using the same versions as '26.0.2'.

@yaminijain, just to complement, how could one "make sure you are using the same versions as '26.0.2'"?

Thank you very much for your solution @yaminijain, I came across this issue while trying to solve a different library conflict, and it suits like a glove (bloody android studio error log messages!).

change
compile 'com.android.support:appcompat-v7:26.0.1' to
compile 'com.android.support:appcompat-v7:26.1.0'?

thank u so much it is worked

Was this page helpful?
0 / 5 - 0 ratings

Related issues

404sand808s picture 404sand808s  路  5Comments

xavieramoros picture xavieramoros  路  4Comments

nailikhaled picture nailikhaled  路  5Comments

gplopes picture gplopes  路  6Comments

Keksike picture Keksike  路  5Comments