0

After upgrading Microsoft Graph dependency in my project from implementation 'com.microsoft.graph:microsoft-graph:2.10.0' to implementation 'com.microsoft.graph:microsoft-graph:3.0.0' the compilation fails with following error:

Duplicate class javax.activation.ActivationDataFlavor found in modules jetified-activation-1.1 (javax.activation:activation:1.1) and jetified-jakarta.activation-api-1.2.1 (jakarta.activation:jakarta.activation-api:1.2.1)
Duplicate class javax.activation.CommandInfo found in modules jetified-activation-1.1 (javax.activation:activation:1.1) and jetified-jakarta.activation-api-1.2.1 (jakarta.activation:jakarta.activation-api:1.2.1)

...

Duplicate class javax.activation.UnsupportedDataTypeException found in modules jetified-activation-1.1 (javax.activation:activation:1.1) and jetified-jakarta.activation-api-1.2.1 (jakarta.activation:jakarta.activation-api:1.2.1)

Have any of you seen this before, and how do I fix this behaviour ?

Anyone knows if the changes in v3.0.0 are so severe that they can`t coexist with this dependency scheme ?

dependencies {
    implementation platform('com.google.firebase:firebase-bom:26.1.0')
    implementation 'com.google.firebase:firebase-crashlytics-ktx'
    implementation 'com.google.firebase:firebase-analytics-ktx'
    implementation 'com.google.firebase:firebase-perf-ktx'
    implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.4.3'
    implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.4.3'
    implementation 'androidx.core:core-ktx:1.5.0-beta03'
    implementation 'androidx.appcompat:appcompat:1.3.0-beta01'
    implementation 'androidx.camera:camera-camera2:1.1.0-alpha02'
    implementation 'androidx.camera:camera-lifecycle:1.1.0-alpha02'
    implementation 'androidx.camera:camera-view:1.0.0-alpha22'
    implementation 'androidx.constraintlayout:constraintlayout:2.1.0-beta01'
    implementation 'androidx.navigation:navigation-fragment-ktx:2.3.4'
    implementation 'androidx.navigation:navigation-ui-ktx:2.3.4'
    implementation 'androidx.fragment:fragment-ktx:1.3.1'
    implementation 'androidx.lifecycle:lifecycle-livedata-ktx:2.3.0'
    implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.3.0'
    implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.3.0'
    implementation 'androidx.legacy:legacy-support-v4:1.0.0'  
    implementation 'androidx.room:room-runtime:2.3.0-beta03'
    kapt 'androidx.room:room-compiler:2.3.0-beta03'
    implementation 'androidx.room:room-testing:2.3.0-beta03'
    implementation 'androidx.room:room-ktx:2.3.0-beta03'
    implementation 'androidx.preference:preference-ktx:1.1.1'
    implementation 'androidx.localbroadcastmanager:localbroadcastmanager:1.1.0-alpha01'
    implementation 'androidx.recyclerview:recyclerview:1.2.0-beta02'
    implementation ('com.microsoft.identity.client:msal:2.0.8')
            {exclude group: 'com.microsoft.device.display'}
    implementation ('com.microsoft.graph:microsoft-graph:3.0.0')
    implementation 'com.google.android.material:material:1.4.0-alpha01'
    //Guava, to avoid conflict on ListenableFuture on jetified-guava-20.0 (com.google.guava:guava:20.0)
    // and jetified-listenablefuture-1.0 (com.google.guava.listenablefuture:1.0)
    // https://stackoverflow.com/questions/56639529/duplicate-class-com-google-common-util-concurrent-listenablefuture-found-in-modu
    implementation 'com.google.guava:guava:30.1-jre'
    implementation 'com.google.android.gms:play-services-maps:17.0.0'
    implementation 'com.google.maps.android:android-maps-utils:2.2.0'
    implementation 'com.google.android.gms:play-services-location:18.0.0'
    implementation 'com.squareup.retrofit2:retrofit:2.9.0'
    implementation 'com.squareup.retrofit2:converter-gson:2.9.0'
    implementation 'com.squareup.okhttp3:logging-interceptor:5.0.0-alpha.2'
    implementation 'com.squareup.okhttp3:okhttp:5.0.0-alpha.2'

}
Roar Grønmo
  • 2,926
  • 2
  • 24
  • 37
  • the error message was longer, but I got an error when posting it... – Roar Grønmo Mar 18 '21 at 19:21
  • Whenever i upgrade the dependencies, i will just make sure i will update all the modules, rather than the selected ones... also i do the same for the latest SDK (production ready ones).. if you still face the issue then consider filing a bug at the Microsoft Graph SDK for Java as well. – Dev Mar 26 '21 at 05:37
  • Actually I did so, I got some answers, but haven't succeeded complete yet to get to work properly. Need to do some more severe testing. https://github.com/microsoftgraph/msgraph-sdk-java/issues/705 – Roar Grønmo Mar 26 '21 at 21:09

1 Answers1

0

Actually this version change is breaking, and here is the migration guide:

https://www.github.com/microsoftgraph/msgraph-sdk-java/tree/dev/docs%2Fupgrade-to-v3.md

But you might also add some exclusions in your packaging option in build.gradle (:app) like:

    packagingOptions{
        exclude("META-INF/INDEX.LIST")
        exclude("META-INF/AL2.0")
        exclude("META-INF/LGPL2.1")
        exclude("META-INF/LICENSE.md")
        exclude("META-INF/NOTICE.md")
        exclude("META-INF/io.netty.versions.properties")
    }

You might need add some more...

Roar Grønmo
  • 2,926
  • 2
  • 24
  • 37