当我将gradle插件从3.1.4升级到3.2.0时,我遇到以下错误。我做了什么:
for( k in 0:9 ){
newcol <- paste0( 'netto_', k )
oldcol <- paste0( 'netto_', k, '_pc' )
d$newcol < d$oldcol * d$tot_pop
}
没有变化...
错误:
构建失败32 s 17毫秒 ... :app:transformClassesWithDexBuilderForAndroid50SncfDebug 执行转换
org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
我的项目级别Gradle文件
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)
还有我的模块级成绩文件:
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')
}
已解决-解决方案: (感谢iGio90公开了该问题)
1 当前适当的解决方案(推荐): lombok V1.16.18:
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}"
]
"lombok.anyConstructor.suppressConstructorProperties = true"
2- hacky总体解决方案(不推荐),使用gradle.properties
"compileOnly 'javax.annotation:jsr250-api:1.0'"
同步时,您会收到警告“选项设置'android.enableD8.desugaring = false'是实验性的,不受支持。当前默认值为'true'”。但是无论如何,在那之后一切都会好起来的。 有关更多说明,请参见此处的问题: https://github.com/rzwitserloot/lombok/issues/1882
答案 0 :(得分:3)
经过一天的测试,由于我遇到了与您完全相同的问题,因此顶层+模块级gradle文件与我的非常接近,我发现删除lombok依赖项将使其起作用。仍然不知道为什么会发生这种情况,但看起来像是龙目岛开发者应该解决的问题。我还要在github上打开一个问题
(编辑)
问题已打开,让我们等待:D https://github.com/rzwitserloot/lombok/issues/1882
答案 1 :(得分:0)
这是Android Gradle插件中的一个问题,已在3.3.0-alpha01
中修复。您可以更新到最新的插件3.3.0-alpha13
,这将解决您的问题。有关发生此错误的原因的更多详细信息,请参见https://issuetracker.google.com/117374690。