KotlinのプロジェクトにAdobe Creative SDKを導入しapkを作成しようとしたところ以下のエラーでハマった。
Error:Execution failed for task ':app:transformClassesWithJarMergingForDebug'.
> com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: org/intellij/lang/annotations/Identifier.class
Identifier.class
でgrepすると以下の用にannotations-12.0.jarとannotation-13.jarが使用されようとしていた。
$./gradlew assembleDebug --stacktrace --info | grep Identifier.class
addJar(/Users/ユーザー名/.gradle/caches/modules-2/files-2.1/com.intellij/annotations/12.0/bbcf6448f6d40abe506e2c83b70a3e8bfd2b4539/annotations-12.0.jar): entry org/intellij/lang/annotations/Identifier.class
addJar(/Users/ユーザー名/.gradle/caches/modules-2/files-2.1/org.jetbrains/annotations/13.0/919f0dfe192fb4e063e7dacadee7f8bb9a2672a9/annotations-13.0.jar): entry org/intellij/lang/annotations/Identifier.class
古い(であろう)12の方のcom.intellij
のannotationsを次のように除外設定することで無事ビルドできるようになりました。
appモジュールのbuild.gradle
android {
// 中略
configurations.all {
exclude group: 'com.intellij', module:'annotations'
}
}
なんかいつもgradle周りは行き当たりばったりの解決で理解が深まらないぜ!
まぁしかたないが、記録に残せば何か変わるかも。