Our app have many flavors (around 20).
When running flutter clean, flutter run internally the following command for each flavors which took some times :
/usr/bin/arch -arm64e xcrun xcodebuild -workspace /Users/my_user/Documents/projects/flutter-app/ios/Runner.xcworkspace -scheme client_one clean
...
/usr/bin/arch -arm64e xcrun xcodebuild -workspace /Users/my_user/Documents/projects/flutter-app/ios/Runner.xcworkspace -scheme client_two clean
Flutter clean can took more than 10min.
Do you have any idea ?
My device :
MacBook Pro M1
Flutter 3.0.5 / 3.3.3
Related
App runs on macOS but when I try fluter run -v on iOS(iPad), it gets stuck on the following:
Running Xcode build...
[ +2 ms] executing: [/Users/apfox500/Documents/GitHub/AAC-App/ios/] xcrun xcodebuild -configuration Debug VERBOSE_SCRIPT_LOGGING=YES -workspace Runner.xcworkspace -scheme Runner BUILD_DIR=/Users/apfox500/Documents/GitHub/AAC-App/build/ios -sdk
iphoneos -destination id=00008101-001868481EE9001E ONLY_ACTIVE_ARCH=YES ARCHS=arm64 SCRIPT_OUTPUT_STREAM_FILE=/var/folders/hg/mls6tcw111sgfh2t7v539zrh0000gn/T/flutter_tools.j2rCNj/flutter_ios_build_temp_dirBj4KR5/pipe_to_stdout -resultBundlePath
/var/folders/hg/mls6tcw111sgfh2t7v539zrh0000gn/T/flutter_tools.j2rCNj/flutter_ios_build_temp_dirBj4KR5/temporary_xcresult_bundle -resultBundleVersion 3 FLUTTER_SUPPRESS_ANALYTICS=true COMPILER_INDEX_STORE_ENABLE=NO
I've run flutter doctor and nothing is wrong, tried flutter clean and pod deintegrate/pod install many times as well as building directly from Xcode, with nothing working.
I'm using fastlane to release an app. The simplified version of xcodebuild command to build the app is this:
xcodebuild -workspace App.xcworkspace -scheme App
-configuration Release -sdk iphoneos13.6
-destination 'generic/platform=iOS' clean archive
This fails giving (adding a sample):
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/sys/cdefs.h:807:2: error: Unsupported architecture
#error Unsupported architecture
^
In file included from /Users/sudeepkumar/Zendrive/mobile-apps/ios/copilot/Pods/glog/src/symbolize.cc:55:
In file included from /Users/sudeepkumar/Zendrive/mobile-apps/ios/copilot/Pods/glog/src/utilities.h:73:
In file included from /Users/sudeepkumar/Zendrive/mobile-apps/ios/copilot/Pods/glog/src/base/mutex.h:141:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/pthread.h:55:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/_types.h:27:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/sys/_types.h:33:
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/machine/_types.h:34:2: error: architecture not supported
#error architecture not supported
^
I see that it's picking the MacOSX.sdk, I would expect it to pick iPhoneOS sdk present in Xcode directory. Is this the reason for failure? Or something else?
xcrun output:
» xcrun --show-sdk-platform-path
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform
» xcrun --sdk iphoneos --show-sdk-platform-path
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform
Xcode is using the SDK in /Library/CommandLineTools. Instead, it should be using those inside Xcode app. Run
xcode-select -r
or
xcode-select -s "/Applications/Xcode.app/Contents/Developer"
Verify by
xcode-select -p
Some of them may need sudo.
xcodebuild -workspace App.xcworkspace -scheme App
-configuration Release -sdk iphoneos
-destination 'generic/platform=iOS' clean archive
In the xcodebuild man page
-sdk [<sdkfullpath> | <sdkname>]
Build an Xcode project or workspace against the specified SDK,
using build tools appropriate for that SDK. The argument may be an
absolute path to an SDK, or the canonical name of an SDK.
Use xcrun --sdk iphoneos --show-sdk-path to check the SDK path.
Check the SDK you have in your Mac. In my Mac, there are iPhoneOS.sdk and iPhoneOS13.7.sdk
iPhoneOS13.7.sdk is a symbolic link and its origin is iPhoneOS.sdk .
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS13.7.sdk
Besides,
you can also use xcodebuild -showsdks to see all the sdks
Different parameter for different devices
iOS: -sdk iphoneos
Simulator: -sdk iphonesimulator
watchOS: -sdk watchos
macOS: -sdk macosx
I am trying to automate real ios device with Appium on OS X Catalina.
Here is the error I get:
Appium Doctor confirmed all required components are installed
successfully. "WebDriverAgent.xcodeproj" (path
"/Applications/Appium.app/Contents/Resources/app/node_modules/appium-webdriveragent)successfully
build on xcode (11.4.1) & able to install/run/open the
"IntregrationApp" on iphone xr.
However When running "xcodebuild -project WebDriverAgent.xcodeproj -scheme WebDriverAgentRunner -destination 'id=udid' test" in the terminal, I am getting this error:
xcodebuild
-project WebDriverAgent.xcodeproj -scheme WebDriverAgentRunner -destination 'id=udid' test"
"Command line invocation:
/Applications/Xcode.app/Contents/Developer/usr/bin/xcodebuild -project WebDriverAgent.xcodeproj -scheme WebDriverAgentRunner -destination id=xxxxxxxxxxxxxx test xcodebuild: error: 'WebDriverAgent.xcodeproj' does not exist.
Confirm your path where you run this command
if you install appium through command line then verify pwd as
/usr/local/lib/node_modules/appium/node_modules/appium-webdriveragent
then run above command
I am trying to emulate our flutter app on Mac and I Get this error:
ProcessException: Process timed out:
Command:
/usr/bin/env xcrun xcodebuild -configuration Debug -quiet -workspace Runner.xcworkspace -scheme Runner BUILD_DIR=/Users/samcromer/Desktop/LightBridge-2/build/ios -sdk iphonesimulator -arch x86_64 FLUTTER_SUPPRESS_ANALYTICS=true COMPILER_INDEX_STORE_ENABLE=NO -showBuildSettings
Is there a way to fix this? I am a windows dev so this doesn't make a lot of sense to me.
I have small problem with implementing xcodebuild command test at CI. I have tests related to specific device language, in xcode I can set "Arguments Passed On Launch" to -AppleLanguages (language). Can I pass that argument using xcodebuild?
My script looks like this
xcodebuild -workspace MyApp.xcworkspace -scheme "MyAppTests" -sdk iphonesimulator -destination 'platform=iOS Simulator,name=iPhone 6,OS=9.0' test
Thanks!
xcodebuild is for build your app. You can use this command to run your app with specific language.
xcrun simctl launch <deviceid> <appid> -AppleLanguages "(pt-BR)"
Hera a sample with all steps to buil and run your app:
xcodebuild -sdk iphonesimulator8.4 -arch i386 install DSTROOT=YourAppFolder
xcrun instruments -w "iPhone 6 (8.4 Simulator)"
xcrun simctl install booted YourAppFolder/Applications/YourApp.app
xcrun simctl launch booted com.yourdomain.yourapp -AppleLanguages "(pt-BR)"