当我尝试运行新的示例应用程序时,无法在Flutter中打开xmltree错误

时间:2019-06-22 12:00:50

标签: java android flutter dart visual-studio-code

每当我尝试从vscode运行flutter应用程序时,都会收到错误消息

p

同一应用从android studio运行。 同样在安装后,当我运行命令 flutter doctor 时,我也遇到了问题。 错误在SDK中找不到a帆aapt文件,因此我将aapt2文件复制到同一文件夹中,并使用aapt重命名。

下面,我分享了运行命令 flutter run

时创建的日志文件
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).

颤抖的医生:

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)

我正在使用真实设备进行测试。

2 个答案:

答案 0 :(得分:0)

谢谢@BarryWang的帮助。 我通过将Android SDk版本从28 API升级到29解决了这个问题。

答案 1 :(得分:0)

我已经尽力了,对我有用。

  • 您遇到的问题是C:\ Users \ admin \ AppData \ Local \ Android \ Sdk \ build-tools \ 28.0.3 \文件中的aapt.exe

  • 尝试手动执行该命令,大多数情况下会出现DLL文件丢失的错误

  • 您要做的是用其他版本<28.0.3
  • 的另一个appt.exe替换您版本(sdk 28.0.3)的aapt.exe。
  • 您可以在此文件夹““ C:\ Users \ admin \ AppData \ Local \ Android \ Sdk \ build-tools \”“
  • 中找到安装在android studio中的sdks版本。
  • 如果没有其他版本,请安装主题之一(<28.0.3)
  • 在我的情况下,我的应用程序由sdk 29.0.1运行,它产生了问题,因此我从28.0.3中获取了aapt.exe,并将其保留在sdk 29.0.1中

祝你好运