问题描述:
当我在配置好app签名、开启代码混淆后,直接build项目一切正常,然而当我执行以下命令时
cd <app dir> (<app dir> 为您的工程目录).
运行flutter build apk (flutter build 默认会包含 --release选项).
errors如下:
Compiler message:
Error: SDK root directory not found: file:///Users/macuser/Programs/flutter/bin/cache/artifacts/engine/common/flutter_patched_sdk_product/.
Error: Error when reading 'file:///Users/macuser/Programs/flutter/bin/cache/artifacts/engine/common/flutter_patched_sdk_product/platform_strong.dill': No such file or directory
Error: Error when reading 'file:///Users/macuser/Programs/flutter/bin/cache/artifacts/engine/common/flutter_patched_sdk_product/platform_strong.dill': No such file or directory
Unhandled exception:
Crash when compiling package:flutter_app/main.dart,
at character offset null:
RangeError (index): Index out of range: no indices are valid: 0
0 Uint8List.[] (dart:typed_data-patch/typed_data_patch.dart:2188:7)
1 BinaryBuilder.readByte (package:kernel/binary/ast_from_binary.dart:95:27)
2 BinaryBuilder.readUint32 (package:kernel/binary/ast_from_binary.dart:115:13)
解决办法如下:
1、找到该文件 ../flutter/bin/cache 并执行 rm -rf 删除操作
2、 重新执行 fluttor doctor -v 命令
即可解决问题: