发生%1的安装错误的Flutter不是有效的Win32应用程序

时间:2018-09-04 17:06:56

标签: flutter

我是新手,请尝试按照以下步骤进行安装... 1)下载并解压缩到驱动器中 2)在环境变量中设置路径

现在我正在尝试运行Flutter Doctor,它向我显示以下错误,请检查是否有人遇到相同的问题...谢谢!

 ` [√] Flutter (Channel beta, v0.6.0, on Microsoft Windows [Version 10.0.17134.228], locale en-US)
-Unhandled exception:
ProcessException: %1 is not a valid Win32 application.

  Command: C:\Users\Rahul Mishra\AppData\Local\Android\Sdk\platform-tools\adb.EXE devices -l
#0      _ProcessImpl._runAndWait (dart:io/runtime/binprocess_patch.dart:488:7)
#1      _runNonInteractiveProcessSync (dart:io/runtime/binprocess_patch.dart:634:18)
#2      Process.runSync (dart:io/runtime/binprocess_patch.dart:66:12)
#3      LocalProcessManager.runSync (package:process/src/interface/local_process_manager.dart:83:20)
#4      _runWithLoggingSync (package:flutter_tools/src/base/process.dart:322:48)
#5      runSync (package:flutter_tools/src/base/process.dart:296:10)
#6      getAdbDevices (package:flutter_tools/src/android/android_device.dart:563:23)
#7      AndroidDevices.pollingGetDevices (package:flutter_tools/src/android/android_device.dart:55:53)
<asynchronous suspension>
#8      PollingDeviceDiscovery.devices (package:flutter_tools/src/device.dart:163:56)
<asynchronous suspension>
#9      DeviceManager.getAllConnectedDevices (package:flutter_tools/src/device.dart:91:46)
<asynchronous suspension>
#10     DeviceValidator.validate (package:flutter_tools/src/doctor.dart:537:54)
<asynchronous suspension>
#11     Doctor.startValidatorTasks (package:flutter_tools/src/doctor.dart:88:56)
#12     Doctor.diagnose (package:flutter_tools/src/doctor.dart:145:41)
#13     _AsyncAwaitCompleter.start (dart:async/runtime/libasync_patch.dart:49:6)
#14     Doctor.diagnose (package:flutter_tools/src/doctor.dart:135:24)
#15     DoctorCommand.runCommand (package:flutter_tools/src/commands/doctor.dart:29:39)
#16     _AsyncAwaitCompleter.start (dart:async/runtime/libasync_patch.dart:49:6)
#17     DoctorCommand.runCommand (package:flutter_tools/src/commands/doctor.dart:28:42)
#18     FlutterCommand.verifyThenRunCommand (package:flutter_tools/src/runner/flutter_command.dart:348:18)
#19     _asyncThenWrapperHelper.<anonymous closure> (dart:async/runtime/libasync_patch.dart:77:64)
#20     _rootRunUnary (dart:async/zone.dart:1132:38)
#21     _CustomZone.runUnary (dart:async/zone.dart:1029:19)
#22     _FutureListener.handleValue (dart:async/future_impl.dart:129:18)
#23     Future._propagateToListeners.handleValueCallback (dart:async/future_impl.dart:642:45)
#24     Future._propagateToListeners (dart:async/future_impl.dart:671:32)
#25     Future._complete (dart:async/future_impl.dart:476:7)
#26     _SyncCompleter.complete (dart:async/future_impl.dart:51:12)  
#27     _AsyncAwaitCompleter.complete.<anonymous closure> (dart:async/runtime/libasync_patch.dart:33:20)
#28     _rootRun (dart:async/zone.dart:1124:13)
#29     _CustomZone.run (dart:async/zone.dart:1021:19)
#30     _CustomZone.bindCallback.<anonymous closure> (dart:async/zone.dart:947:23)
#31     _microtaskLoop (dart:async/schedule_microtask.dart:41:21)
#32     _startMicrotaskLoop (dart:async/schedule_microtask.dart:50:5)
#33     _runPendingImmediateCallback (dart:isolate/runtime/libisolate_patch.dart:114:13)
#34     _RawReceivePortImpl._handleMessage (dart:isolate/runtime/libisolate_patch.dart:170:5)`

4 个答案:

答案 0 :(得分:3)

当我遇到这个问题时,是因为环境变量ANDROID_HOME中有一个空格,在您的情况下,它将是C:\ Users \ Rahul Mishra \ AppData \ Local \ Android \ Sdk,并且Rahul和米什拉

解决该问题的方法是,将我的配置文件连接到不包含空格的地方,然后将ANDROID_HOME重定向到它。要建立结,您可以执行以下操作:

mklink /J C:\Users\rmishra "C:\Users\Rahul Mishra"

然后在“系统属性”->“环境变量”中将ANDROID_HOME更改为指向C:\ Users \ rmishra \ AppData \ Local \ Android \ Sdk

希望这会有所帮助

答案 1 :(得分:0)

您是否安装了Android Studio,它正在发送和adb错误,我认为这是android sdk安装的一部分。

请执行windows文档中的所有步骤。

答案 2 :(得分:0)

这是因为您的用户名中有空格。我遇到了同样的问题,弄乱了整个注册表,将用户目录更改为没有姓氏的目录。最后,它起作用了。 首先更改您的用户名,然后尝试更改目录名称

答案 3 :(得分:0)

就像@cshortridge之所以提到它,是因为ANDROID_HOME有空间,但是该解决方案对我不起作用,所以我开始搜索,发现您只需要移动默认情况下位于的Android SDK。我发现这个精彩的教程可以更改SDK管理器的路径:

https://github.com/flutter/flutter/issues/19805#issuecomment-478306166

希望可以帮助某人:)