Android包装过程中的android重复文件

时间:2016-03-30 09:33:15

标签: android android-studio

我想在android中使用img.ly库,我收到了以下错误。

Error:duplicate files during packaging of APK E:\workspace\4sale_Git\4SaleApp_Studio\_4SaleApp\build\outputs\apk\_4SaleApp-debug-unaligned.apk
        Path in archive: lib/armeabi-v7a/libblasV8.so
        Origin 1: E:\workspace\4sale_Git\4SaleApp_Studio\_4SaleApp\build\intermediates\exploded-aar\ly.img.android\photo-editor-sdk\1.0.4\jni\armeabi-v7a\libblasV8.so
        Origin 2: E:\Android\sdk\build-tools\23.0.1\renderscript\lib\packaged\armeabi-v7a\libblasV8.so
    You can ignore those files in your build.gradle:
        android {
          packagingOptions {
            exclude 'lib/armeabi-v7a/libblasV8.so'
          }
        }

我的gradle文件如下:

apply plugin: 'com.android.application'
apply plugin: 'com.mutualmobile.gradle.plugins.dexinfo'

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:2.0.0-beta6'
        classpath 'com.mutualmobile.gradle.plugins:dexinfo:0.1.2'
    }
}

android {
    compileSdkVersion 23
    buildToolsVersion "23.0.1"
    defaultConfig {
        applicationId "com.forsale.forsale"
        minSdkVersion 15
        targetSdkVersion 15
        multiDexEnabled = true
        renderscriptTargetApi 20
        renderscriptSupportModeEnabled true
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
        }
    }
    packagingOptions {

        exclude 'META-INF/DEPENDENCIES.txt'
        exclude 'META-INF/LICENSE.txt'
        exclude 'META-INF/NOTICE.txt'
        exclude 'META-INF/NOTICE'
        exclude 'META-INF/LICENSE'
        exclude 'META-INF/DEPENDENCIES'
        exclude 'META-INF/notice.txt'
        exclude 'META-INF/license.txt'
        exclude 'META-INF/dependencies.txt'
        exclude 'META-INF/LGPL2.1'
        exclude 'lib/armeabi-v7a/libblasV8.so'
    }
    dexOptions {
        incremental true
        javaMaxHeapSize "4g"
    }
    sourceSets {
        main {
            jni.srcDirs = []
            jniLibs.srcDirs = ['libs']
        }
    }
    productFlavors {
    }
}

repositories {

    jcenter()

    maven {
        url 'https://zendesk.artifactoryonline.com/zendesk/repo/'
    }

    maven {
        url "https://repo.commonsware.com.s3.amazonaws.com"
    }

    maven {
        url "https://jitpack.io"
    }

    maven {
        url "http://appboy.github.io/appboy-android-sdk/sdk"
    }
}

dependencies {
    compile project(':gestureimageview')
    compile files('libs/universal-image-loader-1.9.5.jar')
    compile files('libs/android-hipmob-2.9.8.jar')
    compile files('libs/HockeySDK-3.5.0.jar')
    compile files('libs/httpclient-4.3.jar')
    compile files('libs/httpcore-4.3.jar')
    compile files('libs/libphonenumber-5.2v1.5.jar')
    compile files('libs/NineOldAndroid-2.4.0.jar')
    compile files('libs/org.apache.commons.io.jar')
    compile files('libs/httpmime-4.3.jar')
    compile files('libs/zbar.jar')
    compile 'com.android.support:support-v4:18.0.0'
    compile 'com.zopim.android:sdk:1.1.0'
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.github.jaydeepw:poly-picker:v1.0.22'
    compile 'com.github.bmelnychuk:atv:1.2.+'
    compile 'com.wdullaer:materialdatetimepicker:2.0.2'
    compile 'com.google.android.gms:play-services:8.3.0'
    compile project(':ffmpeg4android_lib')
    compile 'com.appboy:android-sdk-ui:1.11.2'
    compile files('libs/quickblox-android-sdk-core-2.5.jar')
    compile files('libs/quickblox-android-sdk-chat-2.5.jar')
    compile files('libs/quickblox-android-sdk-content-2.5.jar')
    compile files('libs/quickblox-android-sdk-messages-2.5.jar')
    compile 'com.danikula:videocache:2.3.4'
    compile 'ly.img.android:photo-editor-sdk:1.0.4'
}

1 个答案:

答案 0 :(得分:0)

更改以下行:

exclude 'META-INF/DEPENDENCIES.txt'
        exclude 'META-INF/LICENSE.txt'
        exclude 'META-INF/NOTICE.txt'
        exclude 'META-INF/NOTICE'
        exclude 'META-INF/LICENSE'
        exclude 'META-INF/DEPENDENCIES'
        exclude 'META-INF/notice.txt'
        exclude 'META-INF/license.txt'
        exclude 'META-INF/dependencies.txt'
        exclude 'META-INF/LGPL2.1'
        exclude 'lib/armeabi-v7a/libblasV8.so'

exclude 'META-INF/DEPENDENCIES.txt'
            exclude 'META-INF/LICENSE.txt'
            exclude 'META-INF/NOTICE.txt' 
            exclude 'META-INF/LGPL2.1'

清理你的项目并重建。