Search code examples
androidazuregradlechat

Android Azure Communication chat UI library import?


I want to use Azure Communication UI mobile library for android - Chat. https://github.com/Azure/communication-ui-library-android/tree/main/azure-communication-ui/chat#installation

I followed every step (pickFirst, implementation, maven url), but when I'm trying to start my app, I got the following error:

Configuration cache state could not be cached: field `__librarySourceSets__`of task`:app:mapDebugSourceSetPaths`of type`com.android.build.gradle.tasks.MapSourceSetPathsTask\`: error writing value of type 'org.gradle.api.internal.file.collections.DefaultConfigurableFileCollection'

> Could not resolve all files for configuration ':app:debugRuntimeClasspath'.
> Could not find com.microsoft.device:dualscreen-layout:1.0.0-alpha01.
> Searched in the following locations:
> \- https://dl.google.com/dl/android/maven2/com/microsoft/device/dualscreen-layout/1.0.0-alpha01/dualscreen-layout-1.0.0-alpha01.pom
> \- https://repo.maven.apache.org/maven2/com/microsoft/device/dualscreen-layout/1.0.0-alpha01/dualscreen-layout-1.0.0-alpha01.pom
> \- https://plugins.gradle.org/m2/com/microsoft/device/dualscreen-layout/1.0.0-alpha01/dualscreen-layout-1.0.0-alpha01.pom
> Required by:
> project :app \> com.azure.android:azure-communication-ui-chat:1.0.0-beta.2 \> com.microsoft.fluentui:fluentui_others:0.1.2
> project :app \> com.azure.android:azure-communication-ui-chat:1.0.0-beta.2 \> com.microsoft.fluentui:fluentui_others:0.1.2 \> com.microsoft.fluentui:fluentui_core:0.1.7\`

It looks like gradle is not using the maven url I provided in the previous steps...

I tried everything:

  • Project clean,
  • Rebuild,
  • Sync project with Gradle files,
  • Invalidate cache and restart..

Solution

  • The above error occurs when Gradle cannot resolve a required dependency. it's failing to find com.microsoft.device:dualscreen-layout:1.0.0-alpha01

    Correctly added the Azure Maven repository URL to the project-level build.gradle file under allprojects repositories. It should look like this:

    allprojects {
        repositories {
            // ...
            maven {
                url 'https://pkgs.dev.azure.com/azure-telephony/public/_packaging/azure-sdk-for-android/maven/v1'
            }
        }
    }
    

    Try this different version:

    implementation 'com.azure.android:azure-communication-ui-chat:1.0.0-beta.2'
    implementation 'com.microsoft.fluentui:fluentui_others:0.1.3' // or a different version
    

    You can use Gradle's transitive dependency exclusion to exclude the problematic dependency transitively.

    implementation ('com.azure.android:azure-communication-ui-chat:1.0.0-beta.2') {
        exclude group: 'com.microsoft.device', module: 'dualscreen-layout'
    }