8

これをデバッグする方法を知っている人はいますか? どのライブラリが問題を引き起こしているのかわかりません。

補足として、これは Android テストを実行しようとしたときにのみ発生するため、何らかのテスト ライブラリに関連していると推測されます。


    testImplementation "androidx.room:room-testing:$version_room"
    testImplementation 'junit:junit:4.13.2'
    androidTestImplementation 'androidx.test.ext:junit:1.1.3'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
    androidTestImplementation 'androidx.test.espresso:espresso-contrib:3.4.0'
    // Compose Tests
    androidTestImplementation "androidx.compose.ui:ui-test-junit4:$version_compose"
    debugImplementation "androidx.compose.ui:ui-test-manifest:$version_compose"
    // Hilt test
    androidTestImplementation "com.google.dagger:hilt-android-testing:$version_hilt"
    kaptAndroidTest "com.google.dagger:hilt-android-compiler:$version_hilt"
    debugImplementation 'androidx.fragment:fragment-testing:1.3.6'
Execution failed for task ':app:mergeDebugAndroidTestJavaResource'.
> A failure occurred while executing com.android.build.gradle.internal.tasks.MergeJavaResWorkAction
   > 2 files found with path 'META-INF/LGPL2.1' from inputs:
      - /home/lbenevento/.gradle/caches/transforms-3/1e2dfa6057fe4e701d175f47b1099efa/transformed/jetified-jna-platform-5.5.0.jar
      - /home/lbenevento/.gradle/caches/transforms-3/405542266c1c406c39ff1a20cb26a332/transformed/jetified-jna-5.5.0.jar
     Adding a packagingOptions block may help, please refer to
     https://google.github.io/android-gradle-dsl/current/com.android.build.gradle.internal.dsl.PackagingOptions.html
     for more information

* Try:
Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Exception is:
org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':app:mergeDebugAndroidTestJavaResource'.
    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.lambda$executeIfValid$1(ExecuteActionsTaskExecuter.java:187)
    at org.gradle.internal.Try$Failure.ifSuccessfulOrElse(Try.java:268)
...

これは完全なエラーです: https://pastebin.com/74cLGMR9

4

3 に答える 3

12

これは、私が追加したときに起こりましたandroidTestImplementation "androidx.compose.ui:ui-test-junit4:$version_compose"

この投稿のアドバイスを参照して、ではpickFirstなくを使用することにしましたexclude

PackagingOptions のドキュメントによると、pickFirstでは、最初に出現したファイルを APK と一緒にパッケージ化できますが、そのexcludeファイルはすべて除外されます。

これは私のために働いた:

android {
    packagingOptions {
        pickFirst 'META-INF/AL2.0'
        pickFirst 'META-INF/LGPL2.1'
    }
}
于 2021-11-05T06:21:46.740 に答える