urbanairship / android-library

Urban Airship Android SDK
Other
107 stars 124 forks source link

Conflicting dependencies after updating to v18.0.0 #240

Closed keapear closed 1 month ago

keapear commented 1 month ago

Preliminary Info

What Airship dependencies are you using?

Currently 17.8.1, attempting to update to 18.0.0 Airship FCM, Airship In App

What are the versions of any relevant development tools you are using?

Gradle 8.4.2 JUnit 4.13.2 Mockk 1.13.11 Mockito 5.12.0 Mockito Kotlin 5.3.1

Report

What unexpected behavior are you seeing?

When updating Airship to 18.0.0, my imports for Hamcrest Matchers can no longer be resolved. It seems I'm getting a different hamcrest version through the Airship SDK. In general, when comparing dependency trees I've noticed that a lot more dependencies are listed for Airship after the update. Before I start excluding dependencies, I wanted to check if this is intentional on your side or a missing configuration of some sort.

jyaganeh commented 1 month ago

Hi @keapear, could you paste your dependencies block and the error message that Gradle is failing with, so I can try to reproduce the issue?

We updated the Kotlin version (from 1.7.10 to 1.9.21) and bumped versions on several AndroidX libraries, play services, and firebase messaging, but I'm not aware of anything specific that would cause issues with Hamcrest.

keapear commented 1 month ago

I've created a new project and just copied our dependencies and removed them bit by bit to narrow it down. It seems the conflict is with androidx.test.espresso:espresso-contrib (we use 3.5.1, but it still happens with yesterday's 3.6.0 release).

The error is

Task :app:compileDebugAndroidTestKotlin FAILED e: file:///Users/lhgkea0/workspace/tmp/MyApplication/app/src/androidTest/java/com/test/mobileapps/myapplication/ExampleInstrumentedTest.kt:9:21 Unresolved reference: Matchers e: file:///Users/lhgkea0/workspace/tmp/MyApplication/app/src/androidTest/java/com/test/mobileapps/myapplication/ExampleInstrumentedTest.kt:28:49 Unresolved reference: not

for import org.hamcrest.Matchers.not

dependencies {

    implementation(libs.kotlin)
    implementation(libs.recyclerView)

    // Testing dependencies
    androidTestImplementation(libs.espressoContrib)

    implementation(platform(libs.composeBom))
    androidTestImplementation(platform(libs.composeBom))
    implementation(libs.composeFoundation)
    implementation(libs.composeRuntime)
    implementation(libs.composeUi)
    implementation(libs.composeTooling)
    implementation(libs.composeMaterial)
    implementation(libs.composeMaterial3)
    implementation(libs.composeActivity)

    androidTestImplementation(libs.composeTest)
    implementation(libs.airshipFcm)
    implementation(libs.airshipInApp)

    androidTestImplementation(libs.runner)
    androidTestUtil(libs.orchestrator)
    androidTestImplementation(libs.rules)
    androidTestImplementation(libs.espresso)
    androidTestImplementation(libs.espressoIntents)
    androidTestImplementation(libs.core)
    androidTestImplementation(libs.archCore)
    androidTestImplementation(libs.mockkAndroid)
    androidTestImplementation(libs.kluentAndroid)
    androidTestImplementation(libs.workTest)
    androidTestImplementation(libs.kluentAndroid)
    androidTestImplementation(libs.uiAutomator)
}

the libs.versions.toml:

[versions]
# Build dependencies
gradle = "8.4.2"

# Main dependencies
kotlin = "1.9.24"
recyclerView = "1.3.2"
work = "2.9.0"
airship = "18.0.0"

# Compose
composeBom = "2024.06.00"

# Testing dependencies
mockk = "1.13.11"
archCore = "2.2.0"
kluent = "1.73"

# Instrumented testing dependencies
testRunner = "1.5.2"
testRules = "1.5.0"
testOrchestrator = "1.4.2"
testCore = "1.5.0"
testEspressoCore = "3.6.0"
uiAutomator = "2.3.0"

[libraries]
kotlin = { module = "org.jetbrains.kotlin:kotlin-stdlib-jdk8", version.ref = "kotlin" }

# Android Dependencies
recyclerView = { module = "androidx.recyclerview:recyclerview", version.ref = "recyclerView" }
composeBom = { module = "androidx.compose:compose-bom", version.ref = "composeBom" }
composeUi = { module = "androidx.compose.ui:ui" }
composeFoundation = { module = "androidx.compose.foundation:foundation" }
composeRuntime = { module = "androidx.compose.runtime:runtime" }
composeTooling = { module = "androidx.compose.ui:ui-tooling" }
composeMaterial = { module = "androidx.compose.material:material" }
composeMaterial3 = { module = "androidx.compose.material3:material3" }
composeActivity = { module = "androidx.activity:activity-compose" }
airshipFcm = { module = "com.urbanairship.android:urbanairship-fcm", version.ref = "airship" }
airshipInApp = { module = "com.urbanairship.android:urbanairship-automation", version.ref = "airship" }

# Test Dependencies
runner = { module = "androidx.test:runner", version.ref = "testRunner" }
orchestrator = { module = "androidx.test:orchestrator", version.ref = "testOrchestrator" }
rules = { module = "androidx.test:rules", version.ref = "testRules" }
espresso = { module = "androidx.test.espresso:espresso-core", version.ref = "testEspressoCore" }
espressoContrib = { module = "androidx.test.espresso:espresso-contrib", version.ref = "testEspressoCore" }
espressoIntents = { module = "androidx.test.espresso:espresso-intents", version.ref = "testEspressoCore" }
core = { module = "androidx.test:core", version.ref = "testCore" }
mockkAndroid = { module = "io.mockk:mockk-android", version.ref = "mockk" }
archCore = { module = "androidx.arch.core:core-testing", version.ref = "archCore" }
kluentAndroid = { module = "org.amshove.kluent:kluent-android", version.ref = "kluent" }
workTest = { module = "androidx.work:work-testing", version.ref = "work" }
uiAutomator = { module = "androidx.test.uiautomator:uiautomator", version.ref = "uiAutomator" }
composeTest = { module = "androidx.compose.ui:ui-test-junit4" }

[plugins]
android-application = { id = "com.android.application", version.ref = "gradle" }
jetbrains-kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" }
jyaganeh commented 1 month ago

@keapear it looks like this is happening because a test dependency snuck into implementation in the automation module. we'll fix this in the next release, but in the meantime, you can use the following workaround:

    implementation(libs.airship.automation) {
        exclude(group = "androidx.test.ext", module = "junit")
    }
keapear commented 1 month ago

@jyaganeh Alright, thank you!

rlepinski commented 1 month ago

Should be fixed in 18.1.1