首页 > 解决方案 > 由于 Flutter 代码混淆,创建失败

问题描述

我正在关注本指南:https ://flutter.dev/docs/deployment/obfuscate

运行 Flutter 1.17.5 • 通道稳定

当我运行时:

flutter build apk --obfuscate --split-debug-info=/sample/debug --target-platform android-arm,android-arm64,android-x64

然后我收到以下错误:

    Target android_aot_release_android-arm failed: FileSystemException: Creation failed, path =
 '/sample' (OS Error: Read-only file system, errno = 30)
    Target android_aot_release_android-x64 failed: FileSystemException: Creation failed, path = 
'/sample' (OS Error: Read-only file system, errno = 30)
    Target android_aot_release_android-arm64 failed: FileSystemException: Creation failed, path = 
'/sample' (OS Error: Read-only file system, errno = 30)
    build failed.                                                           
                                                                            
    FAILURE: Build failed with an exception.                                
                                                                            
    * Where:                                                                
    Script '/Users/user/Developer/flutter/packages/flutter_tools/gradle/flutter.gradle' line: 882
                                                                            
    * What went wrong:                                                      
    Execution failed for task ':app:compileFlutterBuildRelease'.            
    > Process 'command '/Users/user/Developer/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                              

标签: flutterdart

解决方案


您应该从根目录提供相对路径:

flutter build apk --obfuscate --split-debug-info=./sample/debug

推荐阅读