macos arm64 flutter builds - xcode

I have an problem building hello world flutter project for arm64 (apple m1 pro silicon) macos platform:
$ flutter build macos
Running "flutter pub get" in flutter_application_1... 234ms
πŸ’ͺ Building with sound null safety πŸ’ͺ
--- xcodebuild: WARNING: Using the first of multiple matching destinations:
{ platform:macOS, arch:arm64, id:00006000-000C09201A06801E }
{ platform:macOS, arch:x86_64, id:00006000-000C09201A06801E }
Snapshot not compatible with the current VM configuration: the snapshot requires 'release no-code_comments no-dwarf_stack_traces_mode lazy_async_stacks lazy_dispatchers no-dedup_instructions no-asserts use_field_guards use_osr no-branch_coverage x64-sysv no-compressed-pointers no-null-safety' but the VM has 'release no-code_comments no-dwarf_stack_traces_mode lazy_async_stacks lazy_dispatchers no-dedup_instructions no-asserts use_field_guards use_osr no-branch_coverage arm64-sysv no-compressed-pointers no-null-safety'
Command PhaseScriptExecution failed with a nonzero exit code
** BUILD FAILED **
Building macOS application...
Build process failed
Unfortunately I'm not an expert on flutter and flutter build tools, but it seems that flutter builds x86_64 binary and tries to run it on aarch64 platform for some reason. How can I make flutter to build aarch64 version of app?
Template project built with command:
flutter create --template app --platforms macos hello_world
Tools version info:
$ flutter --version
Flutter 3.0.4 β€’ channel stable β€’ https://github.com/flutter/flutter.git
Framework β€’ revision 85684f9300 (3 months ago) β€’ 2022-06-30 13:22:47 -0700
Engine β€’ revision 6ba2af10bb
Tools β€’ Dart 2.17.5 β€’ DevTools 2.12.2
$ sw_vers
ProductName: macOS
ProductVersion: 12.1
BuildVersion: 21C52
$ xcodebuild -version
Xcode 13.0
Build version 13A233

The main issue was with the way I've installed flutter: nixpkgs. It tries to find tools in wrong folder. After modifying patches https://github.com/NixOS/nixpkgs/pull/196133 for macos everything works fine.

Related

Flutter build iOS error CocoaPods not installed. Skipping pod install

Iam using Mac and upgraded to Android studio "Bumblebee", only in Mac when I try to do: Build -> Flutter -> Build iOS it shows this warning:
Warning: CocoaPods not installed. Skipping pod install. CocoaPods is used to retrieve the iOS and macOS platform side's plugin code that responds to your plugin usage on the Dart side. Without CocoaPods, plugins will not work on iOS or macOS. For more info, see https://flutter.dev/platform-plugins To install see https://guides.cocoapods.org/using/getting-started.html#installation for instructions. CocoaPods not installed or not in valid state. Process finished with exit code 1
But I did already this
gem install cocoapods Successfully installed cocoapods-1.11.2 Parsing documentation for cocoapods-1.11.2 Done installing documentation for cocoapods after 1 seconds 1 gem installed
When I do sudo gem install cocoapods I got:
ERROR: While executing gem ... (Gem::FilePermissionError) You don't have write permissions for the /usr/bin directory.
I did Invalidate Caches and pod install also, but it still shows same warning.
Flutter doctor
[βœ“] Flutter (Channel stable, 2.8.1, on macOS 11.0.1 20B29 darwin-x64, locale en-GB)
β€’ Flutter version 2.8.1 at /Users/test/Downloads/flutter
β€’ Upstream repository https://github.com/flutter/flutter.git
β€’ Framework revision 77d935af4d (6 weeks ago), 2021-12-16 08:37:33 -0800
β€’ Engine revision 890a5fca2e
β€’ Dart version 2.15.1
[!] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
β€’ Android SDK at /Users/test/Library/Android/sdk
βœ— cmdline-tools component is missing
Run path/to/sdkmanager --install "cmdline-tools;latest"
See https://developer.android.com/studio/command-line for more details.
βœ— Android license status unknown.
Run flutter doctor --android-licenses to accept the SDK licenses.
See https://flutter.dev/docs/get-started/install/macos#android-setup for more details.
[!] Xcode - develop for iOS and macOS (Xcode 12.5.1)
β€’ Xcode at /Applications/Xcode.app/Contents/Developer
! Flutter recommends a minimum Xcode version of 13.0.0.
Download the latest version or update via the Mac App Store.
βœ— CocoaPods not installed.
CocoaPods is used to retrieve the iOS and macOS platform side's plugin code that responds to your plugin usage on the Dart side.
Without CocoaPods, plugins will not work on iOS or macOS.
For more info, see https://flutter.dev/platform-plugins
To install see https://guides.cocoapods.org/using/getting-started.html#installation for instructions.
[βœ—] Chrome - develop for the web (Cannot find Chrome executable at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome)
! Cannot find Chrome. Try setting CHROME_EXECUTABLE to a Chrome executable.
[βœ“] Android Studio (version 2021.1)
β€’ Android Studio at /Users/test/Desktop/Android Studio.app/Contents
β€’ Flutter plugin can be installed from:
πŸ”¨ https://plugins.jetbrains.com/plugin/9212-flutter
β€’ Dart plugin can be installed from:
πŸ”¨ https://plugins.jetbrains.com/plugin/6351-dart
β€’ Java version OpenJDK Runtime Environment (build 11.0.11+0-b60-7590822)
How to fix it?
Regards
close android studio
open terminal -> run open /Applications/Android\ Studio.app
try again ...
problem comes with new android studio version bumblebee
android studio started from macs dock is not able to reach the environment variables when its started from mac os dock
UPDATE:
run chmod +x /Applications/Android\ Studio.app/Contents/bin/printenv
now it works from dock
Just run this at terminal: run chmod +x /Applications/Android\ Studio.app/Contents/bin/printenv
The issue appears to be Cocopods not being installed with Big Sur or above. I found upgrading Ruby to a newer version and then installing Cocopods helped my coworker. Please follow the steps in the solution for installing Cocopods: Unable to install cocoa pods
It's now fixed with the latest patch on BumbleBee. Check this blog post.

Flutter not able to run, get_navigation & theme error

i'm actually trying to run my app but i'm stucked with that error :
Running "flutter pub get" in riverpod_stacked_app...
Launching lib/main.dart on sdk gphone x86 arm in debug mode...
Running Gradle task 'assembleDebug'...
../../.pub-cache/hosted/pub.dartlang.org/get-3.15.0/lib/get_navigation/src/extension_navigation.dart:235:37: Error: No named parameter with the name 'shadowThemeOnly'.
final theme = Theme.of(context, shadowThemeOnly: true);
^^^^^^^^^^^^^^^
../../development/flutter/packages/flutter/lib/src/material/theme.dart:119:20: Context: Found this candidate, but the arguments don't match.
static ThemeData of(BuildContext context) {
^^
../../.pub-cache/hosted/pub.dartlang.org/get-3.15.0/lib/get_navigation/src/extension_navigation.dart:431:43: Error: No named parameter with the name 'shadowThemeOnly'.
theme: Theme.of(key.currentContext, shadowThemeOnly: true),
^^^^^^^^^^^^^^^
../../development/flutter/packages/flutter/lib/src/material/theme.dart:119:20: Context: Found this candidate, but the arguments don't match.
static ThemeData of(BuildContext context) {
^^
FAILURE: Build failed with an exception.
* Where:
Script '/Users/Alex/development/flutter/packages/flutter_tools/gradle/flutter.gradle' line: 900
* What went wrong:
Execution failed for task ':app:compileFlutterBuildDebug'.
> Process 'command '/Users/Alex/development/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 19s
Exception: Gradle task assembleDebug failed with exit code 1
I don't understand why it can't build. I don't see the link between those 2 errors :
get_navigation
something with the theme from material.dart
And my actual motivation to use riverpod, stacked_services and firebase.
Here is the result of flutter doctor -v :
[βœ“] Flutter (Channel master, 1.24.0-8.0.pre.98, on Mac OS X 10.15.7 19H2 darwin-x64, locale fr-FR)
β€’ Flutter version 1.24.0-8.0.pre.98 at /Users/Alex/development/flutter
β€’ Framework revision ef4ec09a06 (6 hours ago), 2020-11-05 08:02:13 -0800
β€’ Engine revision bf259226b2
β€’ Dart version 2.12.0 (build 2.12.0-21.0.dev)
[βœ“] Android toolchain - develop for Android devices (Android SDK version 30.0.2)
β€’ Android SDK at /Users/Alex/Library/Android/sdk
β€’ Platform android-30, build-tools 30.0.2
β€’ Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
β€’ Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6222593)
β€’ All Android licenses accepted.
[βœ—] Xcode - develop for iOS and macOS
βœ— Xcode installation is incomplete; a full installation is necessary for iOS development.
Download at: https://developer.apple.com/xcode/download/
Or install Xcode via the App Store.
Once installed, run:
sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer
sudo xcodebuild -runFirstLaunch
βœ— CocoaPods not installed.
CocoaPods is used to retrieve the iOS and macOS platform side's plugin code that responds to your plugin usage on the Dart side.
Without CocoaPods, plugins will not work on iOS or macOS.
For more info, see https://flutter.dev/platform-plugins
To install see https://guides.cocoapods.org/using/getting-started.html#installation for instructions.
[βœ“] Android Studio (version 4.1)
β€’ Android Studio at /Applications/Android Studio.app/Contents
β€’ Flutter plugin can be installed from:
πŸ”¨ https://plugins.jetbrains.com/plugin/9212-flutter
β€’ Dart plugin can be installed from:
πŸ”¨ https://plugins.jetbrains.com/plugin/6351-dart
β€’ Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6222593)
[βœ“] Connected device (1 available)
β€’ sdk gphone x86 arm (mobile) β€’ emulator-5554 β€’ android-x86 β€’ Android 11 (API 30) (emulator)
! Doctor found issues in 1 category.
And here is my dependencies in pubspeck.yaml
version: 1.0.0+1
environment:
sdk: ">=2.7.0 <3.0.0"
dependencies:
flutter:
sdk: flutter
cupertino_icons: ^1.0.0
stacked_services:
auto_route: 0.6.9
hooks_riverpod: 0.12.1
flutter_hooks:
firebase_core: 0.5.1
firebase_auth: 0.18.2
dev_dependencies:
flutter_test:
sdk: flutter
build_runner:
auto_route_generator:
Any ideas ? I've trie to clean up my dependencies and reinstall. Also i start a blank project with flutter counter app and it runs properly.
I also had this problem today after upgrading Flutter.
I was only able to solve it after I deleted that method parameter from the file that triggered the error. You'll have to delete it in two places.
Search in .pub-cache/hosted/pub.dartlang.org/get-3.15.0/lib/get_navigation/src/extension_navigation.dart for
Theme.of(key.currentContext, shadowThemeOnly: true)
As replace it with
Theme.of(key.currentContext)
This is probably cause by the stacked_services dependency that uses the get: ^3.15.0 dependency
Later edit: this is actually not the best solution, because somebody cloning your repo will not be able to compile the project unless they also to this change
So it's better to upgrade the dependency that causes this error, or replace it with another one; but only after you ran flutter upgrade, or try changing the channel
this is already fixed by getx in 16.1. Pub upgrade will do it
https://github.com/jonataslaw/getx/issues/762
you need to remove only
ThemeData theme = Theme.of(key.currentContext, shadowThemeOnly: false);
if (theme != null) {
bottomSheet = new Theme(data: theme, child: bottomSheet);
}
return bottomSheet;
form your .pubcach folder.

Flutter stable 1.17.1 and Xcode 11.5 issues

After upgrading to Flutter 1.17.1 and Xcode 11.5, I cannot build for iOS anymore.
Despite following all the direction in https://flutter.dev/docs/development/ios-project-migration
Anyone faces the same issue? Any solution?
flutter doctor
Waiting for another flutter command to release the startup lock...
Doctor summary (to see all details, run flutter doctor -v):
[βœ“] Flutter (Channel stable, v1.17.1, on Mac OS X 10.15.4 19E287, locale en-SG)
[βœ“] Android toolchain - develop for Android devices (Android SDK version 29.0.0-rc1)
[βœ“] Xcode - develop for iOS and macOS (Xcode 11.5)
[βœ“] Android Studio (version 3.6)
[!] Android Studio (version 2.3)
βœ— Flutter plugin version 12.1 - the recommended minimum version is 16.0.0
[βœ“] VS Code (version 1.45.1)
[!] Connected device
! No devices available
! Doctor found issues in 2 categories.
Here is the output when I do
flutter run
Launching lib/main.dart on iPhone 11 Pro Max in debug mode...
Your Xcode project requires migration. See https://flutter.dev/docs/development/ios-project-migration for details.
Error launching application on iPhone 11 Pro Max.
Yes, in addition, I have to remove the above.
thanks
Came from 1.13=>1.17. It did not upgrade my project automatically so I had to work a bit in Xcode. I solved the issue by executing all steps listed on the migration page. Then executing:
rm -rf ios/Flutter/App.framework
rm -rf ios/Pod*
flutter clean
Build and run =>Β success

flutter does't see ios-deploy

I installed flutter by official docs. When I did flutter doctor -v I don't get information with :
IOS toolchain as my other(old) mac book.
[βœ“] iOS toolchain - develop for iOS devices (Xcode 11.2.1)
β€’ Xcode at /Applications/Xcode.app/Contents/Developer
β€’ Xcode 11.2.1, Build version 11B500
β€’ ios-deploy 1.9.4
β€’ CocoaPods version 1.8.3
Instead this I get:
> [βœ“] Xcode - develop for iOS and macOS (Xcode 11.2.1)
> β€’ Xcode at /Applications/Xcode.app/Contents/Developer
> β€’ Xcode 11.2.1, Build version 11B500
> β€’ CocoaPods version 1.8.4
and flutter doesn't see ios-deploy. Which I installed as well.
ios-deploy --version
1.10.0-beta.3
And as result on my new mac book my project doen't work. I cloned the same git branch on my new macbook and get error after run "flutter build ios --release --no-codesign":
8 warnings generated.
=== BUILD TARGET Runner OF PROJECT Runner WITH CONFIGURATION Release ===
ld: targeted OS version does not support use of thread local variables in __ZZN9GMSx_absl18container_internal10RandomSeedEvE7counter for architecture armv7
clang: error: linker command failed with exit code 1 (use -v to see invocation)
#Pro You was right, this is not flutter issue.
Answear:
The issue fixed by changing the Deployment Target from 8.0 to 9.0 in Xcode

Xcode XCBuild support error for ionic build

I have a ionic project that I am trying to build on iOS.
When running ionic build ios, it gives this error:
FIXME: Implement XCBuild support for macros in overriding parameters
with condition sets:
CODE_SIGN_IDENTITY[sdk=iphoneos*] = iPhone Developer
Error: Error code 1 for command: xcodebuild with args:
-xcconfig,/Users/Person/ProjectA/platforms/ios/cordova/build-debug.xcconfig,-project,ProjectA.xcodeproj,ARCHS=i386,-target,ProjectA,-configuration,Debug,-sdk,iphonesimulator,build,VALID_ARCHS=i386,CONFIGURATION_BUILD_DIR=/Users/Person/ProjectA/platforms/ios/build/emulator,SHARED_PRECOMPS_DIR=/Users/Person/ProjectA/platforms/ios/build/sharedpch
I have tried:
Remove platform and add platform
Change CODE_SIGN_IDENTITY[sdk=iphoneos*] from iPhone Distributor to iPhone Developer in build-release.xcconfig
Re-did signing from xcode to try both automatic and manual signing
but all were not successful.
I am running:
Cordova CLI: 6.1.1
Ionic Framework Version: 2.0.0-beta.4
Ionic CLI Version: 2.1.0
Ionic App Lib Version: 2.0.0-beta.20
ios-deploy version: 1.9.4
ios-sim version: 5.0.8
Node Version: v4.4.7
Xcode version: Xcode 11.1 Build version 11A1027
It is an old ionic version but able to run on my old macbook air (OS: High Sierra). I am now using a new macbook air (OS: Mojave) and trying to setup the environment.
Any suggestions?
I was getting this error after re-adding the iOS platform to my project with cordova#8.1.2/cordova-ios#4.5.4, even with a build.json file included in my project. I manually upgraded to cordova-ios#5.1.1 (by specifying the version in the cordova platforms add ios#5 command) and the error went away.

Resources