可以在笔记本电脑上构建 Android 应用程序,但不能在 PC 上构建 - 完全相同的代码

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

这让我发疯。我正在使用 VS Code + Flutter 为 Android 设备构建移动应用程序。我可以在笔记本电脑上轻松编译和运行调试版本和发布版本,但是当我将完全相同的代码移植到我的 PC 上时,它会失败并出现异常。我开始认为这可能是某种硬件问题,但我没有立即发现任何问题。

这是 JVM 崩溃日志:https://drive.google.com/file/d/152I0TeG3UlVj2nbn30d0Vs_Kk8zF0Joz/view?usp=sharing

我已经尝试了所有常见的方法,清理gradle,清理flutter,删除.gradle文件夹等等。希望有人能成为我的救世主!

Changing current working directory to: C:\Users\geoff\Documents\Projects\arcadious

Expected to find fonts for (MaterialIcons, packages/cupertino_icons/CupertinoIcons), but found (MaterialIcons). This usually means you are referring to font families in an IconData class but not including them in the assets section of your pubspec.yaml, are missing the package that would include them, or are missing "uses-material-design: true".
Font asset "MaterialIcons-Regular.otf" was tree-shaken, reducing it from 1645184 to 2168 bytes (99.9% reduction). Tree-shaking can be disabled by providing the --no-tree-shake-icons flag when building your app.
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: C:\Users\geoff\AppData\Local\Pub\Cache\hosted\pub.dev\google_mobile_ads-5.1.0\android\src\main\java\io\flutter\plugins\googlemobileads\FlutterRequestAgentProvider.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
The message received from the daemon indicates that the daemon has disappeared.
Build request sent: Build{id=f21c7b8c-f7da-4c61-b675-02c1de5caa0e, currentDir=C:\Users\geoff\Documents\Projects\arcadious\android}
Attempting to read last messages from the daemon log...
Daemon pid: 22212
  log file: C:\Users\geoff\.gradle\daemon\8.10.2\daemon-22212.out.log
----- Last 20 lines from daemon log file - daemon-22212.out.log -----
2024-09-27T13:47:04.304+0800 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Lock acquired on daemon addresses registry.
2024-09-27T13:47:04.305+0800 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Releasing lock on daemon addresses registry.
2024-09-27T13:47:04.305+0800 [DEBUG] [org.gradle.launcher.daemon.server.DaemonStateCoordinator] resetting idle timer
2024-09-27T13:47:04.305+0800 [DEBUG] [org.gradle.launcher.daemon.server.DaemonStateCoordinator] daemon is running. Sleeping until state changes.
2024-09-27T13:47:04.305+0800 [INFO] [org.gradle.launcher.daemon.server.exec.StartBuildOrRespondWithBusy] Daemon is about to start building Build{id=f21c7b8c-f7da-4c61-b675-02c1de5caa0e, currentDir=C:\Users\geoff\Documents\Projects\arcadious\android}. Dispatching build started information...
2024-09-27T13:47:04.305+0800 [DEBUG] [org.gradle.launcher.daemon.server.SynchronizedDispatchConnection] thread 35: dispatching org.gradle.launcher.daemon.protocol.BuildStarted@10ae6077
2024-09-27T13:47:04.306+0800 [DEBUG] [org.gradle.launcher.daemon.server.exec.EstablishBuildEnvironment] Configuring env variables: [PATH, USERDOMAIN_ROAMINGPROFILE, PROCESSOR_LEVEL, SYSTEMDRIVE, SESSIONNAME, ALLUSERSPROFILE, PROCESSOR_ARCHITECTURE, VSCODE_GIT_IPC_HANDLE, DRIVERDATA, PROGRAMFILES, VSCODE_INJECTION, EFC_8168, PSMODULEPATH, COLORTERM, PROGRAMDATA, DIRNAME, USERNAME, VSCODE_GIT_ASKPASS_NODE, TERM_PROGRAM_VERSION, CMD_LINE_ARGS, GIT_ASKPASS, CHROME_CRASHPAD_PIPE_NAME, EXIT_WITH_ERRORLEVEL, VSCODE_STABLE, FPS_BROWSER_USER_PROFILE_STRING, ONEDRIVE, APP_HOME, MINGIT_PATH, PATHEXT, SNAPSHOT_PATH, SHARED_BIN, WINDIR, ORIGINAL_XDG_CURRENT_DESKTOP, HOMEPATH, PROCESSOR_IDENTIFIER, PUBLIC, CACHE_DIR, ZES_ENABLE_SYSMAN, _SKIP, LOCALAPPDATA, COMMONPROGRAMFILES(X86), USERDOMAIN, DART_SDK_PATH, FPS_BROWSER_APP_PROFILE_STRING, LOGONSERVER, JAVA_HOME, FLUTTER_TOOLS_DIR, PROMPT, PROGRAMFILES(X86), FLUTTER_ROOT, LANG, VSCODE_GIT_ASKPASS_MAIN, =C:, APPDATA, PROGRAMW6432, SYSTEMROOT, JAVA_EXE, VSCODE_GIT_ASKPASS_EXTRA_ARGS, DART, OS, TERM_PROGRAM, COMMONPROGRAMW6432, COMPUTERNAME, COMMONPROGRAMFILES, COMSPEC, PROCESSOR_REVISION, CLASSPATH, VSCODE_NONCE, APP_BASE_NAME, TEMP, FLUTTER_ALREADY_LOCKED, HOMEDRIVE, USERPROFILE, TMP, NUMBER_OF_PROCESSORS]
2024-09-27T13:47:04.308+0800 [DEBUG] [org.gradle.launcher.daemon.server.exec.LogToClient] About to start relaying all logs to the client via the connection.
2024-09-27T13:47:04.308+0800 [INFO] [org.gradle.launcher.daemon.server.exec.LogToClient] The client will now receive all logging from the daemon (pid: 22212). The daemon log file: C:\Users\geoff\.gradle\daemon\8.10.2\daemon-22212.out.log
2024-09-27T13:47:04.309+0800 [INFO] [org.gradle.launcher.daemon.server.exec.LogAndCheckHealth] Starting build in new daemon [memory: 4 GiB]
2024-09-27T13:47:04.310+0800 [DEBUG] [org.gradle.launcher.daemon.server.exec.ExecuteBuild] The daemon has started executing the build.
2024-09-27T13:47:04.310+0800 [DEBUG] [org.gradle.launcher.daemon.server.exec.ExecuteBuild] Executing build with daemon context: DefaultDaemonContext[uid=a6a36e05-9676-4584-a054-dd5be7915c14,javaHome=C:\Program Files\Android\Android Studio\jbr,javaVersion=17,javaVendor=JetBrains s.r.o.,daemonRegistryDir=C:\Users\geoff\.gradle\daemon,pid=22212,idleTimeout=10800000,priority=NORMAL,applyInstrumentationAgent=true,nativeServicesMode=ENABLED,daemonOpts=-XX:MaxMetaspaceSize=2G,-XX:+HeapDumpOnOutOfMemoryError,--add-opens=java.base/java.util=ALL-UNNAMED,--add-opens=java.base/java.lang=ALL-UNNAMED,--add-opens=java.base/java.lang.invoke=ALL-UNNAMED,--add-opens=java.prefs/java.util.prefs=ALL-UNNAMED,--add-exports=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED,--add-exports=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED,--add-opens=java.base/java.nio.charset=ALL-UNNAMED,--add-opens=java.base/java.net=ALL-UNNAMED,--add-opens=java.base/java.util.concurrent.atomic=ALL-UNNAMED,-Xmx4G,-Dfile.encoding=windows-1252,-Duser.country=SG,-Duser.language=en,-Duser.variant]
Expected to find fonts for (MaterialIcons, packages/cupertino_icons/CupertinoIcons), but found (MaterialIcons). This usually means you are referring to font families in an IconData class but not including them in the assets section of your pubspec.yaml, are missing the package that would include them, or are missing "uses-material-design: true".
Font asset "MaterialIcons-Regular.otf" was tree-shaken, reducing it from 1645184 to 2168 bytes (99.9% reduction). Tree-shaking can be disabled by providing the --no-tree-shake-icons flag when building your app.
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: C:\Users\geoff\AppData\Local\Pub\Cache\hosted\pub.dev\google_mobile_ads-5.1.0\android\src\main\java\io\flutter\plugins\googlemobileads\FlutterRequestAgentProvider.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.----- End of the daemon log -----

JVM crash log found: file:///C:/Users/geoff/Documents/Projects/arcadious/android/hs_err_pid22212.log

FAILURE: Build failed with an exception.

* What went wrong:
Gradle build daemon disappeared unexpectedly (it may have been killed or may have crashed)

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
> Get more help at https://help.gradle.org.
Running Gradle task 'assembleRelease'...                           34.1s
Gradle task assembleRelease failed with exit code 1```
android flutter gradle
2个回答
0
投票

尝试这个命令:

flutter build apk --no-tree-shake-icons

0
投票

根据错误日志,找到了类似错误的解决方案,尝试一下。

我今天在 Ubuntu 中遇到了同样的错误。要暂时绕过该错误,请将 ->-no-daemon 添加到我正在运行的 gradle 命令中。删除 /home/{username}/.gradle 文件夹中的守护进程 > 子文件夹永久修复了该错误。

复制自以下问题:

flutter:Gradle 构建守护进程意外消失(它可能已被杀死或可能已崩溃)

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