- android - 多次调用 OnPrimaryClipChangedListener
- android - 无法更新 RecyclerView 中的 TextView 字段
- android.database.CursorIndexOutOfBoundsException : Index 0 requested, 光标大小为 0
- android - 使用 AppCompat 时,我们是否需要明确指定其 UI 组件(Spinner、EditText)颜色
当我将 gradle 插件从 3.1.4 升级到 3.2.0 时,我遇到了以下错误。我做了什么:
org.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.anyConstructor.suppressConstructorProperties = true”
"compileOnly 'javax.annotation:jsr250-api:1.0'"
2- hacky gross 解决方案(不推荐),使用 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/
我正在尝试在 Android Studio 中生成签名的 APK,但在我的项目中添加“Picasso”图像加载库后,我不断收到此异常(在构建的“运行任务”部分中)并且找不到它的来源,因为它没有指向我的
我正处于让我的应用上线的最后步骤,当我尝试 build 并生成签名的 apk 时,我从 ProGuard 获得了这个错误日志 org.gradle.api.tasks.TaskExecutionExc
我想用 proguard 规则构建我的应用程序,所以我这样做了: buildTypes { release { minifyEnabled true
当我尝试构建要发布的应用程序时出现以下错误。在更新我的 Android Studio 和插件之前,我没有收到此错误。我正在使用通用库,并且在 gradle 配置中没有错。 Android Studio
因此,我正在从事一个大型现有公司项目,其中有些东西是旧的/已弃用的,我正在尝试逐步改进它。 现在我正在尝试将 JDK 版本从 Java 1.8 更新到 Java 11。所以我从 Android Stu
我的操作系统是win8.1 我已经下载了Android Studio版本:android-studio-ide-173.4720617-windows.exe 并安装它。 (由于 ASCII 问题,我
我最近将Android Studio更新为Android Studio 3.1。当我尝试构建项目时,出现与Gradle相关的错误。不知道为什么会收到此错误,因为我的android项目在以前版本的And
我工作正常,在添加 Gson 和一些带有 asynctask 的代码之后当我想运行我的应用程序时,我得到了它。 Information:Gradle tasks [:app:assembleDebug
当我尝试在华为 Mediapad 7 中调试我的 android 项目时,Android Studio 失败并出现以下异常。 org.gradle.api.tasks.TaskExecutionExc
我正在使用一个聊天应用程序,我想使用较旧的依赖项,但是在使用它时我遇到了这些问题 错误 org.gradle.api.tasks.TaskExecutionException: Execution f
org.gradle.execution.MultipleBuildFailures: Build completed with 1 failures. Caused by: org.gradle.a
我正在尝试在 eclipse 上执行 gradle 任务(appengineDeploy)。我已经使用了此 link 中提供的样板代码。我也按照此video中给出的确切步骤进行操作。 .(除了在 ec
我已将我的 Unity 项目导出到 Android Studio 项目。我想通过 Studio 将 Firebase Messaging 添加到我的项目中,因为统一实现的 Firebase Messa
gradle.api.tasks.TaskExecutionException: Execution failed for task ':bootRun'. Caused by: org.gradle
我刚刚将 Android Studio 更新到版本 3.5。当我运行应用程序时发生错误。 org.gradle.api.tasks.TaskExecutionException: Execution
我尝试多次更新库,但都抛出相同的错误。我认为库存在一些问题。 这是我的 app/build.gradle 文件: import com.google.gms.googleservices.Google
当我将 gradle 插件从 3.1.4 升级到 3.2.0 时,我遇到了以下错误。我做了什么: 取消选中即时运行 添加到 local.propertiesorg.gradle.jvmargs=-Xm
使用“gradle build --stacktrace”命令构建 Android SDK 示例 (android-19/ui/CustomChoiceList): :CustomChoiceList
当我使用 Android Studio 3.0 Beta 7 并使用 Android Gradle 3.0.0-beta7 插件更新我的项目时,我的项目在调试和 rc(启用 proguard)变体中构
由于我的项目中出现 65K 错误,我需要将其迁移到 Android Studio 。运行时 ./gradlew assembleDebug 我收到错误: Execution failed for ta
我是一名优秀的程序员,十分优秀!