导入FAT JAR后,出现编译错误:
More than one file was found with OS independent path 'kotlin/collections/MapWithDefault.kotlin_metadata'
问题在于某些类是重复的
Duplicate class kotlin.ArrayIntrinsicsKt found in modules com.fiskaly.kassensichv.client-android-0.0.1-alpha-all.jar (com.fiskaly.kassensichv.client-android-0.0.1-alpha-all.jar) and kotlin-stdlib-1.3.50.jar (org.jetbrains.kotlin:kotlin-stdlib:1.3.50)
Duplicate class kotlin.BuilderInference found in modules com.fiskaly.kassensichv.client-android-0.0.1-alpha-all.jar (com.fiskaly.kassensichv.client-android-0.0.1-alpha-all.jar) and kotlin-stdlib-1.3.50.jar (org.jetbrains.kotlin:kotlin-stdlib:1.3.50)
Duplicate class kotlin.Deprecated found in modules com.fiskaly.kassensichv.client-android-0.0.1-alpha-all.jar (com.fiskaly.kassensichv.client-android-0.0.1-alpha-all.jar) and kotlin-stdlib-1.3.50.jar (org.jetbrains.kotlin:kotlin-stdlib:1.3.50)
Duplicate class kotlin.DeprecationLevel found in modules com.fiskaly.kassensichv.client-android-0.0.1-alpha-all.jar (com.fiskaly.kassensichv.client-android-0.0.1-alpha-all.jar) and kotlin-stdlib-1.3.50.jar (org.jetbrains.kotlin:kotlin-stdlib:1.3.50)
Duplicate class kotlin.DslMarker found in modules com.fiskaly.kassensichv.client-android-0.0.1-alpha-all.jar (com.fiskaly.kassensichv.client-android-0.0.1-alpha-all.jar) and kotlin-stdlib-1.3.50.jar (org.jetbrains.kotlin:kotlin-stdlib:1.3.50)
Duplicate class kotlin.ExceptionsKt found in modules com.fiskaly.kassensichv.client-android-0.0.1-alpha-all.jar (com.fiskaly.kassensichv.client-android-0.0.1-alpha-all.jar) and kotlin-stdlib-1.3.50.jar (org.jetbrains.kotlin:kotlin-stdlib:1.3.50)
Duplicate class kotlin.ExceptionsKt__ExceptionsKt found in modules com.fiskaly.kassensichv.client-android-0.0.1-alpha-all.jar (com.fiskaly.kassensichv.client-android-0.0.1-alpha-all.jar) and kotlin-stdlib-1.3.50.jar (org.jetbrains.kotlin:kotlin-stdlib:1.3.50)
Duplicate class kotlin.Experimental found in modules com.fiskaly.kassensichv.client-android-0.0.1-alpha-all.jar (com.fiskaly.kassensichv.client-android-0.0.1-alpha-all.jar) and kotlin-stdlib-1.3.50.jar (org.jetbrains.kotlin:kotlin-stdlib:1.3.50)
Duplicate class kotlin.Experimental$Level found in modules com.fiskaly.kassensichv.client-android-0.0.1-alpha-all.jar (com.fiskaly.kassensichv.client-android-0.0.1-alpha-all.jar) and kotlin-stdlib-1.3.50.jar (org.jetbrains.kotlin:kotlin-stdlib:1.3.50)
...
我的问题是,如何从FAT JAR文件中排除某些类。 我尝试过:
implementation files('libs/com.fiskaly.kassensichv.client-android-0.0.1-alpha-all.jar'){
exclude group: 'kotlin'
}
但是它返回一个错误,因为基于文件的依赖项无法以与来自存储库的依赖项相同的方式工作。没有与之关联的元数据(例如,没有依赖项信息),因此也没有要排除的内容(因为没有传递性依赖项)。