现在的位置: 首页 > IT运维 > 正文

Duplicate files copied in APK lib/arm64-v8a/libGNaviData.so

2017年09月27日 IT运维 ⁄ 共 1389字 暂无评论 ⁄ 被围观 0+

Error:Execution failed for task ':youProject:transformNativeLibsWithMergeJniLibsForDebug'.

> com.android.build.api.transform.TransformException: com.android.builder.packaging.DuplicateFileException: Duplicate files copied in APK lib/arm64-v8a/libGNaviData.so
    File1: [gradle cache dir]\.gradle\caches\modules-2\files-2.1\com.amap.api\3dmap\5.3.0\134242459debbdb0f08856d8036e40b38f8d772b\3dmap-5.3.0.jar
    File2: [library build dir]\intermediates\bundles\default\jni
app: build.gradle
dependencies {
    compile(project(":library")) {
        exclude group: "com.amap.api"
    }
library: build.gradle
import com.android.build.gradle.internal.pipeline.TransformTask
def deleteDuplicateJniFiles() {
    def files = fileTree("${buildDir}/intermediates/bundles/default/jni/") {
        include '**/libGNaviData.so'
        include '**/libRoadLineRebuildAPI.so'
        include '**/libGNaviSearch.so'
        include '**/libGNaviMap.so'
        include '**/libGNaviMapex.so'
        include '**/libGNaviUtils.so'
    }
    files.each { it.delete() }
}
tasks.withType(TransformTask) {
    pkgTask -> pkgTask.doLast { deleteDuplicateJniFiles() }
}
//may be use below codes replace the delete operations
android{
    packagingOptions {
        exclude 'lib*//*//*libGNaviData.so'
        exclude 'lib*//*//*libRoadLineRebuildAPI.so'
        exclude 'lib*//*//*libGNaviSearch.so'
        exclude 'lib*//*//*libGNaviMap.so'
        exclude 'lib*//*//*libGNaviMapex.so'
        exclude 'lib*//*//*libGNaviUtils.so'
    }
...

给我留言

您必须 [ 登录 ] 才能发表留言!

×
#