gpt4 book ai didi

Android Gradle 插件从 3.1.4 更新到 3.2.0 导致 TaskExecutionException

转载 作者:太空宇宙 更新时间:2023-11-03 13:40:40 27 4
gpt4 key购买 nike

当我将 gradle 插件从 3.1.4 升级到 3.2.0 时,我遇到了以下错误。我做了什么:

  • 取消选中即时运行
  • 添加到 local.propertiesorg.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
  • 失效并重启
  • 清理并构建项目

没有变化...

错误:

build failed 32 s 17 ms ... :app:transformClassesWithDexBuilderForAndroid50SncfDebug Execute transform

    org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':app:transformClassesWithDexBuilderForAndroid50SncfDebug'.
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:103)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:73)
at org.gradle.api.internal.tasks.execution.OutputDirectoryCreatingTaskExecuter.execute(OutputDirectoryCreatingTaskExecuter.java:51)
at org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter.execute(SkipUpToDateTaskExecuter.java:59)
at org.gradle.api.internal.tasks.execution.ResolveTaskOutputCachingStateExecuter.execute(ResolveTaskOutputCachingStateExecuter.java:54)
at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:59)
at org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.java:101)
at org.gradle.api.internal.tasks.execution.FinalizeInputFilePropertiesTaskExecuter.execute(FinalizeInputFilePropertiesTaskExecuter.java:44)
at org.gradle.api.internal.tasks.execution.CleanupStaleOutputsExecuter.execute(CleanupStaleOutputsExecuter.java:91)
at org.gradle.api.internal.tasks.execution.ResolveTaskArtifactStateTaskExecuter.execute(ResolveTaskArtifactStateTaskExecuter.java:62)
at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:59)
at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:54)
at org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter.execute(ExecuteAtMostOnceTaskExecuter.java:43)
at org.gradle.api.internal.tasks.execution.CatchExceptionTaskExecuter.execute(CatchExceptionTaskExecuter.java:34)
at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker$1.run(DefaultTaskGraphExecuter.java:256)
at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:336)
at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:328)
at org.gradle.internal.progress.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:199)
at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:110)
at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:249)
at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:238)
at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker.processTask(DefaultTaskPlanExecutor.java:123)
at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker.access$200(DefaultTaskPlanExecutor.java:79)
at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker$1.execute(DefaultTaskPlanExecutor.java:104)
at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker$1.execute(DefaultTaskPlanExecutor.java:98)
at org.gradle.execution.taskgraph.DefaultTaskExecutionPlan.execute(DefaultTaskExecutionPlan.java:663)
at org.gradle.execution.taskgraph.DefaultTaskExecutionPlan.executeWithTask(DefaultTaskExecutionPlan.java:597)
at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker.run(DefaultTaskPlanExecutor.java:98)
at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:63)
at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:46)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:55)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.RuntimeException: com.android.build.api.transform.TransformException: java.lang.RuntimeException: java.lang.RuntimeException
at com.android.builder.profile.Recorder$Block.handleException(Recorder.java:55)
at com.android.builder.profile.ThreadRecorder.record(ThreadRecorder.java:104)
at com.android.build.gradle.internal.pipeline.TransformTask.transform(TransformTask.java:230)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:73)
at org.gradle.api.internal.project.taskfactory.IncrementalTaskAction.doExecute(IncrementalTaskAction.java:50)
at org.gradle.api.internal.project.taskfactory.StandardTaskAction.execute(StandardTaskAction.java:39)
at org.gradle.api.internal.project.taskfactory.StandardTaskAction.execute(StandardTaskAction.java:26)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$1.run(ExecuteActionsTaskExecuter.java:124)
at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:336)
at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:328)
at org.gradle.internal.progress.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:199)
at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:110)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.java:113)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:95)
... 33 more
Caused by: com.android.build.api.transform.TransformException: java.lang.RuntimeException: java.lang.RuntimeException
at com.android.build.gradle.internal.transforms.DexArchiveBuilderTransform.transform(DexArchiveBuilderTransform.java:427)
at com.android.build.gradle.internal.pipeline.TransformTask$2.call(TransformTask.java:239)
at com.android.build.gradle.internal.pipeline.TransformTask$2.call(TransformTask.java:235)
at com.android.builder.profile.ThreadRecorder.record(ThreadRecorder.java:102)
... 49 more
Caused by: java.lang.RuntimeException: java.lang.RuntimeException
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at java.util.concurrent.ForkJoinTask.getThrowableException(ForkJoinTask.java:593)
at java.util.concurrent.ForkJoinTask.reportException(ForkJoinTask.java:677)
at java.util.concurrent.ForkJoinTask.join(ForkJoinTask.java:720)
at com.android.ide.common.internal.WaitableExecutor.waitForTasksWithQuickFail(WaitableExecutor.java:146)
at com.android.build.gradle.internal.transforms.DesugarIncrementalTransformHelper.getInitalGraphData(DesugarIncrementalTransformHelper.java:162)
at com.android.build.gradle.internal.transforms.DesugarIncrementalTransformHelper.makeDesugaringGraph(DesugarIncrementalTransformHelper.java:130)
at com.google.common.base.Suppliers$NonSerializableMemoizingSupplier.get(Suppliers.java:160)
at com.android.build.gradle.internal.transforms.DesugarIncrementalTransformHelper.getDependenciesPaths(DesugarIncrementalTransformHelper.java:231)
at com.android.build.gradle.internal.transforms.DexArchiveBuilderTransform.getD8DesugaringCacheInfo(DexArchiveBuilderTransform.java:461)
at com.android.build.gradle.internal.transforms.DexArchiveBuilderTransform.transform(DexArchiveBuilderTransform.java:375)
... 52 more
Caused by: java.lang.RuntimeException
at org.objectweb.asm.ClassVisitor.visitModule(ClassVisitor.java:148)
at org.objectweb.asm.ClassReader.readModule(ClassReader.java:731)
at org.objectweb.asm.ClassReader.accept(ClassReader.java:632)
at org.objectweb.asm.ClassReader.accept(ClassReader.java:500)
at com.android.builder.desugaring.DesugaringClassAnalyzer.analyze(DesugaringClassAnalyzer.java:144)
at com.android.builder.desugaring.DesugaringClassAnalyzer.analyzeJar(DesugaringClassAnalyzer.java:92)
at com.android.builder.desugaring.DesugaringClassAnalyzer.analyze(DesugaringClassAnalyzer.java:63)
at com.android.build.gradle.internal.transforms.DesugarIncrementalTransformHelper.lambda$getInitalGraphData$4(DesugarIncrementalTransformHelper.java:150)
at java.util.concurrent.ForkJoinTask$AdaptedCallable.exec(ForkJoinTask.java:1424)
at java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:289)
at java.util.concurrent.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1056)
at java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1692)
at java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:157)

我的项目级 Gradle 文件

apply from: 'buildsystem/ci.gradle'
apply from: 'buildsystem/dependencies.gradle'

buildscript {
repositories {
jcenter()
mavenCentral()
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.2.0'
}
}

allprojects {

ext {
androidVersionCode = 15480001
android40VersionCode = 15480001
android42VersionCode = 17480001
android50VersionCode = 20480001
androidVersionName = "4.8.0"
testInstrumentationRunner = "android.support.test.runner.AndroidJUnitRunner"
testApplicationId = 'my.package'
}
}

task wrapper(type: Wrapper) {
description 'Creates the gradle wrapper.'
gradleVersion '2.14.1'
}

task clean(type: Delete) {
delete rootProject.buildDir
}

repositories {
google()
maven { url "https://maven.google.com" }
}

还有我的模块级成绩文件:

apply plugin: 'com.android.application'

android {
def globalConfiguration = rootProject.extensions.getByName("ext")

flavorDimensions "flavor1", "flavor2"

publishNonDefault true
compileSdkVersion globalConfiguration.getAt("androidCompileSdkVersion")
buildToolsVersion globalConfiguration.getAt("androidBuildToolsVersion")

defaultConfig {
minSdkVersion globalConfiguration.getAt("androidMinSdkVersion")
targetSdkVersion globalConfiguration.getAt("androidTargetSdkVersion")

versionCode globalConfiguration.getAt("androidVersionCode")
versionName globalConfiguration.getAt("androidVersionName")

multiDexEnabled true
}

compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}

signingConfigs {
release {
storeFile file('../keystore/my.keystore')
storePassword "PASSWORD"
keyAlias "ALIAS"
keyPassword "PASSWORD"
}
}

sourceSets.main {
jni.srcDirs = [] // This prevents the auto generation of Android.mk
}

buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
signingConfig signingConfigs.release
}

}

productFlavors {
android40 {
minSdkVersion 15
versionCode globalConfiguration.getAt("android40VersionCode")
dimension "flavor1"

}
android42 {
minSdkVersion 17
versionCode globalConfiguration.getAt("android42VersionCode")
dimension "flavor1"
}
android50 {
minSdkVersion 20
versionCode globalConfiguration.getAt("android50VersionCode")
dimension "flavor1"
}
test{
dimension "flavor2"
applicationId = "my.package.test"
}
}

packagingOptions {
exclude 'LICENSE.txt'
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/dependencies.txt'
exclude 'META-INF/ASL2.0'
exclude 'META-INF/NOTICE'
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/notice.txt'
exclude 'META-INF/LICENSE'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/license.txt'
exclude 'META-INF/LGPL2.1'
}

lintOptions {
quiet true
abortOnError false
ignoreWarnings true
disable 'InvalidPackage' //Some libraries have issues with this.
disable 'OldTargetApi'
//Lint gives this warning but SDK 20 would be Android L Beta.
disable 'IconDensities' //For testing purpose. This is safe to remove.
disable 'IconMissingDensityFolder' //For testing purpose. This is safe to remove.
}
}

repositories {
google()
maven { url "https://jitpack.io" }
maven { url "https://maven.google.com" }
}

dependencies {
def appDependencies = rootProject.ext.appDependencies

// Dépendances Google
api appDependencies.appcompatv7
api appDependencies.supportv4
api appDependencies.supportdesign
api appDependencies.multidex
api appDependencies.constLayout
api appDependencies.playLocation

// Annotations
api appDependencies.dagger
annotationProcessor appDependencies.daggerCompiler
api appDependencies.bknife
annotationProcessor appDependencies.bknifeCompiler
compileOnly appDependencies.lombok
annotationProcessor appDependencies.lombok

// Librairies externes
api appDependencies.commonsNet
api appDependencies.commonsIo
api appDependencies.altbeacon
api appDependencies.rxjava
api appDependencies.rxAndroid
api files('src/main/jniLibs/activation.jar')
api files('src/main/jniLibs/additionnal.jar')
api files('src/main/jniLibs/mail.jar')

// Projets
implementation project(':converter')
implementation project(':data')
implementation project(':zones')
}

版本文件:

androidBuildToolsVersion = "28.0.3"
androidMinSdkVersion = 15
androidTargetSdkVersion = 28
androidCompileSdkVersion = 28
appcompatv7Version = "28.0.0"
supportv4Version = "28.0.0"
androidAnnotationsVersion = '28.0.0'
supportdesignVersion = '28.0.0'
multidexVersion = "1.0.3"
constLayoutVersion = "1.1.2"
butterknifeVersion = "8.8.1"

//Libraries
daggerVersion = '2.17'
javaxAnnotationVersion = '1.0'
javaxInjectVersion = '1'
commonsNetVersion = '3.3'
commonsIoVersion = '2.4'
jLayerVersion = '1.0.1.4'
altbeaconVersion = '2+'
rxjavaVersion = '2+'
rxAndroidVersion = '2.0.1'
firebaseVersion = '16.0.1'
lombokVersion = '1.18.2'
retrofitVersion = '2.1.0'
okhttpVersion = '3.5.0'
guavaVersion = '26.0-android'
gsonVersion = '2.6.2'
converteegsonVersion = '2.4.0'
playLocationVersion = '15.0.1'

appDependencies = [
dagger : "com.google.dagger:dagger:${daggerVersion}",
daggerCompiler: "com.google.dagger:dagger-compiler:${daggerVersion}",
multidex : "com.android.support:multidex:${multidexVersion}",
appcompatv7 : "com.android.support:appcompat-v7:${appcompatv7Version}",
supportv4 : "com.android.support:support-v4:${supportv4Version}",
supportdesign : "com.android.support:design:${supportdesignVersion}",
constLayout : "com.android.support.constraint:constraint-layout:${constLayoutVersion}",
commonsNet : "commons-net:commons-net:${commonsNetVersion}",
commonsIo : "commons-io:commons-io:${commonsIoVersion}",
altbeacon : "org.altbeacon:android-beacon-library:${altbeaconVersion}",
rxjava : "io.reactivex.rxjava2:rxjava:${rxjavaVersion}",
rxAndroid : "io.reactivex.rxjava2:rxandroid:${rxAndroidVersion}",
firebase : "com.google.firebase:firebase-appindexing:${firebaseVersion}",
lombok : "org.projectlombok:lombok:${lombokVersion}",
bknife : "com.jakewharton:butterknife:${butterknifeVersion}",
bknifeCompiler: "com.jakewharton:butterknife-compiler:${butterknifeVersion}",
playLocation : "com.google.android.gms:play-services-location:${playLocationVersion}"
]

已解决 - 解决方案:(感谢 iGio90 打开了 issue)

1 目前合适的解决方案(推荐): lombok V1.16.18 :

  • lombok 版本为 1.16.18
  • 在项目根目录中添加一个“lombok.config”文件,行 “lombok.anyConstructor.suppressConstructorProperties = true”
  • 加入我的build.gradle"compileOnly 'javax.annotation:jsr250-api:1.0'"

2- hacky gross 解决方案(不推荐),使用 gradle.properties

  • 让所有版本都是最新的(我的lombok版本是1.18.2,gradle 4.6,gradle plugin 3.2.0)
  • 将以下行添加到您的 gradle.properties 中:android.enableD8.desugaring=false同步时,您会收到警告“选项设置‘android.enableD8.desugaring=false’是实验性的,不受支持。当前默认值为‘true’”。但无论如何,在那之后一切都建立起来了。

有关更多解释,请参阅此处的问题: https://github.com/rzwitserloot/lombok/issues/1882

最佳答案

经过一天的测试,由于我遇到了与您完全相同的问题,并且顶层 + 模块级 gradle 文件看起来与我的非常接近,所以我发现删除 lombok 依赖项可以使其正常工作。仍然不知道为什么会发生这种情况,但看起来是 lombok 开发人员应该解决的问题。我也会在 github 上开一个问题

(编辑)

问题已打开,让我们等待 :D https://github.com/rzwitserloot/lombok/issues/1882

关于Android Gradle 插件从 3.1.4 更新到 3.2.0 导致 TaskExecutionException,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52606514/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com