Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mockk 1.13.4 incompatible with newest Espresso 3.5.1 #1049

Open
bardss opened this issue Feb 14, 2023 · 4 comments
Open

Mockk 1.13.4 incompatible with newest Espresso 3.5.1 #1049

bardss opened this issue Feb 14, 2023 · 4 comments

Comments

@bardss
Copy link

bardss commented Feb 14, 2023

Current Behaviour

Can't compile the UI tests when both libraries are up to date.

Stack trace

Conflicting dependencies.

Execution failed for task ':app:mergeBetaGoogleDebugAndroidTestJavaResource'.
> A failure occurred while executing com.android.build.gradle.internal.tasks.MergeJavaResWorkAction
   > 6 files found with path 'META-INF/LICENSE.md' from inputs:
      -  /.gradle/caches/transforms-3/6dfd85e72e15c63726cf3c42457387f2/transformed/jetified-junit-jupiter-params-5.8.2.jar
      -  /.gradle/caches/transforms-3/e35a977ef4e223be92acbd5e2adc05a1/transformed/jetified-junit-jupiter-engine-5.8.2.jar
      -  /.gradle/caches/transforms-3/9d561480ebda6801001df44437b79170/transformed/jetified-junit-jupiter-api-5.8.2.jar
      -  /.gradle/caches/transforms-3/41ac4d1eef3b02247748fcdbc1cc582d/transformed/jetified-junit-platform-engine-1.8.2.jar
      -  /.gradle/caches/transforms-3/c8cdef0955d28dff5140f2ef1e4edb19/transformed/jetified-junit-platform-commons-1.8.2.jar
      -  /.gradle/caches/transforms-3/3af63abd3b28928017a3687d103868bc/transformed/jetified-junit-jupiter-5.8.2.jar
     Adding a packagingOptions block may help, please refer to
     https://developer.android.com/reference/tools/gradle-api/7.4/com/android/build/api/dsl/ResourcesPackagingOptions
     for more information

Context

  • MockK version: 1.13.4
  • OS: MacOS 13.2
  • Kotlin version: 1.7.21
  • JDK version: Java 11
  • JUnit version: 4.13.2
  • Type of test: android instrumented test
  • Espresso: 3.5.1
    androidTestImplementation "io.mockk:mockk-android:1.13.4"
    androidTestImplementation "androidx.test:core-ktx:1.5.0"
    androidTestImplementation "androidx.test.ext:junit-ktx:1.1.5"
    androidTestImplementation "androidx.test.espresso:espresso-core:3.5.1"
    androidTestImplementation "androidx.test.espresso:espresso-intents:3.5.1"
    androidTestImplementation "androidx.test.espresso:espresso-contrib:3.5.1"
    androidTestImplementation "androidx.test.uiautomator:uiautomator:2.2.0"
    androidTestImplementation "androidx.test:runner:1.5.2"
    androidTestImplementation "androidx.test:rules:1.5.0"
@opt05
Copy link

opt05 commented Feb 14, 2023

Can you try merging your files that are conflicting, like this (in your app/build.gradle.kts file):

android {
   packagingOptions.resources.merges.addAll(listOf("META-INF/LICENSE.md"))
}

This is common with gradle dependencies that have matching file names and isn't specific to mockk

@Yeroshin
Copy link

Yeroshin commented Apr 7, 2023

Can you try merging your files that are conflicting, like this (in your app/build.gradle.kts file):

android {
   packagingOptions.resources.merges.addAll(listOf("META-INF/LICENSE.md"))
}

This is common with gradle dependencies that have matching file names and isn't specific to mockk

Could not find method listOf() .....

@Yeroshin
Copy link

Yeroshin commented Apr 7, 2023

packagingOptions {
exclude("META-INF/LICENSE.md")

}

also not worked

@herrbert74
Copy link

I'm on a previous version of Espresso, but had the same issue. This works:

packagingOptions {
	resources.excludes.add("META-INF/LICENSE.md")
	resources.excludes.add("META-INF/LICENSE-notice.md")
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants