org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':ABCGRADLEMODULE:processProdDevelopmentDebugManifest'.
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:100)
和
Caused by: java.lang.RuntimeException: Manifest merger failed with multiple errors, see logs
at com.android.builder.core.AndroidBuilder.mergeManifestsForApplication(AndroidBuilder.java:524)
我已经看到很多这类错误,所以我做的第一件事是:转到ABCGRADLEMODULE
清单文件并查看了(合并的清单),而我发现的唯一内容是:(Included in merge, but did not contribute any elements)
我很难弄清楚为什么会这样... 有关gradle文件设置的更多信息:
build.gradle:项目:
const val android = "com.android.tools.build:gradle:3.1.4"
build.gradle:ABCGRADLEMODULE:
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-kapt'
android {
compileSdkVersion Android.compileSdkVersion
buildToolsVersion Android.buildToolsVersion
flavorDimensions "server", "type"
defaultConfig {
applicationId "..."
versionName '...'
versionCode 5
minSdkVersion 21
targetSdkVersion Android.targetSdkVersion
}
dexOptions {
javaMaxHeapSize "6g"
preDexLibraries = true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
productFlavors {
development {
dimension "..."
applicationIdSuffix '...'
versionNameSuffix '...'
}
test {
dimension "..."
applicationIdSuffix '...'
versionNameSuffix '...'
}
production {
dimension "..."
}
}
android.applicationVariants.all { variant ->
variant.outputs.all {
outputFileName = "${...}-${...}.apk"
}
}
packagingOptions {
exclude 'META-INF/LICENSE'
exclude 'META-INF/NOTICE'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/services/javax.annotation.processing.Processor'
exclude 'jsr305_annotations/Jsr305_annotations.gwt.xml'
exclude 'build-data.properties'
exclude 'error_prone/Annotations.gwt.xml'
exclude 'third_party/java_src/error_prone/project/annotations/Annotations.gwt.xml'
exclude 'third_party/java_src/error_prone/project/annotations/Google_internal.gwt.xml'
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
androidExtensions {
experimental = true
}
}
dependencies {
implementation project(':...')
implementation project(':....')
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation Libraries.constraintLayout
}
然后我在其中声明了文件:
object Versions {
const val constraintLayout = "3.1.4"
}
object Libraries {
const val constraintLayout = "constraintLayout...:${constraintLayout}"
}
答案 0 :(得分:0)
我建议使用def
代替const
。
,您可以跳过buildToolsVersion
,因为targetSdkVersion
对此进行了定义。
看起来应该差不多:
def minVersion = 21
def compileVersion = 27
def targetVersion = 27
android {
defaultConfig {
applicationId ...
versionName "1.0.0"
versionCode 1
compileSdkVersion new Integer(compileVersion)
targetSdkVersion new Integer(targetVersion)
minSdkVersion new Integer(minVersion)
}
}