0

I am working on Salesforce Chatbot development for mobile applications. I have to develop it on xamarin(.Net). For that I need to have .Net libraries but those are doesn't seem to available.

Alternate way is to get .jar files of those Android libraries, add in .Net project and use it for development.

I am looking jar file for below configuration

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

   implementation 'com.salesforce.service:chat-ui:4.3.2'

I found above information here developer.salesforce.com/docs. I am unable to download .jar files for above configuration on internet.

Than I tried to develop sample project using above libraries in android studio and get .jar files from it. I have made the project. I want to get .jar files.

I have two question now

  1. How to download .jar files for above configuration from internet OR
  2. How can I download .jar files from android studio from sample project I created

Edit 1:

Below screenshot of ChatUIConfiguration from C# .dll, there is no create method. While create there for Android public static ChatUIConfiguration create. ChatUIConfiguration has 278 lines of code in android file and C# has only 100 lines. Am I missing any dependency or I need to add multiple jars from dependency folder?

enter image description here

R15
  • 13,982
  • 14
  • 97
  • 173

1 Answers1

1

After creating your sample project, you can get the .aar dependencies in Gradle based on this fine answer:

Add the following to the build.gradle file:

configurations {
    customConfig.extendsFrom implementation
}

task copyLibs(type: Copy) {
    duplicatesStrategy = DuplicatesStrategy.INCLUDE
    from configurations.customConfig
    into "$project.rootDir/dependencies/"
}

Note the small addition regarding the duplicatesStrategy to avoid an error.

In Android Studio you can open the .gradle file, scroll to the .copyLibs task and click on the green arrow button on the left side.

This downloads the .aar files into a folder called dependencies. Among many others there is a file named chat-ui-4.3.2.aar.

Afterwards you can extract .jar files from .aar, just like described in this nice answer.

Manual Check

Finally if you want to do it manually or check against the .pom file: you can download the .pom file from here: https://s3.amazonaws.com/salesforcesos.com/android/maven/release/com/salesforce/service/chat-ui/4.3.2/chat-ui-4.3.2.pom

The other sub-dependencies are also listed there.

Stephan Schlecht
  • 26,556
  • 1
  • 33
  • 47
  • I am new to android studio. I am not very sure how to follow these steps. Can u please include first answer here as well. Also please let me know what path I need to keep here `"$project.rootDir/reports/libs/"` – R15 Mar 16 '22 at 10:30
  • 1
    @R15 probably easier if I show it in a short 50 second screencast, see https://www.software7.biz/so/iertzzaoeslkdjfoealskkdf/dependencies.mp4 (it took longer the first time because it actually downloaded packages). – Stephan Schlecht Mar 16 '22 at 17:04
  • It was helpful. I was able to get jar files. – R15 Mar 17 '22 at 11:01
  • Hi, one question, not related to this question :) . ChatUI.jar after converting into .dll file, I am not getting few methods, like `ChatUIConfiguration.create`, here `create` is not showing up. Here I am following this, if you have any idea https://developer.salesforce.com/docs/atlas.en-us.bot_cookbook.meta/bot_cookbook/bot_cookbook_android_app.htm – R15 Mar 17 '22 at 12:36
  • In Android Studio one can see that ChatUIConfiguration (package com.salesforce.android.chat.ui) offers a static method `public static ChatUIConfiguration create(@NonNull ChatConfiguration chatConfiguration)`. This comes from `com.salesforce.service:chat-ui:4.3.2@aar`. – Stephan Schlecht Mar 17 '22 at 20:55
  • I have tried `chat-ui:4.3.2` and `chat-core-4.3.2` but seems some of code is being filtered not sure how. Could you please check edit1 in my question. – R15 Mar 18 '22 at 14:10
  • The information that this `create` method comes from `chat-ui:4.3.2@aar` is displayed in Android Studio if you use this method in a demo Java file and simply hover over it with the mouse. This information is reliable. – Stephan Schlecht Mar 19 '22 at 12:31