当我尝试运行新的示例应用程序时,无法打开 xmltree 错误
Posted
技术标签:
【中文标题】当我尝试运行新的示例应用程序时,无法打开 xmltree 错误【英文标题】:Unable to open xmltree error in flutter when i try to run fresh sample app 【发布时间】:2019-11-05 00:06:37 【问题描述】:每当我尝试从 vscode 运行颤振应用程序时,我都会收到错误
W/ziparchive( 6116): Unable to open 'xmltree': No such file or directory
xmltree: error:failed to open file: The system cannot find the file specified. (2).
从 android studio 运行相同的应用程序。 同样在安装后,当我运行命令 flutter doctor 时,我也会遇到问题。 在 sdk 中找不到 aapt 文件时出错,所以我将 aapt2 文件复制到同一文件夹中并用 aapt 重命名。
下面分享一下我运行命令flutter run
时创建的日志文件Flutter crash report; please file at https://github.com/flutter/flutter/issues.
command
flutter run
exception
String: Exit code 1 from:
C:\Users\admin\AppData\Local\Android\Sdk\build-tools\28.0.3\aapt dump xmltree E:\Flutter App\first_app\build\app\outputs\apk\app.apk AndroidManifest.xml
#0 _runWithLoggingSync (package:flutter_tools/src/base/process.dart:360:7)
#1 runCheckedSync (package:flutter_tools/src/base/process.dart:289:10)
#2 new AndroidApk.fromApk (package:flutter_tools/src/application_package.dart:120:27)
#3 AndroidApk.fromAndroidProject (package:flutter_tools/src/application_package.dart:158:27)
<asynchronous suspension>
#4 ApplicationPackageFactory.getPackageForPlatform (package:flutter_tools/src/application_package.dart:46:32)
<asynchronous suspension>
#5 FlutterDevice.runHot (package:flutter_tools/src/resident_runner.dart:345:56)
<asynchronous suspension>
#6 HotRunner.run (package:flutter_tools/src/run_hot.dart:253:39)
<asynchronous suspension>
#7 RunCommand.runCommand (package:flutter_tools/src/commands/run.dart:428:
37)
<asynchronous suspension>
#8 FlutterCommand.verifyThenRunCommand (package:flutter_tools/src/runner/flutter_command.dart:559:18)
#9 _asyncThenWrapperHelper.<anonymous closure> (dart:async-patch/async_patch.dart:77:64)
#10 _rootRunUnary (dart:async/zone.dart:1132:38)
#11 _CustomZone.runUnary (dart:async/zone.dart:1029:19)
#12 _FutureListener.handleValue (dart:async/future_impl.dart:126:18)
#13 Future._propagateToListeners.handleValueCallback (dart:async/future_impl.dart:639:45)
#14 Future._propagateToListeners (dart:async/future_impl.dart:668:32)
#15 Future._complete (dart:async/future_impl.dart:473:7)
#16 _SyncCompleter.complete (dart:async/future_impl.dart:51:12)
#17 _AsyncAwaitCompleter.complete (dart:async-patch/async_patch.dart:28:18)
#18 _completeOnAsyncReturn (dart:async-patch/async_patch.dart:294:13)
#19 RunCommand.usageValues (package:flutter_tools/src/commands/run.dart)
#20 _asyncThenWrapperHelper.<anonymous closure> (dart:async-patch/async_patch.dart:77:64)
#21 _rootRunUnary (dart:async/zone.dart:1132:38)
#22 _CustomZone.runUnary (dart:async/zone.dart:1029:19)
#23 _FutureListener.handleValue (dart:async/future_impl.dart:126:18)
#24 Future._propagateToListeners.handleValueCallback (dart:async/future_impl.dart:639:45)
#25 Future._propagateToListeners (dart:async/future_impl.dart:668:32)
#26 Future._complete (dart:async/future_impl.dart:473:7)
#27 _SyncCompleter.complete (dart:async/future_impl.dart:51:12)
#28 _AsyncAwaitCompleter.complete.
<anonymous closure> (dart:async-patch/async_patch.dart:33:20)
#29 _rootRun (dart:async/zone.dart:1124:13)
#30 _CustomZone.run (dart:async/zone.dart:1021:19)
#31 _CustomZone.bindCallback.<anonymous closure> (dart:async/zone.dart:947:23)
#32 _microtaskLoop (dart:async/schedule_microtask.dart:41:21)
#33 _startMicrotaskLoop (dart:async/schedule_microtask.dart:50:5)
#34 _runPendingImmediateCallback (dart:isolate-patch/isolate_patch.dart:115:13)
#35 _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:172:5)
扑医生:
[✓] Flutter (Channel stable, v1.5.4-hotfix.2, on Microsoft Windows [Version 10.0.10240], locale en-IN)
• Flutter version 1.5.4-hotfix.2 at D:\Flutter SDK\flutter
• Framework revision 7a4c33425d (8 weeks ago), 2019-04-29 11:05:24 -0700
• Engine revision 52c7a1e849
• Dart version 2.3.0 (build 2.3.0-dev.0.5 a1668566e5)
[✓] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
• Android SDK at C:\Users\admin\AppData\Local\Android\Sdk
• Android NDK location not configured (optional; useful for native profiling support)
• Platform android-28, build-tools 28.0.3
• ANDROID_HOME = C:\Users\admin\AppData\Local\Android\Sdk
• Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java
• Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1343-b01)
• All Android licenses accepted.
[✓] Android Studio (version 3.4)
• Android Studio at C:\Program Files\Android\Android Studio
• Flutter plugin version 36.1.1
• Dart plugin version 183.6270
• Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1343-b01)
[✓] VS Code (version 1.35.1)
• VS Code at C:\Users\admin\AppData\Local\Programs\Microsoft VS Code
• Flutter extension version 3.1.0
[✓] Connected device (1 available)
• Redmi Y1 • 8c9968db • android-arm64 • Android 7.1.2 (API 25)
• No issues found!
我正在使用真机进行测试。
【问题讨论】:
这是新创建的flutter应用还是现有的flutter应用?即使使用新项目也会出现此错误吗? 是的,它是新创建的应用程序。 是vscode新创建的吗?我也在做同样的事情,我可以成功部署到我的设备上。请先尝试此处列出的步骤flutter.dev/docs/development/tools/vs-code 这将引导您进入新创建的应用程序和基本环境。我还建议您在这里提交问题github.com/flutter/flutter/issues 感谢 @BarryWang 的支持。我通过将我的 Android SDK 从 28 更新到 29 解决了这个问题.. 很高兴知道这一点 【参考方案1】:感谢@BarryWang 的帮助。 我通过将我的 Android SDK 版本从 28 API 升级到 29 解决了这个问题。
【讨论】:
【参考方案2】:我已经尝试了我的灵魂,它对我有用。
您的问题在 C:\Users\admin\AppData\Local\Android\Sdk\build-tools\28.0.3\ 文件中的 aapt.exe 中
尝试手动执行它大多数时候会出现错误,因为缺少 DLL 文件
你要做的就是将你的版本(sdk 28.0.3)的aapt.exe替换成其他版本的另一个appt.exe 你可以在这个文件夹“C:\Users\admin\AppData\Local\Android\Sdk\build-tools\”中找到安装在你的android studio中的sdks版本 如果您没有其他版本,请安装主题之一( 在我的情况下,我的应用程序由 sdk 29.0.1 运行,它会产生问题,所以我从 28.0.3 获取 aapt.exe,然后在 sdk 29.0.1 中通过它祝你好运
【讨论】:
以上是关于当我尝试运行新的示例应用程序时,无法打开 xmltree 错误的主要内容,如果未能解决你的问题,请参考以下文章
如何修复 SessionNotCreatedException:尝试运行 Firefox 时无法创建新的远程会话?