0

I am trying to setup a mockk mock for a test:

@RunWith(AndroidJUnit4::class)
class MyTest {

   @Test
   fun canary() {
  }
}

I ran into:

6 files found with path 'META-INF/LICENSE.md'.
6 files found with path 'META-INF/LICENSE-notice.md'.

I added both to my build.gradle package options:

packagingOptions {
    exclude 'META-INF/INDEX.LIST'
    exclude 'META-INF/LICENSE.md'
}

After that I ran into following exception:

2 files found with path 'dispatcher.jar'.
Adding a packagingOptions block may help, please refer to
https://developer.android.com/reference/tools/gradle-api/8.0/com/android/build/api/dsl/ResourcesPackagingOptions
for more information

If I exclude dispatcher.jar, I get a an exception saying its not found.

Using the following dependencies:

testImplementation 'org.jetbrains.kotlinx:kotlinx-coroutines-test:1.6.4'
testImplementation 'org.mockito:mockito-core:5.3.1'
testImplementation 'org.mockito:mockito-inline:5.2.0'
testImplementation "org.mockito.kotlin:mockito-kotlin:3.2.0"
testImplementation "io.mockk:mockk:1.13.5"

androidTestImplementation 'org.mockito:mockito-core:5.3.1'
androidTestImplementation 'com.linkedin.dexmaker:dexmaker-mockito-inline:2.28.3'
androidTestImplementation "org.mockito.kotlin:mockito-kotlin:3.2.0"
androidTestImplementation "io.mockk:mockk-android:1.13.5"

Possible cause due to using mockk and mockito in same project?

Not really sure what I am missing, any help would be greatly appreciated.

Is there an easy way to find duplicate files in android studio so I can at least get more info on what dependencies are causing the issue?

lostintranslation
  • 23,756
  • 50
  • 159
  • 262

0 Answers0