我在使用 Visual Studio 代码编译 Flutter 应用程序时遇到问题

问题描述 投票:0回答:1

当我运行flutter run时,它会抛出这些错误消息: 该项目使用 flutter 模块化,这是 gradle 属性的属性:

org.gradle.jvmargs=-Xmx4608m
android.useAndroidX=true
android.enableJetifier=true

这是颤振版本:

Flutter 3.19.2** • channel stable • https://github.com/flutter/flutter.git
Framework • revision 7482962148 (9 days ago) • 2024-02-27 16:51:22 -0500
Engine • revision 04817c99c9
Tools • Dart 3.3.0
• DevTools 2.31.1
e: Daemon compilation failed: null
java.lang.Exception
    at org.gradle.internal.work.DefaultWorkerLeaseService.runAsWorkerThread(DefaultWorkerLeaseService.java:109)
    at org.gradle.internal.work.DefaultWorkerLeaseService.runAsWorkerThread(DefaultWorkerLeaseService.java:114) 
    at java.rmi/sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:796)
    at java.rmi/sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.lambda$run$0(TCPTransport.java:677)
    at java.base/java.security.AccessController.doPrivileged(Native Method)
    at java.rmi/sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:676)
    ... 3 more

Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
e: Daemon compilation failed: null
java.lang.Exception

    at java.base/java.lang.Thread.run(Thread.java:829)
Caused by: java.lang.IllegalArgumentException: this and base files have different roots: C:\Users\Administrator\AppData\Local\Pub\Cache\hosted\pub.dev\flutter_localization-0.1.13\android\src\main\kotlin\com\mastertipsy\flutter_localization\FlutterLocalizationPlugin.kt and D:\flutter\smartinia\wedort\client\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)
    java:677)
    at java.base/java.security.AccessController.doPrivileged(Native Method)
    at java.rmi/sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:676)
    ... 3 more

e: Daemon compilation failed: null
java.lang.Exception
    
    at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.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\Administrator\AppData\Local\Pub\Cache\hosted\pub.dev\fluttertoast-8.2.2\android\src\main\kotlin\io\github\ponnamkarthik\toast\fluttertoast\FlutterToastPlugin.kt and D:\flutter\smartinia\wedort\client\android.
    at kotlin.io.FilesKt__UtilsKt.toRelativeString(Utils.kt:117)
    at kotlin.io.FilesKt__UtilsKt.relativeTo(Utils.kt:128)
    a:796)
    at java.rmi/sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.lambda$run$0(TCPTransport.java:677)
    at java.base/java.security.AccessController.doPrivileged(Native Method)
    at java.rmi/sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:676)
    ... 3 more

exception: c:\Users\Administrator\AppData\Local\Pub\Cache\hosted\pub.dev\facebook_app_events-0.19.0\android\src\main\kotlin\id\oddbit\flutter\facebook_app_events\FacebookAppEventsPlugin.kt:16:48: warning: 'Registrar' is deprecated. Deprecated in Java
exception: import io.flutter.plugin.common.PluginRegistry.Registrar
exception:                                                ^
exception:                                         ^
e: Daemon compilation failed: null
java.lang.Exception
    
    at java.base/java.lang.Thread.run(Thread.java:829)
Caused by: java.lang.IllegalArgumentException: this and base files have different roots: C:\Users\Administrator\AppData\Local\Pub\Cache\hosted\pub.dev\package_info_plus-4.0.2\android\src\main\kotlin\dev\fluttercommunity\plus\packageinfo\PackageInfoPlugin.kt and D:\flutter\smartinia\wedort\client\android.
    
    at java.rmi/sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:676)
    ... 3 more

Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
e: Daemon compilation failed: null
java.lang.Exception
    
    at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.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\Administrator\AppData\Local\Pub\Cache\hosted\pub.dev\sign_in_with_apple-5.0.0\android\src\main\kotlin\com\aboutyou\dart_packages\sign_in_with_apple\SignInWithApplePlugin.kt and D:\flutter\smartinia\wedort\client\android.
    at kotlin.io.FilesKt__UtilsKt.toRelativeString(Utils.kt:117)
    at kotlin.io.FilesKt__UtilsKt.relativeTo(Utils.kt:128)
    

    at java.rmi/sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:676)
    ... 3 more
e: Daemon compilation failed: null
java.lang.Exception
    at org.jetbrains.kotlin.daemon.common.CompileService$CallResult$Error.get(CompileService.kt:69)
    at org.jetbrains.kotlin.daemon.common.CompileService$CallResult$Error.get(CompileService.kt:65)
    
    
    at java.base/java.lang.Thread.run(Thread.java:829)
Caused by: java.lang.IllegalArgumentException: this and base files have different roots: C:\Users\Administrator\AppData\Local\Pub\Cache\hosted\pub.dev\stripe_android-9.5.0+1\android\src\main\kotlin\com\facebook\react\bridge\BaseActivityEventListener.kt and D:\flutter\smartinia\wedort\client\android.
    at kotlin.io.FilesKt__UtilsKt.toRelativeString(Utils.kt:117)
    at kotlin.io.FilesKt__UtilsKt.relativeTo(Utils.kt:128)
    
    at java.rmi/sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.lambda$run$0(TCPTransport.java:677)
    at java.base/java.security.AccessController.doPrivileged(Native Method)
    at java.rmi/sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:676)
    ... 3 more

exception: c:\Users\Administrator\AppData\Local\Pub\Cache\hosted\pub.dev\fluttertoast-8.2.2\android\src\main\kotlin\io\github\ponnamkarthik\toast\fluttertoast\FlutterToastPlugin.kt:9:48: warning: 'Registrar' is deprecated. Deprecated in Java
exception: import io.flutter.plugin.common.PluginRegistry.Registrar
exception:                                                ^
exception: c:\Users\Administrator\AppData\Local\Pub\Cache\hosted\pub.dev\fluttertoast-8.2.2\android\src\main\kotlin\io\github\ponnamkarthik\toast\fluttertoast\MethodCallHandlerImpl.kt:55:40: warning: 'setColorFilter(Int, PorterDuff.Mode): Unit' is deprecated. Deprecated in Java
exception:                     gradientDrawable!!.setColorFilter(bgcolor.toInt(), PorterDuff.Mode.SRC_IN)
exception:                                        ^
exception: c:\Users\Administrator\AppData\Local\Pub\Cache\hosted\pub.dev\fluttertoast-8.2.2\android\src\main\kotlin\io\github\ponnamkarthik\toast\fluttertoast\MethodCallHandlerImpl.kt:66:29: warning: 'setter for view: View?' is deprecated. Deprecated in Java
exception:                     mToast?.view = layout
exception:                             ^
exception: c:\Users\Administrator\AppData\Local\Pub\Cache\hosted\pub.dev\fluttertoast-8.2.2\android\src\main\kotlin\io\github\ponnamkarthik\toast\fluttertoast\MethodCallHandlerImpl.kt:71:62: warning: 'getter for view: View?' is deprecated. Deprecated in Java
exception:                             val textView: TextView = mToast?.view!!.findViewById(android.R.id.message)
exception:                                                              ^
exception: c:\Users\Administrator\AppData\Local\Pub\Cache\hosted\pub.dev\package_info_plus-4.0.2\android\src\main\kotlin\dev\fluttercommunity\plus\packageinfo\PackageInfoPlugin.kt:37:43: warning: 'getPackageInfo(String, Int): PackageInfo!' is deprecated. Deprecated in Java
exception:                 val info = packageManager.getPackageInfo(applicationContext!!.packageName, 0)
exception:                                           ^
exception: c:\Users\Administrator\AppData\Local\Pub\Cache\hosted\pub.dev\sign_in_with_apple-5.0.0\android\src\main\kotlin\com\aboutyou\dart_packages\sign_in_with_apple\SignInWithApplePlugin.kt:17:48: warning: 'Registrar' is deprecated. Deprecated in Java
exception: import io.flutter.plugin.common.PluginRegistry.Registrar
exception:                                                ^
exception: c:\Users\Administrator\AppData\Local\Pub\Cache\hosted\pub.dev\sign_in_with_apple-5.0.0\android\src\main\kotlin\com\aboutyou\dart_packages\sign_in_with_apple\SignInWithApplePlugin.kt:54:33: warning: 'Registrar' is deprecated. Deprecated in Java
exception:     fun registerWith(registrar: Registrar) {
exception:                                 ^
e: Daemon compilation failed: null
java.lang.Exception

    at java.base/java.lang.Thread.run(Thread.java:829)
Caused by: java.lang.IllegalArgumentException: this and base files have different roots: C:\Users\Administrator\AppData\Local\Pub\Cache\hosted\pub.dev\sentry_flutter-7.16.1\android\src\main\kotlin\io\sentry\flutter\SentryFlutter.kt and D:\flutter\smartinia\wedort\client\android.
    at kotlin.io.FilesKt__UtilsKt.toRelativeString(Utils.kt:117)
    at kotlin.io.FilesKt__UtilsKt.relativeTo(Utils.kt:128)
t.java:796)
    
    at java.rmi/sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:676)
    ... 3 more
exception: warning: language version 1.4 is deprecated and its support will be removed in a future version of Kotlin
Exited (1)

我尝试增加和减少 jvm 大小。 我尝试用虚拟电话更换手机。 我尝试了扑动干净 然后我尝试 flutter pub get

android flutter dart debugging compilation
1个回答
0
投票

尝试以下步骤,解决问题:

1- 使用 extensions tap 中的 使用的 gradle 版本 安装 兼容版本的 kotlin 语言扩展。

2- 暂时禁用签名发布

© www.soinside.com 2019 - 2024. All rights reserved.