当前位置: 首页 > 知识库问答 >
问题:

无法解决滑行问题,现在可能是第 3 方 Gradle 插件的原因

秦哲瀚
2023-03-14

在更新android studio 3.0.1之前,一切都很好,但在更新android studio之后,我仍然坚持

配置“compile”已过时,已替换为“implementation”。它将在2018年底被删除未能解决:glide Open File Folder/home/lalit/repositories/android/WaveDist/app/build/generated/source/kaptKotlin/debug Folder/home/lalit/reperts/android/VaveDist/app/build/generated-source/kaptKotlin/release第三方Gradle插件可能是原因

我对Gradle的依赖

dependencies {
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
    implementation 'com.theartofdev.edmodo:android-image-cropper:2.2.+'
    implementation 'com.github.wrdlbrnft:sorted-list-adapter:0.2.0.1'
    implementation 'com.android.support:appcompat-v7:27.1.0'
    implementation 'com.android.support:recyclerview-v7:27.1.0'
    implementation 'com.android.support:cardview-v7:27.1.0'
    implementation 'com.android.support:support-v4:27.1.0'
    implementation 'com.google.code.gson:gson:2.8.2'
    implementation 'com.squareup.retrofit2:retrofit:2.0.2'
    implementation 'com.squareup.retrofit2:converter-gson:2.0.2'
    implementation 'com.android.support:design:27.1.0'
    implementation 'com.android.support:support-v13:27.1.0'
    implementation 'com.android.support.constraint:constraint-layout:1.0.2'
    implementation 'com.github.bumptech.glide:glide:4.6.1'
    annotationProcessor 'com.github.bumptech.glide:compiler:4.6.1'
    implementation 'com.google.firebase:firebase-core:12.0.0'
    implementation 'com.google.firebase:firebase-messaging:12.0.0'
    implementation 'com.google.android.gms:play-services-analytics:12.0.0'
    implementation 'de.hdodenhof:circleimageview:2.1.0'
    implementation 'com.android.support:support-vector-drawable:27.1.0'
    implementation 'com.android.support:support-core-utils:27.1.0'
    testImplementation 'junit:junit:4.12'
    implementation 'android.arch.lifecycle:common-java8:1.1.1'
    implementation 'android.arch.lifecycle:extensions:1.1.1'
    implementation 'android.arch.lifecycle:reactivestreams:1.1.1'
    implementation 'android.arch.persistence.room:runtime:1.0.0'
    kapt "android.arch.persistence.room:compiler:1.0.0"
    implementation 'com.google.firebase:firebase-auth:12.0.0'

    implementation 'com.google.android.gms:play-services-maps:12.0.0'
    implementation 'com.google.firebase:firebase-database:12.0.0'
    implementation 'com.google.maps.android:android-maps-utils:0.5'
    implementation 'com.google.android.gms:play-services-location:12.0.0'
    implementation 'com.google.android.gms:play-services-places:12.0.0'
    implementation 'com.google.android.gms:play-services-base:12.0.0'

}

应用级别分级:

buildscript {
    ext.kotlin_version = '1.2.30'
    ext.roomVersion = '1.0.0'
    repositories {
        jcenter()
        maven { url 'https://maven.google.com' }
        google()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.1.0'
        classpath 'com.google.gms:google-services:3.1.1'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        jcenter()
        google()
    }
}

我该如何解决这个问题?请帮助我..

编辑我添加了 mavenCentral() 来解决“无法解决滑行”的问题,现在我以这个结束

Folder /home/lalit/repositories/android/WaveDist/app/build/generated/source/kaptKotlin/debug


Folder /home/lalit/repositories/android/WaveDist/app/build/generated/source/kaptKotlin/release


3rd-party Gradle plug-ins may be the cause

编辑

我正在使用dexMode,因此我已删除

 dexOptions {
        jumboMode true
    }

并在默认配置中添加了 multiDexEnabled true,这消除了我的编译时错误。

现在,当我尝试运行应用程序时,它会显示长错误…

org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':app:transformClassesWithDexBuilderForDebug'.
    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:100)
    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:70)
    at org.gradle.api.internal.tasks.execution.OutputDirectoryCreatingTaskExecuter.execute(OutputDirectoryCreatingTaskExecuter.java:51)
    at org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter.execute(SkipUpToDateTaskExecuter.java:62)
    at org.gradle.api.internal.tasks.execution.ResolveTaskOutputCachingStateExecuter.execute(ResolveTaskOutputCachingStateExecuter.java:54)
    at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:60)
    at org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.java:97)
    at org.gradle.api.internal.tasks.execution.CleanupStaleOutputsExecuter.execute(CleanupStaleOutputsExecuter.java:87)
    at org.gradle.api.internal.tasks.execution.ResolveTaskArtifactStateTaskExecuter.execute(ResolveTaskArtifactStateTaskExecuter.java:52)
    at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:52)
    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:248)
    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:241)
    at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:230)
    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:626)
    at org.gradle.execution.taskgraph.DefaultTaskExecutionPlan.executeWithTask(DefaultTaskExecutionPlan.java:581)
    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: com.android.builder.dexing.DexArchiveBuilderException: com.android.builder.dexing.DexArchiveBuilderException: Failed to process /home/lalit/.gradle/caches/modules-2/files-2.1/android.arch.lifecycle/common-java8/1.1.1/795d68cd761d093ccb235d1d91b8fd17c2ae25ff/common-java8-1.1.1.jar
    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:212)
    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:46)
    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:121)
    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:110)
    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:92)
    ... 32 more
Caused by: com.android.build.api.transform.TransformException: com.android.builder.dexing.DexArchiveBuilderException: com.android.builder.dexing.DexArchiveBuilderException: Failed to process /home/lalit/.gradle/caches/modules-2/files-2.1/android.arch.lifecycle/common-java8/1.1.1/795d68cd761d093ccb235d1d91b8fd17c2ae25ff/common-java8-1.1.1.jar
    at com.android.build.gradle.internal.transforms.DexArchiveBuilderTransform.transform(DexArchiveBuilderTransform.java:327)
    at com.android.build.gradle.internal.pipeline.TransformTask$2.call(TransformTask.java:221)
    at com.android.build.gradle.internal.pipeline.TransformTask$2.call(TransformTask.java:217)
    at com.android.builder.profile.ThreadRecorder.record(ThreadRecorder.java:102)
    ... 48 more
Caused by: com.android.builder.dexing.DexArchiveBuilderException: com.android.builder.dexing.DexArchiveBuilderException: Failed to process /home/lalit/.gradle/caches/modules-2/files-2.1/android.arch.lifecycle/common-java8/1.1.1/795d68cd761d093ccb235d1d91b8fd17c2ae25ff/common-java8-1.1.1.jar
    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.DexArchiveBuilderTransform.transform(DexArchiveBuilderTransform.java:306)
    ... 51 more
Caused by: com.android.builder.dexing.DexArchiveBuilderException: Failed to process /home/lalit/.gradle/caches/modules-2/files-2.1/android.arch.lifecycle/common-java8/1.1.1/795d68cd761d093ccb235d1d91b8fd17c2ae25ff/common-java8-1.1.1.jar
    at com.android.build.gradle.internal.transforms.DexArchiveBuilderTransform.launchProcessing(DexArchiveBuilderTransform.java:803)
    at com.android.build.gradle.internal.transforms.DexArchiveBuilderTransform.lambda$convertToDexArchive$8(DexArchiveBuilderTransform.java:728)
    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)
Caused by: com.android.builder.dexing.DexArchiveBuilderException: Error while dexing.
    at com.android.builder.dexing.D8DexArchiveBuilder.getExceptionToRethrow(D8DexArchiveBuilder.java:169)
    at com.android.builder.dexing.D8DexArchiveBuilder.convert(D8DexArchiveBuilder.java:146)
    at com.android.build.gradle.internal.transforms.DexArchiveBuilderTransform.launchProcessing(DexArchiveBuilderTransform.java:798)
    ... 6 more
Caused by: com.android.tools.r8.CompilationFailedException: Compilation failed to complete
    at com.android.tools.r8.utils.ExceptionUtils.withCompilationHandler(ExceptionUtils.java:76)
    at com.android.tools.r8.utils.ExceptionUtils.withD8CompilationHandler(ExceptionUtils.java:45)
    at com.android.tools.r8.D8.run(D8.java:88)
    at com.android.builder.dexing.D8DexArchiveBuilder.convert(D8DexArchiveBuilder.java:144)
    ... 7 more
Caused by: com.android.tools.r8.utils.AbortException
    at com.android.tools.r8.utils.Reporter.failIfPendingErrors(Reporter.java:77)
    at com.android.tools.r8.utils.Reporter.fatalError(Reporter.java:67)
    at com.android.tools.r8.utils.ExceptionUtils.withCompilationHandler(ExceptionUtils.java:62)
    ... 10 more
    Suppressed: com.android.tools.r8.ApiLevelException: Default interface methods are only supported starting with Android N (--min-api 24): void android.arch.lifecycle.DefaultLifecycleObserver.onCreate(android.arch.lifecycle.LifecycleOwner)
        at com.android.tools.r8.dex.FileWriter.checkInterfaceMethod(FileWriter.java:247)
        at com.android.tools.r8.dex.FileWriter.checkInterfaceMethods(FileWriter.java:213)
        at com.android.tools.r8.dex.FileWriter.generate(FileWriter.java:140)
        at com.android.tools.r8.dex.ApplicationWriter.writeDexFile(ApplicationWriter.java:356)
        at com.android.tools.r8.dex.ApplicationWriter.lambda$write$2(ApplicationWriter.java:188)
        ... 5 more

共有3个答案

宋丰
2023-03-14

当您将gradle或android studio更新到最新版本时,会出现此错误。以下是解决这个问题的方法。

检查您的项目分级文件。如果存储库中有 jcenter,请将其删除并构建项目。项目gradle将如下所示:

allprojects {
repositories {
    google()
    mavenCentral()
}

}

如果错误再次出现,在删除< code>jcenter()之后,在存储库中添加< code > maven { URL ' https://maven . Google . com ' } 并重新构建。

这将解决您的问题。

晏正豪
2023-03-14

升级kotlin“1.2.31”的版本,在您的应用级别gradle文件中添加此依赖项:

android {
  ...

  sourceSets {
    main.java.srcDirs += 'src/main/kotlin'
  }
}

dependencies {
    compile "org.jetbrains.kotlin:kotlin-stdlib"
}

不要忘记添加插件:

应用插件:“kotlin-android”

删除旧的jetbrains依赖

实现“org.jetbrain.kotlin:kotlin-sdlib-jre7:$kotlin_version”

它会帮助你:)

朱欣荣
2023-03-14

经过两次编辑,,,终于我通过添加这个解决了我的问题

android{
compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
}

和Gradle文件

buildscript {
    ext.kotlin_version = '1.2.30'
    ext.roomVersion = '1.0.0'
    repositories {
        mavenCentral()
        jcenter()
        google()
        maven { url 'https://maven.google.com' }
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.1.0'
        classpath 'com.google.gms:google-services:3.2.1'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        mavenCentral()
        jcenter()
        google()
    }
}

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

编辑

这有助于我解决TaskExecutionException的问题https://stackoverflow.com/a/47387435/2809351

 类似资料:
  • 本文向大家介绍解决Angular.js中使用Swiper插件不能滑动的问题,包括了解决Angular.js中使用Swiper插件不能滑动的问题的使用技巧和注意事项,需要的朋友参考一下 我们都知道swiper是交互体验十分好的轮播插件 但是通过angular(ng-repeat)循环出来的swiper不能轮播的解决方案 通常我们都是通过以下方法来执行: html js 可是还是不行,注意:如果是在j

  • groovy.lang.MissingMethodException:方法的无签名:script5.sai()适用于参数类型:(sai)值:[sai@1401158]可能的解决方案:wait()、wait(long)、main([ljava.lang.string;),run()、run(),any()错误,行:3 请任何人帮助我解决这个问题。

  • 本文向大家介绍javascript跨域方法、原理以及出现问题解决方法(详解),包括了javascript跨域方法、原理以及出现问题解决方法(详解)的使用技巧和注意事项,需要的朋友参考一下 javascript跨域访问是web开发者经常遇到的问题,什么是跨域,一个域上加载的脚本获取或操作另一个域上的文档属性,下面将列出三种实现javascript跨域方法: 1.基于iframe实现跨域      基

  • 本文向大家介绍解决Python出现_warn_unsafe_extraction问题的方法,包括了解决Python出现_warn_unsafe_extraction问题的方法的使用技巧和注意事项,需要的朋友参考一下 在Python项目中运行出现了“AttributeError: ResourceManager instance has no attribute ‘_warn_unsafe_extr

  • 问题内容: 我一直在阅读,发现使用LIKE会导致查询速度大大降低。 同事推荐我们使用 替代 现在我不是SQL专家,并且我不太了解这些语句的内部工作原理。这是一个更好的选择,值得在每个like语句中键入一些额外的字符吗?是否有更好(更容易键入)的替代方法? 问题答案: 有几个性能问题需要解决… 如果可能,不要多次访问同一张表 不要将子查询用于无需参考同一表的其他副本即可完成的条件。如果由于使用聚合函

  • 本文向大家介绍解决pip安装的第三方包在PyCharm无法导入的问题,包括了解决pip安装的第三方包在PyCharm无法导入的问题的使用技巧和注意事项,需要的朋友参考一下 一般我们安装Python的第三方包都会在终端执行下列命令进行安装: 安装成功后发现在PyCharm中仍然存在找不到包的问题,为什么呢? 总之就是PyCharm找不到pip安装的包的路径,比如我之前用pip安装的matplotli