您的位置:首页 > 新闻 > 热点要闻 > 专题网站策划书_手机制作合同软件_百度正式员工工资待遇_东莞网站建设优化排名

专题网站策划书_手机制作合同软件_百度正式员工工资待遇_东莞网站建设优化排名

2024/12/28 10:01:09 来源:https://blog.csdn.net/yikezhuixun/article/details/144389595  浏览:    关键词:专题网站策划书_手机制作合同软件_百度正式员工工资待遇_东莞网站建设优化排名
专题网站策划书_手机制作合同软件_百度正式员工工资待遇_东莞网站建设优化排名

在这里插入图片描述

文章目录

  • 错误描述
  • 解决方法
      • 修复步骤
        • 1. 清理项目缓存
        • 2. 检查项目路径一致性
        • 3. 强制禁用增量编译
        • 4. 更新依赖项
        • 5. 检查 Kotlin 和 Gradle 插件版本
        • 6. 删除 Kotlin 编译器守护进程
        • 7. 重新编译项目

错误描述

flutter应用编译时报如下错误e: Daemon compilation failed: null
java.lang.Exception
at org.jetbrains.kotlin.daemon.common.CompileService C a l l R e s u l t CallResult CallResultError.get(CompileService.kt:69)
at org.jetbrains.kotlin.daemon.common.CompileService C a l l R e s u l t CallResult CallResultError.get(CompileService.kt:65)
at org.jetbrains.kotlin.compilerRunner.GradleKotlinCompilerWork.compileWithDaemon(GradleKotlinCompilerWork.kt:244)
at org.jetbrains.kotlin.compilerRunner.GradleKotlinCompilerWork.compileWithDaemonOrFallbackImpl(GradleKotlinCompilerWork.kt:175)
at org.jetbrains.kotlin.compilerRunner.GradleKotlinCompilerWork.run(GradleKotlinCompilerWork.kt:135)
at org.jetbrains.kotlin.compilerRunner.GradleCompilerRunnerWithWorkers$GradleKotlinCompilerWorkAction.execute(GradleCompilerRunnerWithWorkers.kt:73)
at org.gradle.workers.internal.DefaultWorkerServer.execute(DefaultWorkerServer.java:63)
at org.gradle.workers.internal.NoIsolationWorkerFactory$1$1.create(NoIsolationWorkerFactory.java:66)
at org.gradle.workers.internal.NoIsolationWorkerFactory$1$1.create(NoIsolationWorkerFactory.java:62)
at org.gradle.internal.classloader.ClassLoaderUtils.executeInClassloader(ClassLoaderUtils.java:100)
at org.gradle.workers.internal.NoIsolationWorkerFactory 1. l a m b d a 1.lambda 1.lambdaexecute$0(NoIsolationWorkerFactory.java:62)
at org.gradle.workers.internal.AbstractWorker$1.call(AbstractWorker.java:44)
at org.gradle.workers.internal.AbstractWorker 1. c a l l ( A b s t r a c t W o r k e r . j a v a : 41 ) a t o r g . g r a d l e . i n t e r n a l . o p e r a t i o n s . D e f a u l t B u i l d O p e r a t i o n R u n n e r 1.call(AbstractWorker.java:41) at org.gradle.internal.operations.DefaultBuildOperationRunner 1.call(AbstractWorker.java:41)atorg.gradle.internal.operations.DefaultBuildOperationRunnerCallableBuildOperationWorker.execute(DefaultBuildOperationRunner.java:204)
at org.gradle.internal.operations.DefaultBuildOperationRunner$CallableBuildOperationWorker.execute(DefaultBuildOperationRunner.java:199)
at org.gradle.internal.operations.DefaultBuildOperationRunner$2.execute(DefaultBuildOperationRunner.java:66)
at org.gradle.internal.operations.DefaultBuildOperationRunner$2.execute(DefaultBuildOperationRunner.java:59)
at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:157)
at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:59)
at org.gradle.internal.operations.DefaultBuildOperationRunner.call(DefaultBuildOperationRunner.java:53)
at org.gradle.internal.operations.DefaultBuildOperationExecutor.call(DefaultBuildOperationExecutor.java:73)
at org.gradle.workers.internal.AbstractWorker.executeWrappedInBuildOperation(AbstractWorker.java:41)
at org.gradle.workers.internal.NoIsolationWorkerFactory 1. e x e c u t e ( N o I s o l a t i o n W o r k e r F a c t o r y . j a v a : 59 ) a t o r g . g r a d l e . w o r k e r s . i n t e r n a l . D e f a u l t W o r k e r E x e c u t o r . l a m b d a 1.execute(NoIsolationWorkerFactory.java:59) at org.gradle.workers.internal.DefaultWorkerExecutor.lambda 1.execute(NoIsolationWorkerFactory.java:59)atorg.gradle.workers.internal.DefaultWorkerExecutor.lambdasubmitWork 2 ( D e f a u l t W o r k e r E x e c u t o r . j a v a : 205 ) a t j a v a . b a s e / j a v a . u t i l . c o n c u r r e n t . F u t u r e T a s k . r u n ( F u t u r e T a s k . j a v a : 264 ) a t o r g . g r a d l e . i n t e r n a l . w o r k . D e f a u l t C o n d i t i o n a l E x e c u t i o n Q u e u e 2(DefaultWorkerExecutor.java:205) at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264) at org.gradle.internal.work.DefaultConditionalExecutionQueue 2(DefaultWorkerExecutor.java:205)atjava.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)atorg.gradle.internal.work.DefaultConditionalExecutionQueueExecutionRunner.runExecution(DefaultConditionalExecutionQueue.java:187)
at org.gradle.internal.work.DefaultConditionalExecutionQueue$ExecutionRunner.access 700 ( D e f a u l t C o n d i t i o n a l E x e c u t i o n Q u e u e . j a v a : 120 ) a t o r g . g r a d l e . i n t e r n a l . w o r k . D e f a u l t C o n d i t i o n a l E x e c u t i o n Q u e u e 700(DefaultConditionalExecutionQueue.java:120) at org.gradle.internal.work.DefaultConditionalExecutionQueue 700(DefaultConditionalExecutionQueue.java:120)atorg.gradle.internal.work.DefaultConditionalExecutionQueueExecutionRunner$1.run(DefaultConditionalExecutionQueue.java:162)
at org.gradle.internal.Factories 1. c r e a t e ( F a c t o r i e s . j a v a : 31 ) a t o r g . g r a d l e . i n t e r n a l . w o r k . D e f a u l t W o r k e r L e a s e S e r v i c e . w i t h L o c k s ( D e f a u l t W o r k e r L e a s e S e r v i c e . j a v a : 249 ) a t o r g . g r a d l e . i n t e r n a l . w o r k . D e f a u l t W o r k e r L e a s e S e r v i c e . r u n A s W o r k e r T h r e a d ( D e f a u l t W o r k e r L e a s e S e r v i c e . j a v a : 109 ) a t o r g . g r a d l e . i n t e r n a l . w o r k . D e f a u l t W o r k e r L e a s e S e r v i c e . r u n A s W o r k e r T h r e a d ( D e f a u l t W o r k e r L e a s e S e r v i c e . j a v a : 114 ) a t o r g . g r a d l e . i n t e r n a l . w o r k . D e f a u l t C o n d i t i o n a l E x e c u t i o n Q u e u e 1.create(Factories.java:31) at org.gradle.internal.work.DefaultWorkerLeaseService.withLocks(DefaultWorkerLeaseService.java:249) at org.gradle.internal.work.DefaultWorkerLeaseService.runAsWorkerThread(DefaultWorkerLeaseService.java:109) at org.gradle.internal.work.DefaultWorkerLeaseService.runAsWorkerThread(DefaultWorkerLeaseService.java:114) at org.gradle.internal.work.DefaultConditionalExecutionQueue 1.create(Factories.java:31)atorg.gradle.internal.work.DefaultWorkerLeaseService.withLocks(DefaultWorkerLeaseService.java:249)atorg.gradle.internal.work.DefaultWorkerLeaseService.runAsWorkerThread(DefaultWorkerLeaseService.java:109)atorg.gradle.internal.work.DefaultWorkerLeaseService.runAsWorkerThread(DefaultWorkerLeaseService.java:114)atorg.gradle.internal.work.DefaultConditionalExecutionQueueExecutionRunner.runBatch(DefaultConditionalExecutionQueue.java:157)
at org.gradle.internal.work.DefaultConditionalExecutionQueue E x e c u t i o n R u n n e r . r u n ( D e f a u l t C o n d i t i o n a l E x e c u t i o n Q u e u e . j a v a : 126 ) a t j a v a . b a s e / j a v a . u t i l . c o n c u r r e n t . E x e c u t o r s ExecutionRunner.run(DefaultConditionalExecutionQueue.java:126) at java.base/java.util.concurrent.Executors ExecutionRunner.run(DefaultConditionalExecutionQueue.java:126)atjava.base/java.util.concurrent.ExecutorsRunnableAdapter.call(Executors.java:515)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:64)
at org.gradle.internal.concurrent.ManagedExecutorImpl 1. r u n ( M a n a g e d E x e c u t o r I m p l . j a v a : 48 ) a t j a v a . b a s e / j a v a . u t i l . c o n c u r r e n t . T h r e a d P o o l E x e c u t o r . r u n W o r k e r ( T h r e a d P o o l E x e c u t o r . j a v a : 1128 ) a t j a v a . b a s e / j a v a . u t i l . c o n c u r r e n t . T h r e a d P o o l E x e c u t o r 1.run(ManagedExecutorImpl.java:48) at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) at java.base/java.util.concurrent.ThreadPoolExecutor 1.run(ManagedExecutorImpl.java:48)atjava.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)atjava.base/java.util.concurrent.ThreadPoolExecutorWorker.run(ThreadPoolExecutor.java:628)
at java.base/java.lang.Thread.run(Thread.java:829)
Caused by: java.lang.IllegalArgumentException: this and base files have different roots: C:\Users\YUAN\AppData\Local\Pub\Cache\hosted\pub.dev\wakelock-0.6.2\android\src\main\kotlin\creativemaybeno\wakelock\Wakelock.kt and D:\WORK\myLearningWork\development\learning\android.
at kotlin.io.FilesKt__UtilsKt.toRelativeString(Utils.kt:117)
at kotlin.io.FilesKt__UtilsKt.relativeTo(Utils.kt:128)
at org.jetbrains.kotlin.incremental.storage.RelocatableFileToPathConverter.toPath(RelocatableFileToPathConverter.kt:22)
at org.jetbrains.kotlin.incremental.storage.ComplementarySourceFilesMap.get(ComplementarySourceFilesMap.kt:22)
at org.jetbrains.kotlin.incremental.AbstractIncrementalCache.getComplementaryFilesRecursive(AbstractIncrementalCache.kt:219)
at org.jetbrains.kotlin.incremental.IncrementalCompilerRunner.doCompile(IncrementalCompilerRunner.kt:455)
at org.jetbrains.kotlin.incremental.IncrementalCompilerRunner.compileImpl(IncrementalCompilerRunner.kt:400)
at org.jetbrains.kotlin.incremental.IncrementalCompilerRunner.compileNonIncrementally(IncrementalCompilerRunner.kt:281)
at org.jetbrains.kotlin.incremental.IncrementalCompilerRunner.compile(IncrementalCompilerRunner.kt:125)
at org.jetbrains.kotlin.daemon.CompileServiceImplBase.execIncrementalCompiler(CompileServiceImpl.kt:657)
at org.jetbrains.kotlin.daemon.CompileServiceImplBase.access$execIncrementalCompiler(CompileServiceImpl.kt:105)
at org.jetbrains.kotlin.daemon.CompileServiceImpl.compile(CompileServiceImpl.kt:1624)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at java.rmi/sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:359)
at java.rmi/sun.rmi.transport.Transport$1.run(Transport.java:200)
at java.rmi/sun.rmi.transport.Transport 1. r u n ( T r a n s p o r t . j a v a : 197 ) a t j a v a . b a s e / j a v a . s e c u r i t y . A c c e s s C o n t r o l l e r . d o P r i v i l e g e d ( N a t i v e M e t h o d ) a t j a v a . r m i / s u n . r m i . t r a n s p o r t . T r a n s p o r t . s e r v i c e C a l l ( T r a n s p o r t . j a v a : 196 ) a t j a v a . r m i / s u n . r m i . t r a n s p o r t . t c p . T C P T r a n s p o r t . h a n d l e M e s s a g e s ( T C P T r a n s p o r t . j a v a : 562 ) a t j a v a . r m i / s u n . r m i . t r a n s p o r t . t c p . T C P T r a n s p o r t 1.run(Transport.java:197) at java.base/java.security.AccessController.doPrivileged(Native Method) at java.rmi/sun.rmi.transport.Transport.serviceCall(Transport.java:196) at java.rmi/sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:562) at java.rmi/sun.rmi.transport.tcp.TCPTransport 1.run(Transport.java:197)atjava.base/java.security.AccessController.doPrivileged(NativeMethod)atjava.rmi/sun.rmi.transport.Transport.serviceCall(Transport.java:196)atjava.rmi/sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:562)atjava.rmi/sun.rmi.transport.tcp.TCPTransportConnectionHandler.run0(TCPTransport.java:796)
at java.rmi/sun.rmi.transport.tcp.TCPTransport C o n n e c t i o n H a n d l e r . l a m b d a ConnectionHandler.lambda ConnectionHandler.lambdarun 0 ( T C P T r a n s p o r t . j a v a : 677 ) a t j a v a . b a s e / j a v a . s e c u r i t y . A c c e s s C o n t r o l l e r . d o P r i v i l e g e d ( N a t i v e M e t h o d ) a t j a v a . r m i / s u n . r m i . t r a n s p o r t . t c p . T C P T r a n s p o r t 0(TCPTransport.java:677) at java.base/java.security.AccessController.doPrivileged(Native Method) at java.rmi/sun.rmi.transport.tcp.TCPTransport 0(TCPTransport.java:677)atjava.base/java.security.AccessController.doPrivileged(NativeMethod)atjava.rmi/sun.rmi.transport.tcp.TCPTransportConnectionHandler.run(TCPTransport.java:676)
… 3 more
image.png

解决方法

从错误日志可以看出,问题的核心是 Kotlin 编译器守护进程(Kotlin Compiler Daemon)在进行增量编译时出现了异常,并伴随文件路径的根目录不一致问题。

错误原因主要包括:

  1. 路径冲突C:\Users\YUAND:\WORK 是两个不同的路径根目录,Kotlin 编译器可能无法正确解析它们的相对路径关系。
  2. 增量编译问题:Kotlin 的增量编译缓存可能损坏,导致编译失败。
  3. 插件或依赖问题:可能是依赖的插件(如 wakelock)或编译器配置存在问题。

修复步骤

1. 清理项目缓存

清除所有缓存和生成的中间文件:

flutter clean

然后删除 build 文件夹和 .gradle 文件夹:

rm -rf android/.gradle
rm -rf build

重新获取依赖和编译:

flutter pub get
flutter build apk

2. 检查项目路径一致性

确保你的项目和所有依赖项都在同一个磁盘分区内。将项目移动到与 Flutter SDK 相同的磁盘。例如,把项目从 D:\WORK 移动到 C:\Users\YUAN 下的某个子文件夹。


3. 强制禁用增量编译

增量编译虽然能加快编译速度,但在某些情况下会引发问题。尝试在 android/gradle.properties 文件中添加以下内容:

kotlin.incremental=false

4. 更新依赖项

某些旧版插件可能与当前的 Flutter 或 Kotlin 编译器版本不兼容。更新依赖项:

  • 确保 pubspec.yaml 中插件的版本是最新的:
    wakelock: ^0.6.2+2
    
  • 运行以下命令更新依赖:
    flutter pub upgrade
    

5. 检查 Kotlin 和 Gradle 插件版本
  • 确保你的 Kotlin 和 Gradle 插件版本匹配:
    • 检查 android/build.gradle 中的 Gradle 插件版本(例如,com.android.tools.build:gradle:7.4.2)。
    • 检查 android/gradle/wrapper/gradle-wrapper.properties 中的 Gradle 版本(例如,distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-bin.zip)。
    • 检查 kotlin_version 是否与 Gradle 插件版本兼容:
      ext.kotlin_version = "1.8.22"
      

可以参考 Gradle Plugin Compatibility Table 确保版本一致。


6. 删除 Kotlin 编译器守护进程

Kotlin 守护进程可能有残留。尝试终止守护进程并清理相关缓存:

pkill -f kotlin-daemon

如果你在 Windows 上,手动结束 Kotlin 守护进程相关任务。


7. 重新编译项目

执行以下命令进行完整编译:

flutter build apk


结束语
Flutter是一个由Google开发的开源UI工具包,它可以让您在不同平台上创建高质量、美观的应用程序,而无需编写大量平台特定的代码。我将学习和深入研究Flutter的方方面面。从基础知识到高级技巧,从UI设计到性能优化,欢饮关注一起讨论学习,共同进入Flutter的精彩世界!

版权声明:

本网仅为发布的内容提供存储空间,不对发表、转载的内容提供任何形式的保证。凡本网注明“来源:XXX网络”的作品,均转载自其它媒体,著作权归作者所有,商业转载请联系作者获得授权,非商业转载请注明出处。

我们尊重并感谢每一位作者,均已注明文章来源和作者。如因作品内容、版权或其它问题,请及时与我们联系,联系邮箱:809451989@qq.com,投稿邮箱:809451989@qq.com