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'
}
}