1.错误场景:终端运行
flutter build apk --flavor prob -t lib/main.dart --obfuscate --split-debug-info=/.symbols
运行结果
FAILURE: Build failed with an exception.
* Where:
Script '/Users/nvr-dev/Applications/flutter/packages/flutter_tools/gradle/flutter.gradle' line: 991
* What went wrong:
Execution failed for task ':app:compileFlutterBuildProbRelease'.
> Process 'command '/Users/nvr-dev/Applications/flutter/bin/flutter'' finished with non-zero exit value 1
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 18s
Running Gradle task 'assembleProbRelease'...
Running Gradle task 'assembleProbRelease'... Done 29.3s
Gradle task assembleProbRelease failed with exit code 1
解决:
--obfuscate --split-debug-info=/.symbols
打包命令的这一段指的是混淆打包,这一段去掉,运行“flutter build apk --flavor prob -t lib/main.dart”就可以正常打包了