我试图从抖动开始,首先我在cmd上运行flutter doctor
可以正常工作。
在我安装了ANDROID SDK之后,相同的命令flutter doctor
给了我一个例外:
Doctor summary (to see all details, run flutter doctor -v):
Oops; flutter has exited unexpectedly.
Sending crash report to Google.
Crash report sent (report ID: 3c1505515eaa45d1)
Unhandled exception:
RangeError (index): Invalid value: Only valid value is 0: 1
#0 List.[] (dart:core/runtime/libgrowable_array.dart:145:60)
#1 AndroidNdk.locateNdk.findNdkMajorVersion.<anonymous closure> (package:flutter_tools/src/android/android_sdk.dart:222:42)
#2 MapBase._fillMapWithMappedIterable (dart:collection/maps.dart:67:32)
#3 new LinkedHashMap.fromIterable (dart:collection/linked_hash_map.dart:124:13)
#4 AndroidNdk.locateNdk.findNdkMajorVersion (package:flutter_tools/src/android/android_sdk.dart:219:44)
#5 AndroidNdk.locateNdk (package:flutter_tools/src/android/android_sdk.dart:233:47)
#6 AndroidSdk.locateAndroidSdk (package:flutter_tools/src/android/android_sdk.dart:341:24)
#7 AppContext._generateIfNecessary.<anonymous closure> (package:flutter_tools/src/base/context.dart:99:41)
#8 __InternalLinkedHashMap&_HashVMBase&MapMixin&_LinkedHashMapMixin.putIfAbsent (dart:collection/runtime/libcompact_hash.dart:281:23)
#9 AppContext._generateIfNecessary (package:flutter_tools/src/base/context.dart:87:20)
#10 AppContext.[] (package:flutter_tools/src/base/context.dart:114:32)
#11 AppContext.[] (package:flutter_tools/src/base/context.dart:113:22)
#12 androidSdk (package:flutter_tools/src/android/android_sdk.dart:20:37)
#13 AndroidLicenseValidator.validate (package:flutter_tools/src/android/android_workflow.dart:180:9)
<asynchronous suspension>
#14 GroupedValidator.validate (package:flutter_tools/src/doctor.dart:318:52)
#15 _AsyncAwaitCompleter.start (dart:async/runtime/libasync_patch.dart:49:6)
#16 GroupedValidator.validate (package:flutter_tools/src/doctor.dart:315:36)
#17 Doctor.startValidatorTasks (package:flutter_tools/src/doctor.dart:116:52)
#18 Doctor.diagnose (package:flutter_tools/src/doctor.dart:189:41)
#19 _AsyncAwaitCompleter.start (dart:async/runtime/libasync_patch.dart:49:6)
#20 Doctor.diagnose (package:flutter_tools/src/doctor.dart:179:24)
#21 _doctorText.<anonymous closure> (package:flutter_tools/runner.dart:188:26)
#22 AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:142:29)
#23 _AsyncAwaitCompleter.start (dart:async/runtime/libasync_patch.dart:49:6)
#24 AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:142:7)
#25 _rootRun (dart:async/zone.dart:1124:13)
#26 _CustomZone.run (dart:async/zone.dart:1021:19)
#27 _runZoned (dart:async/zone.dart:1516:10)
#28 runZoned (dart:async/zone.dart:1463:12)
#29 AppContext.run (package:flutter_tools/src/base/context.dart:141:18)
#30 _AsyncAwaitCompleter.start (dart:async/runtime/libasync_patch.dart:49:6)
#31 AppContext.run (package:flutter_tools/src/base/context.dart:129:19)
#32 _doctorText (package:flutter_tools/runner.dart:187:19)
#33 _AsyncAwaitCompleter.start (dart:async/runtime/libasync_patch.dart:49:6)
#34 _doctorText (package:flutter_tools/runner.dart:183:27)
#35 _createLocalCrashReport (package:flutter_tools/runner.dart:165:32)
#36 _AsyncAwaitCompleter.start (dart:async/runtime/libasync_patch.dart:49:6)
#37 _createLocalCrashReport (package:flutter_tools/runner.dart:150:37)
#38 _handleToolError (package:flutter_tools/runner.dart:120:33)
#39 _asyncThenWrapperHelper.<anonymous closure> (dart:async/runtime/libasync_patch.dart:77:64)
#40 _rootRunUnary (dart:async/zone.dart:1132:38)
#41 _CustomZone.runUnary (dart:async/zone.dart:1029:19)
#42 _FutureListener.handleValue (dart:async/future_impl.dart:126:18)
#43 Future._propagateToListeners.handleValueCallback (dart:async/future_impl.dart:639:45)
#44 Future._propagateToListeners (dart:async/future_impl.dart:668:32)
#45 Future._complete (dart:async/future_impl.dart:473:7)
#46 _SyncCompleter.complete (dart:async/future_impl.dart:51:12)
#47 _AsyncAwaitCompleter.complete (dart:async/runtime/libasync_patch.dart:28:18)
#48 _completeOnAsyncReturn (dart:async/runtime/libasync_patch.dart:294:13)
#49 CrashReportSender.sendReport (package:flutter_tools/src/crash_reporting.dart)
#50 _asyncThenWrapperHelper.<anonymous closure> (dart:async/runtime/libasync_patch.dart:77:64)
#51 _rootRunUnary (dart:async/zone.dart:1132:38)
#52 _CustomZone.runUnary (dart:async/zone.dart:1029:19)
#53 _FutureListener.handleValue (dart:async/future_impl.dart:126:18)
#54 Future._propagateToListeners.handleValueCallback (dart:async/future_impl.dart:639:45)
#55 Future._propagateToListeners (dart:async/future_impl.dart:668:32)
#56 Future._complete (dart:async/future_impl.dart:473:7)
#57 Stream.fold.<anonymous closure> (dart:async/stream.dart:724:18)
#58 _rootRun (dart:async/zone.dart:1120:38)
#59 _CustomZone.run (dart:async/zone.dart:1021:19)
#60 _CustomZone.runGuarded (dart:async/zone.dart:923:7)
#61 _BufferingStreamSubscription._sendDone.sendDone (dart:async/stream_impl.dart:389:13)
#62 _BufferingStreamSubscription._sendDone (dart:async/stream_impl.dart:399:15)
#63 _BufferingStreamSubscription._close (dart:async/stream_impl.dart:283:7)
#64 _SinkTransformerStreamSubscription._close (dart:async/stream_transformers.dart:96:11)
#65 _EventSinkWrapper.close (dart:async/stream_transformers.dart:23:11)
#66 _StringAdapterSink.close (dart:convert/string_conversion.dart:251:11)
#67 _Utf8ConversionSink.close (dart:convert/string_conversion.dart:302:20)
#68 _ConverterStreamEventSink.close (dart:convert/chunked_conversion.dart:82:18)
#69 _SinkTransformerStreamSubscription._handleDone (dart:async/stream_transformers.dart:141:24)
#70 _rootRun (dart:async/zone.dart:1120:38)
#71 _CustomZone.run (dart:async/zone.dart:1021:19)
#72 _CustomZone.runGuarded (dart:async/zone.dart:923:7)
#73 _BufferingStreamSubscription._sendDone.sendDone (dart:async/stream_impl.dart:389:13)
#74 _BufferingStreamSubscription._sendDone (dart:async/stream_impl.dart:399:15)
#75 _BufferingStreamSubscription._close (dart:async/stream_impl.dart:283:7)
#76 _ForwardingStream._handleDone (dart:async/stream_pipe.dart:106:10)
#77 _ForwardingStreamSubscription._handleDone (dart:async/stream_pipe.dart:172:13)
#78 _rootRun (dart:async/zone.dart:1120:38)
#79 _CustomZone.run (dart:async/zone.dart:1021:19)
#80 _CustomZone.runGuarded (dart:async/zone.dart:923:7)
#81 _BufferingStreamSubscription._sendDone.sendDone (dart:async/stream_impl.dart:389:13)
#82 _BufferingStreamSubscription._sendDone (dart:async/stream_impl.dart:399:15)
#83 _BufferingStreamSubscription._close (dart:async/stream_impl.dart:283:7)
#84 _SinkTransformerStreamSubscription._close (dart:async/stream_transformers.dart:96:11)
#85 _EventSinkWrapper.close (dart:async/stream_transformers.dart:23:11)
#86 _ByteAdapterSink.close (dart:convert/byte_conversion.dart:62:11)
#87 _FilterSink.close (dart:io/data_transformer.dart:637:11)
#88 _ConverterStreamEventSink.close (dart:convert/chunked_conversion.dart:82:18)
#89 _SinkTransformerStreamSubscription._handleDone (dart:async/stream_transformers.dart:141:24)
#90 _rootRun (dart:async/zone.dart:1120:38)
#91 _CustomZone.run (dart:async/zone.dart:1021:19)
#92 _CustomZone.runGuarded (dart:async/zone.dart:923:7)
#93 _BufferingStreamSubscription._sendDone.sendDone (dart:async/stream_impl.dart:389:13)
#94 _BufferingStreamSubscription._sendDone (dart:async/stream_impl.dart:399:15)
#95 _BufferingStreamSubscription._close (dart:async/stream_impl.dart:283:7)
#96 _ForwardingStream._handleDone (dart:async/stream_pipe.dart:106:10)
#97 _ForwardingStreamSubscription._handleDone (dart:async/stream_pipe.dart:172:13)
#98 _rootRun (dart:async/zone.dart:1120:38)
#99 _CustomZone.run (dart:async/zone.dart:1021:19)
#100 _CustomZone.runGuarded (dart:async/zone.dart:923:7)
#101 _BufferingStreamSubscription._sendDone.sendDone (dart:async/stream_impl.dart:389:13)
#102 _BufferingStreamSubscription._sendDone (dart:async/stream_impl.dart:399:15)
#103 _BufferingStreamSubscription._close (dart:async/stream_impl.dart:283:7)
#104 _SyncStreamController._sendDone (dart:async/stream_controller.dart:772:19)
#105 _StreamController._closeUnchecked (dart:async/stream_controller.dart:629:7)
#106 _StreamController.close (dart:async/stream_controller.dart:622:5)
#107 _HttpParser._closeIncoming (dart:_http/http_parser.dart:1037:23)
#108 _HttpParser._doParse (dart:_http/http_parser.dart:752:11)
#109 _HttpParser._parse (dart:_http/http_parser.dart:318:7)
#110 _HttpParser._onData (dart:_http/http_parser.dart:810:5)
#111 _rootRunUnary (dart:async/zone.dart:1132:38)
#112 _CustomZone.runUnary (dart:async/zone.dart:1029:19)
#113 _CustomZone.runUnaryGuarded (dart:async/zone.dart:931:7)
#114 _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:336:11)
#115 _BufferingStreamSubscription._add (dart:async/stream_impl.dart:263:7)
#116 _SyncStreamController._sendData (dart:async/stream_controller.dart:764:19)
#117 _StreamController._add (dart:async/stream_controller.dart:640:7)
#118 _StreamController.add (dart:async/stream_controller.dart:586:5)
#119 _Socket._onData (dart:io/runtime/binsocket_patch.dart:1774:41)
#120 _rootRunUnary (dart:async/zone.dart:1132:38)
#121 _CustomZone.runUnary (dart:async/zone.dart:1029:19)
#122 _CustomZone.runUnaryGuarded (dart:async/zone.dart:931:7)
#123 _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:336:11)
#124 _BufferingStreamSubscription._add (dart:async/stream_impl.dart:263:7)
#125 _SyncStreamController._sendData (dart:async/stream_controller.dart:764:19)
#126 _StreamController._add (dart:async/stream_controller.dart:640:7)
#127 _StreamController.add (dart:async/stream_controller.dart:586:5)
#128 _RawSecureSocket._sendReadEvent (dart:io/secure_socket.dart:1004:19)
#129 _rootRun (dart:async/zone.dart:1120:38)
#130 _CustomZone.run (dart:async/zone.dart:1021:19)
#131 _CustomZone.runGuarded (dart:async/zone.dart:923:7)
#132 _CustomZone.bindCallbackGuarded.<anonymous closure> (dart:async/zone.dart:963:23)
#133 _rootRun (dart:async/zone.dart:1124:13)
#134 _CustomZone.run (dart:async/zone.dart:1021:19)
#135 _CustomZone.bindCallback.<anonymous closure> (dart:async/zone.dart:947:23)
#136 Timer._createTimer.<anonymous closure> (dart:async/runtime/libtimer_patch.dart:21:15)
#137 _Timer._runTimers (dart:isolate/runtime/libtimer_impl.dart:382:19)
#138 _Timer._handleMessage (dart:isolate/runtime/libtimer_impl.dart:416:5)
#139 _RawReceivePortImpl._handleMessage (dart:isolate/runtime/libisolate_patch.dart:171:12)
答案 0 :(得分:0)
您可以尝试转到项目的根目录并运行命令
flutter clean
希望有帮助。