Build Failure Due to Gradle Task Dependency in intercom-react-native | Community
Skip to main content

Hello Intercom team,

I am encountering a Gradle build error when integrating the intercom-react-native library into my React Native project. The issue seems related to an implicit task dependency conflict.

Error details:

A problem was found with the configuration of task ':intercom-react-native:copyDebugJniLibsProjectAndLocalJars' (type 'LibraryJniLibsTask').
Gradle detected a problem with the following location: '[project path]/node_modules/@intercom/intercom-react-native/android/build/intermediates/stripped_native_libs/debug/stripDebugDebugSymbols/out'.

Reason: Task ':intercom-react-native:copyDebugJniLibsProjectAndLocalJars' uses output from ':intercom_intercom-react-native:stripDebugDebugSymbols' without declaring a dependency.

Attempted solutions:

  • Cleaned Gradle build and cache.

  • Added explicit task dependencies using afterEvaluate, but encountered errors related to task names not found.

Could you please assist in resolving this issue or provide guidance on properly handling this Gradle task dependency?

Hey there ​@alexd, Emily here from the Support Engineering team at Intercom 👋🏼

 

This is a common issue related to task dependency conflicts in Android builds. This issue is often related to Gradle version compatibility, let me help you resolve this!

 

The error indicates that Gradle detected an implicit dependency between tasks without proper declaration. Specifically:
:intercom-react-native:copyDebugJniLibsProjectAndLocalJars is using output from :intercom_intercom-react-native:stripDebugDebugSymbols
But there's no explicit dependency declared between these tasks

 

Can you ensure you are using the most up to date version of the React Native library? Also please ensure to look for other native libraries that might be causing conflicts in your android/app/build.gradle.


Solutions to Try
1. Update Gradle Configuration
First, try updating your android/build.gradle file to use more recent versions:

// android/build.gradle
buildscript {
    ext {
        buildToolsVersion = "33.0.0"
        minSdkVersion = 21
        compileSdkVersion = 33
        targetSdkVersion = 33
        // Update Gradle version
        gradleVersion = "7.5.1"
    }
}


2. Add Task Dependencies in android/app/build.gradle
Add this to your android/app/build.gradle file: 

android {
    // ... existing config
    
    tasks.whenTaskAdded { task ->
        if (task.name.contains('copyDebugJniLibsProjectAndLocalJars')) {
            task.dependsOn(':intercom-react-native:stripDebugDebugSymbols')
        }
        if (task.name.contains('copyReleaseJniLibsProjectAndLocalJars')) {
            task.dependsOn(':intercom-react-native:stripReleaseDebugSymbols')
        }
    }
}


3. Alternative: Use afterEvaluate

If the above doesn't work, try this approach in android/app/build.gradle:

android {
    // ... existing config
}

project.afterEvaluate {
    def copyDebugTask = tasks.findByName('copyDebugJniLibsProjectAndLocalJars')
    def stripDebugTask = project(':intercom-react-native').tasks.findByName('stripDebugDebugSymbols')
    
    if (copyDebugTask && stripDebugTask) {
        copyDebugTask.dependsOn(stripDebugTask)
    }
    
    def copyReleaseTask = tasks.findByName('copyReleaseJniLibsProjectAndLocalJars')
    def stripReleaseTask = project(':intercom-react-native').tasks.findByName('stripReleaseDebugSymbols')
    
    if (copyReleaseTask && stripReleaseTask) {
        copyReleaseTask.dependsOn(stripReleaseTask)
    }
}


After making changes, clean everything and rebuilt.

 

Hopefully one of those solutions solves your issue here 💪🏼


Reply