我使用flutter create testtest
创建一个名为testest
的示例应用来运行示例测试用例,但是当我运行flutter test ./test/widget_test.dart
错误:
flutter test
00:00 +0 -1: loading /home/helen/Git/testtest/test/widget_test.dart [E]
Failed to load "Git/testtest/test/widget_test.dart":
Shell subprocess crashed with unexpected exit code 127 before connecting to test harness.
Test: Git/testtest/test/widget_test.dart
Shell: /home/h/flutter/bin/cache/artifacts/engine/linux-x64/flutter_tester
00:00 +0 -1: Some tests failed.
Shell: /home/h/flutter/bin/cache/artifacts/engine/linux- x64/flutter_tester: error while loading shared libraries: libGLU.so.1: cannot open shared object file: No such file or directory
测试代码 import'package:flutter / material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:testtest/main.dart';
void main() {
testWidgets('Counter increments smoke test', (WidgetTester tester) async {
// Build our app and trigger a frame.
await tester.pumpWidget(new MyApp());
// Verify that our counter starts at 0.
expect(find.text('0'), findsOneWidget);
expect(find.text('1'), findsNothing);
// Tap the '+' icon and trigger a frame.
await tester.tap(find.byIcon(Icons.add));
await tester.pump();
// Verify that our counter has incremented.
expect(find.text('0'), findsNothing);
expect(find.text('1'), findsOneWidget);
});
}
flutter doctor
[✓] Flutter(在Linux上,locale en_NZ.UTF-8,频道alpha) •在/ home / helen / flutter处晃动 •框架修订版8f65fec5f5(4周前),2017-12-12 09:50:14 -0800 •引擎修订版edaecdc8b8 •Tools Dart版本1.25.0-dev.11.0 •Engine Dart版本2.0.0-edge.d8ae797298c3a6cf8dc9f4558707bd2672224d3e
[✓] Android工具链 - 针对Android设备开发(Android SDK 26.0.3) •Android SDK / home / helen / Android / Sdk •Android NDK at / home / helen / Android / Sdk / ndk-bundle •平台android-26,构建工具26.0.3 •Java二进制文件:/ home / helen / sdks / android-studio / jre / bin / java •Java版OpenJDK运行时环境(版本1.8.0_152-release-915-b01)
[✓] Android Studio(3.0版) •Android Studio / home / helen / sdks / android-studio •Java版OpenJDK运行时环境(版本1.8.0_152-release-915-b01)
[✓] IntelliJ IDEA社区版(2017.2版) •Flutter插件版本18.4 •Dart插件版本172.4343.25
[ - ]连接设备 •无
解决方案:
我正在使用fedora
并解决此问题,请运行以下命令:
sudo dnf install mesa-libGLU.x86_64
答案 0 :(得分:1)
查看与tabindex
...
libGLU
检查您是否安装了正确的数据包。如果不是:
Shell: /home/h/flutter/bin/cache/artifacts/engine/linux- x64/flutter_tester: error while loading shared libraries: libGLU.so.1: cannot open shared object file: No such file or directory
或
## UBUNTU-LIKE ##
sudo apt-get install libglu1
## Fedora ##
dnf install mesa-libGLU.x86_64
取决于您是否需要32位版本