Pushwoosh / pushwoosh-react-native-plugin

Other
57 stars 43 forks source link

Dependency conflict - com.github.bumptech.glide #101

Closed Pandan closed 4 years ago

Pandan commented 4 years ago

Hello,

I am having a dependency conflict with com.github.bumptech.glide. By the looks of it, the conflict is between pushwoosh-react-native-plugin (5.20.8) and react-native-track-player (1.2.3).

The strange thins is that they booth seems to support glide 4.7.1. Or maybe I am misunderstanding the dependency log?

pushwoosh-react-native-plugin: com.github.bumptech.glide:glide:[4.4.0, 4.11.0] -> 4.7.1 (*)

react-native-track-player: com.github.bumptech.glide:glide:4.7.1

It's working if I downgrade pushwoosh-react-native-plugin to 5.20.5

What should I do?

+--- project :pushwoosh-react-native-plugin
|    +--- com.facebook.react:react-native:+ -> 0.62.1 (*)
|    +--- com.pushwoosh:pushwoosh:5.22.6
|    |    +--- androidx.legacy:legacy-support-v4:1.0.0 (*)
|    |    \--- androidx.work:work-runtime:2.0.0
|    |         +--- com.google.guava:listenablefuture:1.0
|    |         +--- androidx.lifecycle:lifecycle-extensions:2.0.0
|    |         |    +--- androidx.lifecycle:lifecycle-runtime:2.0.0 -> 2.1.0 (*)
|    |         |    +--- androidx.arch.core:core-common:2.0.0 -> 2.1.0 (*)
|    |         |    +--- androidx.arch.core:core-runtime:2.0.0 (*)
|    |         |    +--- androidx.fragment:fragment:1.0.0 -> 1.1.0 (*)
|    |         |    +--- androidx.lifecycle:lifecycle-common:2.0.0 -> 2.1.0 (*)
|    |         |    +--- androidx.lifecycle:lifecycle-livedata:2.0.0 (*)
|    |         |    +--- androidx.lifecycle:lifecycle-process:2.0.0
|    |         |    |    \--- androidx.lifecycle:lifecycle-runtime:2.0.0 -> 2.1.0 (*)
|    |         |    +--- androidx.lifecycle:lifecycle-service:2.0.0
|    |         |    |    \--- androidx.lifecycle:lifecycle-runtime:2.0.0 -> 2.1.0 (*)
|    |         |    \--- androidx.lifecycle:lifecycle-viewmodel:2.0.0 -> 2.1.0 (*)
|    |         \--- androidx.room:room-runtime:2.0.0
|    |              +--- androidx.room:room-common:2.0.0
|    |              |    \--- androidx.annotation:annotation:1.0.0 -> 1.1.0
|    |              +--- androidx.sqlite:sqlite-framework:2.0.0
|    |              |    +--- androidx.annotation:annotation:1.0.0 -> 1.1.0
|    |              |    \--- androidx.sqlite:sqlite:2.0.0
|    |              |         \--- androidx.annotation:annotation:1.0.0 -> 1.1.0
|    |              +--- androidx.sqlite:sqlite:2.0.0 (*)
|    |              +--- androidx.arch.core:core-runtime:2.0.0 (*)
|    |              \--- androidx.legacy:legacy-support-core-utils:1.0.0-rc01 -> 1.0.0 (*)
|    +--- com.pushwoosh:pushwoosh-amazon:5.22.6
|    |    +--- com.pushwoosh:pushwoosh:5.22.6 (*)
|    |    \--- androidx.annotation:annotation:1.0.0 -> 1.1.0
|    +--- com.pushwoosh:pushwoosh-badge:5.22.6
|    |    \--- com.pushwoosh:pushwoosh:5.22.6 (*)
|    +--- com.pushwoosh:pushwoosh-inbox:5.22.6
|    |    +--- com.pushwoosh:pushwoosh:5.22.6 (*)
|    |    \--- androidx.annotation:annotation:1.0.0 -> 1.1.0
|    +--- com.pushwoosh:pushwoosh-inbox-ui:5.22.6
|    |    +--- com.github.bumptech.glide:glide:[4.4.0, 4.11.0] -> 4.7.1 (*)
|    |    +--- com.pushwoosh:pushwoosh-inbox:5.22.6 (*)
|    |    +--- androidx.appcompat:appcompat:1.0.0 -> 1.1.0 (*)
|    |    +--- androidx.recyclerview:recyclerview:1.0.0 -> 1.1.0 (*)
|    |    +--- com.google.android.material:material:1.0.0 -> 1.2.0-alpha03 (*)
|    |    \--- androidx.constraintlayout:constraintlayout:1.1.3
|    |         \--- androidx.constraintlayout:constraintlayout-solver:1.1.3
|    +--- org.jetbrains.kotlin:kotlin-stdlib-jre7:1.1.60
|    |    \--- org.jetbrains.kotlin:kotlin-stdlib:1.1.60 -> 1.3.61 (*)
|    +--- com.google.firebase:firebase-core:(+,17.0.0) -> 16.0.9
|    |    \--- com.google.firebase:firebase-analytics:16.5.0 -> 17.2.1 (*)
|    \--- com.google.firebase:firebase-messaging:(+,19.0.0) -> 18.0.0
|         +--- com.google.android.gms:play-services-basement:16.0.1 -> 17.0.0 (*)
|         +--- com.google.android.gms:play-services-tasks:16.0.1 -> 17.0.0 (*)
|         +--- com.google.firebase:firebase-common:17.0.0 -> 19.0.0 (*)
|         +--- com.google.firebase:firebase-iid:[18.0.0] -> 19.0.0 (*)
|         \--- com.google.firebase:firebase-measurement-connector:17.0.1 -> 18.0.0 (*)
 project :react-native-track-player
|    +--- com.facebook.react:react-native:+ -> 0.62.1 (*)
|    +--- com.google.android.exoplayer:exoplayer-core:2.10.1
|    |    \--- androidx.annotation:annotation:1.0.2 -> 1.1.0
|    +--- androidx.core:core:1.2.0-beta01 (*)
|    +--- androidx.media:media:1.1.0
|    |    +--- androidx.core:core:1.1.0 -> 1.2.0-beta01 (*)
|    |    \--- androidx.collection:collection:1.0.0 -> 1.1.0 (*)
|    +--- androidx.localbroadcastmanager:localbroadcastmanager:1.1.0-alpha01
|    |    \--- androidx.annotation:annotation:1.0.0 -> 1.1.0
|    \--- com.github.bumptech.glide:glide:4.7.1
|         +--- com.github.bumptech.glide:gifdecoder:4.7.1
|         |    \--- androidx.annotation:annotation:1.0.0 -> 1.1.0
|         +--- com.github.bumptech.glide:disklrucache:4.7.1
|         +--- com.github.bumptech.glide:annotations:4.7.1
|         \--- androidx.fragment:fragment:1.0.0 -> 1.1.0 (*)
wfhm commented 4 years ago

@Pandan,

Pushwoosh React Native plugin definitely supports 4.7.1 Glide version. The 5.20.5 version uses exactly the 4.7.1 version, so the lib is resolved to this exact version, however it is strange that for the latest plugin it does not happen. To investigate it, may I ask you to share your build.gradle files?

Pandan commented 4 years ago

Here you go and thx for looking into this.

buid.gradle https://gist.github.com/Pandan/ecdb8f9d916534822528de52956fc53a

app:build.gradle https://gist.github.com/Pandan/3268f0ef3e04ab70ca148fccebc344fd

and here is the error I get.

error Failed to install the app. Make sure you have the Android development environment set up: https://reactnative.dev/docs/getting-started.html#android-development-environment. Run CLI with --verbose flag for more details.
Error: Command failed: ./gradlew app:installDebug -PreactNativeDevServerPort=8081

FAILURE: Build failed with an exception.

* What went wrong:
Could not determine the dependencies of task ':pushwoosh-react-native-plugin:generateDebugRFile'.
> In project 'app' a resolved Google Play services library dependency depends on another at an exact version (e.g. "[4.4.0
  , 4.11.0]", but isn't being resolved to that version. Behavior exhibited by the library will be unknown.

  Dependency failing: com.pushwoosh:pushwoosh-inbox-ui:5.22.6 -> com.github.bumptech.glide:glide@[4.4.0, 4.11.0], but glid
  e version was 4.11.0.

  The following dependencies are project dependencies that are direct or have transitive dependencies that lead to the art
  ifact with the issue.
  -- Project 'app' depends on project 'pushwoosh' which depends onto com.pushwoosh:pushwoosh-inbox-ui@{strictly 5.22.6}
  -- Project 'app' depends on project 'pushwoosh' which depends onto com.pushwoosh:pushwoosh-inbox-ui@5.22.6
  -- Project 'app' depends on project 'pushwoosh' which depends onto com.github.bumptech.glide:glide@{strictly 4.11.0}
wfhm commented 4 years ago

@Pandan,

One more thing - could you please share the exact error you get when building the project?

Pandan commented 4 years ago
> Configure project :react-native-firebase
react-native-firebase: using React Native prebuilt binary from /Users/pandan/Work/reactNativeWorkspace/18125-kroken/node_modules/react-native/android
WARNING: The specified Android SDK Build Tools version (27.0.2) is ignored, as it is below the minimum supported version (28.0.3) for Android Gradle Plugin 3.6.3.
Android SDK Build Tools 28.0.3 will be used.
To suppress this warning, remove "buildToolsVersion '27.0.2'" from your build.gradle file, as each version of the Android Gradle Plugin now has a default version of the build tools.
Dependency resolved to an incompatible version: Dependency(fromArtifactVersion=ArtifactVersion(groupId=com.pushwoosh, artifactId=pushwoosh-inbox-ui, version=5.22.6), toArtifact=Artifact(groupId=com.github.bumptech.glide, artifactId=glide), toArtifactVersionString=[4.4.0, 4.11.0])

FAILURE: Build failed with an exception.

* What went wrong:
Could not determine the dependencies of task ':pushwoosh-react-native-plugin:generateDebugRFile'.
> In project 'app' a resolved Google Play services library dependency depends on another at an exact version (e.g. "[4.4.0
  , 4.11.0]", but isn't being resolved to that version. Behavior exhibited by the library will be unknown.

  Dependency failing: com.pushwoosh:pushwoosh-inbox-ui:5.22.6 -> com.github.bumptech.glide:glide@[4.4.0, 4.11.0], but glid
  e version was 4.11.0.

  The following dependencies are project dependencies that are direct or have transitive dependencies that lead to the art
  ifact with the issue.
  -- Project 'app' depends on project 'pushwoosh' which depends onto com.pushwoosh:pushwoosh-inbox-ui@{strictly 5.22.6}
  -- Project 'app' depends on project 'pushwoosh' which depends onto com.pushwoosh:pushwoosh-inbox-ui@5.22.6
  -- Project 'app' depends on project 'pushwoosh' which depends onto com.github.bumptech.glide:glide@{strictly 4.11.0}

  For extended debugging info execute Gradle from the command line with ./gradlew --info :app:assembleDebug to see the dep
  endency paths to the artifact. This error message came from the google-services Gradle plugin, report issues at https://
  github.com/google/play-services-plugins and disable by adding "googleServices { disableVersionCheck = false }" to your b
  uild.gradle file.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 3s

error Failed to install the app. Make sure you have the Android development environment set up: https://reactnative.dev/docs/getting-started.html#android-development-environment. Run CLI with --verbose flag for more details.
Error: Command failed: ./gradlew app:installDebug -PreactNativeDevServerPort=8081

FAILURE: Build failed with an exception.

* What went wrong:
Could not determine the dependencies of task ':pushwoosh-react-native-plugin:generateDebugRFile'.
> In project 'app' a resolved Google Play services library dependency depends on another at an exact version (e.g. "[4.4.0
  , 4.11.0]", but isn't being resolved to that version. Behavior exhibited by the library will be unknown.

  Dependency failing: com.pushwoosh:pushwoosh-inbox-ui:5.22.6 -> com.github.bumptech.glide:glide@[4.4.0, 4.11.0], but glid
  e version was 4.11.0.

  The following dependencies are project dependencies that are direct or have transitive dependencies that lead to the art
  ifact with the issue.
  -- Project 'app' depends on project 'pushwoosh' which depends onto com.pushwoosh:pushwoosh-inbox-ui@{strictly 5.22.6}
  -- Project 'app' depends on project 'pushwoosh' which depends onto com.pushwoosh:pushwoosh-inbox-ui@5.22.6
  -- Project 'app' depends on project 'pushwoosh' which depends onto com.github.bumptech.glide:glide@{strictly 4.11.0}

  For extended debugging info execute Gradle from the command line with ./gradlew --info :app:assembleDebug to see the dep
  endency paths to the artifact. This error message came from the google-services Gradle plugin, report issues at https://
  github.com/google/play-services-plugins and disable by adding "googleServices { disableVersionCheck = false }" to your b
  uild.gradle file.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 3s

    at makeError (/Users/pandan/Work/reactNativeWorkspace/18125-kroken/node_modules/execa/index.js:174:9)
    at /Users/pandan/Work/reactNativeWorkspace/18125-kroken/node_modules/execa/index.js:278:16
    at processTicksAndRejections (internal/process/task_queues.js:93:5)
    at async runOnAllDevices (/Users/pandan/Work/reactNativeWorkspace/18125-kroken/node_modules/@react-native-community/cli-platform-android/build/commands/runAndroid/runOnAllDevices.js:94:5)
    at async Command.handleAction (/Users/pandan/Work/reactNativeWorkspace/18125-kroken/node_modules/react-native/node_modules/@react-native-community/cli/build/index.js:186:9)
wfhm commented 4 years ago

@Pandan,

Thanks, checking it.

Pandan commented 4 years ago

@wfhm any news regarding this issue?

wfhm commented 4 years ago

@Pandan,

I am sorry for the delayed response. The issue is caused by google-services dependencies and not by the Glide directly. Updating Google Services plugin ('com.google.gms:google-services') to 4.3.3 version did the trick on our side. Could you please try updating this plugin to 4.3.3 and let us know about the results?

morelgarisi commented 3 years ago

updating 'com.google.gms:google-service to 4.3.3 -> more problems any solution without updating from classpath("com.google.gms:google-services:4.2.0") to classpath("com.google.gms:google-services:4.3.3") ?

wfhm commented 3 years ago

@morelgarisi as I've mentioned in my previous comment, the update from the 4.2.0 version of the Google Services plugin is required by google-services dependencies, so we cannot do much with it. Can you provide a bit more detail on the problems you get after updating to 4.3.3?

morelgarisi commented 3 years ago

@morelgarisi as I've mentioned in my previous comment, the update from the 4.2.0 version of the Google Services plugin is required by google-services dependencies, so we cannot do much with it. Can you provide a bit more detail on the problems you get after updating to 4.3.3?

hi, tnx for the replay ! i'm starting to get duplicate class androidx:

Execution failed for task ':app:checkDebugDuplicateClasses'.

1 exception was raised by workers: java.lang.RuntimeException: java.lang.RuntimeException: Duplicate class androidx.work.ArrayCreatingInputMerger found in modules classes.jar (android.arch.work:work-runtime:1.0.1) and classes.jar (androidx.work:work-runtime:2.7.0-alpha05)

and for my case ios build issue is only fixed on version with com.google.gms:google-services:4.3.3 so i'm stack

wfhm commented 3 years ago

@morelgarisi

Pushwoosh SDK uses work-runtime library with the following version range: [2.0.0,)

This means that our SDK will resolve this dependency to a version from 2.0.0 to the latest available. It looks like android.arch.work:work-runtime:1.0.1 dependency is added by a third-party library, and it resolves strictly to the 1.0.1 version, so, as a result, two versions of the library are added, hence the conflict. Could you please share the full list of dependencies of your project?

morelgarisi commented 3 years ago

sorry for the delay , here is my app/build.gradle

apply plugin: "com.android.application" apply from: project(':react-native-config').projectDir.getPath() + "/dotenv.gradle" apply from: file("../../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesAppBuildGradle(project) apply plugin: 'com.google.gms.google-services' import com.android.build.OutputFile

/**

project.ext.react = [ entryFile: "index.js", enableHermes: false, // clean and rebuild if changing ]

apply from: "../../node_modules/react-native/react.gradle"

/**

/**

/**

/**

android { compileSdkVersion rootProject.ext.compileSdkVersion

compileOptions {
    sourceCompatibility JavaVersion.VERSION_1_8
    targetCompatibility JavaVersion.VERSION_1_8
}

defaultConfig {
    applicationId "com.moonsite.hicar"
    minSdkVersion rootProject.ext.minSdkVersion
    targetSdkVersion rootProject.ext.targetSdkVersion
   versionCode 323
    versionName "3.2.3"
    multiDexEnabled true
       ndk {
        abiFilters "arm64-v8a", "armeabi-v7a", "x86","x86_64"
         abiFilters.clear()
    }

}
splits {
    abi {
        reset()
        enable enableSeparateBuildPerCPUArchitecture
        universalApk true  // If true, also generate a universal APK
        include "armeabi-v7a", "x86", "arm64-v8a", "x86_64"
    }
}
signingConfigs {
    debug {
        storeFile file('debug.keystore')
        storePassword 'android'
        keyAlias 'androiddebugkey'
        keyPassword 'android'
    }
        release {
        if (project.hasProperty('MYAPP_UPLOAD_STORE_FILE')) {
            storeFile file(MYAPP_UPLOAD_STORE_FILE)
            storePassword MYAPP_UPLOAD_STORE_PASSWORD
            keyAlias MYAPP_UPLOAD_KEY_ALIAS
            keyPassword MYAPP_UPLOAD_KEY_PASSWORD
        }
    }
}
buildTypes {
    debug {
        signingConfig signingConfigs.debug
    }
    release {
        // Caution! In production, you need to generate your own keystore file.
        // see https://facebook.github.io/react-native/docs/signed-apk-android.
        signingConfig signingConfigs.release
        minifyEnabled enableProguardInReleaseBuilds
        proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
    }
}
// applicationVariants are e.g. debug, release
applicationVariants.all { variant ->
    variant.outputs.each { output ->
        // For each separate APK per architecture, set a unique version code as described here:
        // https://developer.android.com/studio/build/configure-apk-splits.html
        def versionCodes = ["armeabi-v7a": 1, "x86": 2, "arm64-v8a": 3, "x86_64": 4]
        def abi = output.getFilter(OutputFile.ABI)
        if (abi != null) {  // null for the universal-debug, universal-release variants
            output.versionCodeOverride =
                    versionCodes.get(abi) * 1048576 + defaultConfig.versionCode
        }

    }
}

packagingOptions {
    pickFirst '**/armeabi-v7a/libc++_shared.so'
    pickFirst '**/x86/libc++_shared.so'
    pickFirst '**/arm64-v8a/libc++_shared.so'
    pickFirst '**/x86_64/libc++_shared.so'
    pickFirst '**/x86/libjsc.so'
    pickFirst '**/armeabi-v7a/libjsc.so'
}

}

dependencies { implementation project(':react-native-otp-verify') implementation project(':react-native-settings') implementation project(':react-native-image-picker') implementation project(':jail-monkey') // implementation project(':react-native-reanimated') // implementation project(':react-native-scanovate-imaging-library') implementation project(':react-native-splash-screen') implementation project(':react-native-i18n') implementation project(':react-native-vector-icons') implementation project(':react-native-config') implementation fileTree(dir: "libs", include: ["*.jar"]) implementation "com.facebook.react:react-native:+" // From node_modules implementation 'com.facebook.fresco:fresco:2.0.0' implementation 'com.facebook.fresco:animated-gif:2.0.0' implementation 'androidx.appcompat:appcompat:1.1.0-rc01' implementation 'androidx.swiperefreshlayout:swiperefreshlayout:1.1.0-alpha02' implementation 'com.android.support:multidex:1.0.3' if (enableHermes) { def hermesPath = "../../node_modules/hermesvm/android/"; debugImplementation files(hermesPath + "hermes-debug.aar") releaseImplementation files(hermesPath + "hermes-release.aar") } else { implementation jscFlavor } }

// Run this once to be able to run the application with BUCK // puts all compile dependencies into folder libs for BUCK to use task copyDownloadableDepsToLibs(type: Copy) { from configurations.compile into 'libs' }

configurations.all { resolutionStrategy { force 'com.google.android.gms:play-services-gcm:17.0.0' force 'com.google.android.gms:play-services-location:17.0.0' force 'com.google.android.gms:play-services-base:17.1.0' force 'com.google.firebase:firebase-core:16.0.9' force 'com.google.firebase:firebase-messaging:18.0.0' } }

wfhm commented 3 years ago

@morelgarisi I'm sorry I didn't realize it is a question in React Native plugin repo and not in the native one. The solution to the issue is to exclude conflicting dependency from one of the libraries, so that only one instance is added to the project. However, for React Native, it is more complicated, as the dependency is added on the SDK level, so you will have to modify the plugin's source code manually after adding it from npm.

What you need to do is to exclude work-runtime dependency in the plugin's build.gradle file. It is located in your project_root/node_modules/pushwoosh-react-native-plugin/src/android. Update the dependencies section as below:

dependencies {
    implementation 'com.facebook.react:react-native:+'
    implementation ('com.pushwoosh:pushwoosh:${pushwoosh}') {
        exclude group: 'androidx.work' module: 'work-runtime'
    }
    implementation ('com.pushwoosh:pushwoosh-firebase:${pushwoosh}') {
        exclude group: 'androidx.work' module: 'work-runtime'
    }
    implementation ('com.pushwoosh:pushwoosh-huawei:${pushwoosh}') {
        exclude group: 'androidx.work' module: 'work-runtime'
    }
    implementation "com.pushwoosh:pushwoosh-amazon:${pushwoosh}"
    implementation "com.pushwoosh:pushwoosh-badge:${pushwoosh}"
    implementation "com.pushwoosh:pushwoosh-inbox:${pushwoosh}"
    implementation "com.pushwoosh:pushwoosh-inbox-ui:${pushwoosh}"
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.3.71"
    implementation "com.google.firebase:firebase-messaging:(+,20.2.2)"
}

Please let me know about the results!