1

I am developing an open-source react native library that it's a wrapper for the Salesforce SDK chat. This library uses a Salesforce maven dependency that is hosted on an AWS S3 Bucket.

The problem is that when I try to use this library on a project SomeProject that has support for RN autolinking, I keep receiving these build errors:

Could not find com.salesforce.service:chat-ui:4.1.1.
Searched in the following locations:
  - file:/Users/user/Library/Android/sdk/extras/m2repository/com/salesforce/service/chat-ui/4.1.1/chat-ui-4.1.1.pom
  - file:/Users/user/Library/Android/sdk/extras/m2repository/com/salesforce/service/chat-ui/4.1.1/chat-ui-4.1.1.jar
  - file:/Users/user/Library/Android/sdk/extras/google/m2repository/com/salesforce/service/chat-ui/4.1.1/chat-ui-4.1.1.pom
  - file:/Users/user/Library/Android/sdk/extras/google/m2repository/com/salesforce/service/chat-ui/4.1.1/chat-ui-4.1.1.jar
  - file:/Users/user/Library/Android/sdk/extras/android/m2repository/com/salesforce/service/chat-ui/4.1.1/chat-ui-4.1.1.pom
  - file:/Users/user/Library/Android/sdk/extras/android/m2repository/com/salesforce/service/chat-ui/4.1.1/chat-ui-4.1.1.jar
  - file:/Users/user/.m2/repository/com/salesforce/service/chat-ui/4.1.1/chat-ui-4.1.1.pom
  - file:/Users/user/.m2/repository/com/salesforce/service/chat-ui/4.1.1/chat-ui-4.1.1.jar
  - https://dl.google.com/dl/android/maven2/com/salesforce/service/chat-ui/4.1.1/chat-ui-4.1.1.pom
  - https://dl.google.com/dl/android/maven2/com/salesforce/service/chat-ui/4.1.1/chat-ui-4.1.1.jar
  - https://jcenter.bintray.com/com/salesforce/service/chat-ui/4.1.1/chat-ui-4.1.1.pom
  - https://jcenter.bintray.com/com/salesforce/service/chat-ui/4.1.1/chat-ui-4.1.1.jar
  - file:/Users/user/Workspace/rhodes/node_modules/react-native/android/com/salesforce/service/chat-ui/4.1.1/chat-ui-4.1.1.pom
  - file:/Users/user/Workspace/rhodes/node_modules/react-native/android/com/salesforce/service/chat-ui/4.1.1/chat-ui-4.1.1.jar
Required by:
    project :app > project :@loadsmart_rn-salesforce-chat

To make it work, I need to manually add the S3 maven dependency on my project SomeProject. This is bad because I want to give support for RN autolinking in this library.

I also noticed that the chat-ui dependency files (aars) are being downloaded to ~/.gradle/caches/modules-2/files-2.1/, instead of the .m2 or Android/sdk/extras/....

Libraries' build.gradle:

buildscript {
    repositories {
        jcenter()
        google()
    }

    dependencies {
        classpath 'com.android.tools.build:gradle:4.0.0'
    }
}

apply plugin: 'com.android.library'

android {
    compileSdkVersion 29
    buildToolsVersion "29.0.2"

    defaultConfig {
        minSdkVersion 19
        targetSdkVersion 29
        versionCode 1
        versionName "1.0"
    }
    lintOptions {
        abortOnError false
    }
    buildTypes {
        release {
            minifyEnabled true
        }
    }
}

dependencies {
    implementation 'com.facebook.react:react-native:+'
    implementation "com.salesforce.service:chat-ui:4.1.1"
    implementation "androidx.legacy:legacy-support-core-ui:1.0.0"
}

allprojects {
    repositories {
        google()
        jcenter()
        maven {
            url 'https://s3.amazonaws.com/salesforcesos.com/android/maven/release'
        }
    }
}

So, is there a solution to this problem? I really don't want to force the user to edit their own build.gradle file to use the lib.

1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.