由于我的应用程序上添加了新库,因此构建失败,冲突依赖性

时间:2018-04-13 10:29:30

标签: android gradle android-gradle build.gradle react-native-android

使用 npm install --save react-native-onesignal 在我的本机上安装新的库信号后 然后我在构建应用程序时遇到了以下错误:

  

清单合并失败:来自[com.android.support:cardview-v7:26.0.1] AndroidManifest.xml:25:13-的属性meta-data#android.support.VERSION@value value =(26.0.1) 35       也出现在[com.android.support:support-v4:26.1.0] AndroidManifest.xml:28:13-35 value =(26.1.0)。       建议:在AndroidManifest.xml:23:9-25:38中添加'tools:replace =“android:value”'以覆盖。

我知道 com.android.support:cardview-v7:26.0.1 com.android.support:support-v4:26.1.0 我添加了这个库,但我不知道是什么导致冲突,我该如何解决这个问题。

由信号库添加的新gradle看起来像:

dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    compile "com.facebook.react:react-native:${safeExtGet('reactNativeVersion', '+')}"

    compile('com.onesignal:OneSignal:3.8.3') {
        // Exclude com.android.support(Android Support library) as the version range starts at 26.0.0
        //    This is due to compileSdkVersion defaulting to 23 which cant' be lower than the support library version
        //    And the fact that the default root project is missing the Google Maven repo required to pull down 26.0.0+
        exclude group: 'com.android.support'
        // Keeping com.google.android.gms(Google Play services library) as this version range starts at 10.2.1
    }

    testCompile 'junit:junit:4.12'
}

这就是app.build.gradle的样子:

dependencies {
    compile project(':react-native-onesignal')
  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:9.8.0'
  compile 'com.google.android.gms:play-services-analytics:9.8.0'
  compile 'com.google.android.gms:play-services-maps:9.8.0'
  compile 'com.google.android.gms:play-services-auth:9.8.0'
  compile 'com.google.android.gms:play-services-location:9.8.0'
  compile 'com.google.android.gms:play-services-ads:9.8.0'
  apt 'com.raizlabs.android:DBFlow-Compiler:2.2.1'
  compile "com.raizlabs.android:DBFlow-Core:2.2.1"
  compile "com.raizlabs.android:DBFlow:2.2.1"
  compile "com.madgag.spongycastle:core:1.53.0.0"
  compile "com.madgag.spongycastle:prov:1.53.0.0"
  debugCompile 'com.squareup.leakcanary:leakcanary-android-no-op:1.4-beta1'
  // debugCompile 'com.squareup.leakcanary:leakcanary-android:1.4-beta1'
  releaseCompile 'com.squareup.leakcanary:leakcanary-android-no-op:1.4-beta1'
  compile 'com.facebook.device.yearclass:yearclass:1.0.1'
  compile 'commons-io:commons-io:1.3.2'
  compile 'me.leolin:ShortcutBadger:1.1.4@aar'
  compile 'com.nostra13.universalimageloader:universal-image-loader:1.9.5'
  compile 'com.theartofdev.edmodo:android-image-cropper:2.4.7'
  compile 'com.yqritc:android-scalablevideoview:1.0.1'
  compile 'commons-codec:commons-codec:1.10'
  compile 'com.segment.analytics.android:analytics:4.3.0'
  compile 'com.google.zxing:core:3.2.1'
  compile 'net.openid:appauth:0.4.1'
  compile 'com.airbnb.android:lottie:2.2.0'
  compile 'io.branch.sdk.android:library:2.6.1'
  compile('io.nlopez.smartlocation:library:3.2.11') {
    transitive = false
  }
  compile 'com.android.support:exifinterface:26.0.1'
  compile 'com.squareup.okhttp3:okhttp:3.4.1'
  compile 'com.squareup.okhttp3:okhttp-urlconnection:3.4.1'
  compile 'com.squareup.okhttp3:okhttp-ws:3.4.1'
  compile 'com.squareup.okio:okio:1.9.0'

  // Testing
  androidTestCompile 'com.android.support.test.espresso:espresso-core:3.0.1'
  // We use a modified build of com.android.support.test:runner:1.0.1. Explanation in maven-test/README
  androidTestCompile 'com.android.support.test:runner:1.0.1'
  androidTestCompile 'com.android.support:support-annotations:26.0.1'
  androidTestCompile 'com.google.code.findbugs:jsr305:3.0.0'
  androidTestCompile 'com.android.support.test.uiautomator:uiautomator-v18:2.1.1'
  androidTestCompile 'com.azimolabs.conditionwatcher:conditionwatcher:0.2'



  compile('host.exp.exponent:expoview:26.0.0@aar') {
    transitive = true
  } 
}

任何想法如何解决?

1 个答案:

答案 0 :(得分:0)

  1. 将所有支持库版本更改为26.1.0
  2. 将服务版本发布到15.0.0
  3. 它应该有用。