Skip to content

[flutter build] Building with both --no-codesign and --obfuscate throws misleading errors when misused. #113203

@lucavenir

Description

@lucavenir

Hi there!

Steps to Reproduce

Suppose you want to build you app, with the following command:

flutter build ipa --no-codesign --release --obfuscate --split-debug-info=/build/[some-subfolder]/symbols

(I'm building an IPA just as an example)

You can see that the path provided to the split-debug-info option is missing a dot (it should be ./build/.... That's a typo, that may happen. Anyways, this will point at the root of my filesystem. This is going to raise some permission errors for sure (for the record - this is true even on my CI / CD setup).

The problem

I was mislead onto searching the root cause because of the output I was given. The errors given pointed me in wrong direction, making me think that the --no-codesign flag was broken or that it couldn't work together with --obfuscate. You'll understand once you read the output.

iOS

Here's the output I receive while running the aforementioned command (building an IPA).

Output
Warning: Building for device with codesigning disabled. You will have to manually codesign before deploying to device.
Building com.[app-name].[flavor] for device (ios-release)...
Running pod install...                                             810ms
Running Xcode build...                                                  
Xcode build done.                                            4.6s
Failed to build iOS app
Error output from Xcode build:
↳
     BUILD FAILED 


Xcode's output:
↳
    Writing result bundle at path:
        /var/folders/vp/z7j2d77d2gqbw60zjyfjy58h0000gn/T/flutter_tools.5mBiX4/flutter_ios_build_temp_dirH2Q1Dj/temporary_xcresult_bundle


    Failed to package /[path-to-local-repo]/[app-folder].
    Command PhaseScriptExecution failed with a nonzero exit code
    note: Building targets in dependency order
    /[path-to-local-repo]/[app-folder]/ios/Pods/Pods.xcodeproj: warning: The iOS deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is
    11.0 to 16.0.99. (in target 'ReachabilitySwift' from project 'Pods')
    warning: Run script build phase 'Run Script' will be run during every build because it does not specify any outputs. To address this warning, either add output dependencies to the script phase, or configure it to
    run in every build by unchecking "Based on dependency analysis" in the script phase. (in target 'Runner' from project 'Runner')
    warning: Run script build phase 'Thin Binary' will be run during every build because it does not specify any outputs. To address this warning, either add output dependencies to the script phase, or configure it to
    run in every build by unchecking "Based on dependency analysis" in the script phase. (in target 'Runner' from project 'Runner')

    Result bundle written to path:
        /var/folders/vp/z7j2d77d2gqbw60zjyfjy58h0000gn/T/flutter_tools.5mBiX4/flutter_ios_build_temp_dirH2Q1Dj/temporary_xcresult_bundle

════════════════════════════════════════════════════════════════════════════════
Building a deployable iOS app requires a selected Development Team with a 
Provisioning Profile. Please ensure that a Development Team is selected by:
  1- Open the Flutter project's Xcode target with
       open ios/Runner.xcworkspace
  2- Select the 'Runner' project in the navigator then the 'Runner' target
     in the project settings
  3- Make sure a 'Development Team' is selected under Signing & Capabilities > Team. 
     You may need to:
         - Log in with your Apple ID in Xcode first
         - Ensure you have a valid unique Bundle ID
         - Register your device with your Apple Developer Account
         - Let Xcode automatically provision a profile for your app
  4- Build or run your project again

For more information, please visit:
  https://flutter.dev/docs/get-started/install/macos#deploy-to-ios-devices

Or run on an iOS simulator without code signing
════════════════════════════════════════════════════════════════════════════════
Encountered error while building for device.

When asking for a verbose output, the flutter tool finally gives some intel (I'll just copy one line here)

[+5 ms] Target aot_assembly_release failed: FileSystemException: Creation failed, path = '/build' (OS Error: Read-only file system, errno = 30)

Android

The above behavior is reproducible when building Android apps, too. But a different output is shown, saying that the build "just fails". The verbose output isn't useful at all - I can't read any file-system-related errors.

Other platforms

I haven't tested this for other builds (e.g. web, windows, macOS, linux), but I guess the results should be similar.

Solution

None, really. This is related on how flutter build outputs the wrong error.

Unsurprisingly, writing the correct folder won't raise errors (flutter build ipa --no-codesign --release --obfuscate --split-debug-info=./build/[some-subfolder]/symbols), but this issue isn't about me writing a typo, this is about the flutter build give very misleading errors.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Important issues not at the top of the work lista: buildBuilding flutter applications with the toolfound in release: 3.3Found to occur in 3.3found in release: 3.4Found to occur in 3.4has reproducible stepsThe issue has been confirmed reproducible and is ready to work onplatform-androidAndroid applications specificallyplatform-iosiOS applications specificallyr: fixedIssue is closed as already fixed in a newer versiontoolAffects the "flutter" command-line tool. See also t: labels.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions