More than one file was found with OS independent path ‘META-INF/LICENSE.md‘(管用)

META-INF/LICENSE.md文件多余
解决:
在相应module的build.gradle中添加exclude

  packagingOptions {
        exclude 'META-INF/DEPENDENCIES'
        exclude 'META-INF/NOTICE'
        exclude 'META-INF/LICENSE'
        exclude 'META-INF/LICENSE.txt'
        exclude 'META-INF/NOTICE.md'
        exclude 'META-INF/LICENSE.md'
    }

全代码参考

android {

    compileSdkVersion build_version.compileSdkVersion

    defaultConfig {

        applicationId rootProject.ext.applicationId
        minSdkVersion build_version.minSdkVersion
        targetSdkVersion build_version.targetSdkVersion
        versionCode build_version.versionCode
        versionName build_version.versionName
        testInstrumentationRunner build_version.testInstrumentationRunner


        //Multidex subcontracting
        multiDexEnabled true

        javaCompileOptions {
            annotationProcessorOptions {
                includeCompileClasspath = true
            }
        }
    }


    lintOptions {
        abortOnError false
        checkReleaseBuilds false
        // Prevent build failed due to missingtranslation during publishing!
        disable 'MissingTranslation'
    }


    //The default so file loading directory of Android studio is: Src / main / jnilibs
    sourceSets {
        main {
            jniLibs.srcDirs = ['src/main/jniLibs']
        }
    }

    buildTypes {
//        release {
//            minifyEnabled true
//            zipAlignEnabled true
//            shrinkResources true
//            signingConfig signingConfigs.config
//            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
//        }

//        debug {
//            debuggable true
//            minifyEnabled true
//            zipAlignEnabled true
//            shrinkResources true
//            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
//            signingConfig signingConfigs.config
//        }
    }

    //Version output package name auto append version number and version name
    applicationVariants.all {
        variant ->
            variant.outputs.all {
                def createTime = new Date().format("MMdd", TimeZone.getTimeZone("GMT+08:00"))
                // app包名称
                outputFileName = "SmartNAS_V" + defaultConfig.versionName + "_" + "Phone" + "_" + createTime + ".apk"

            }
    }

    dataBinding {
        enabled = true
    }

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }

    packagingOptions {
        exclude 'META-INF/DEPENDENCIES'
        exclude 'META-INF/NOTICE'
        exclude 'META-INF/LICENSE'
        exclude 'META-INF/LICENSE.txt'
        exclude 'META-INF/NOTICE.md'
        exclude 'META-INF/LICENSE.md'
    }


}
  • 3
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值