Error running flutter app in both Android studio and Xcode - xcode

I am facing this issue after I have switched from beta channel to master and whenever I try to run my Flutter application in either android studio or Xcode I get this error:
2018-09-20 15:18:16.711602+0100 Runner[7370:3358571] ../../third_party/dart/runtime/vm/kernel_binary.cc: 39: error: Invalid kernel binary format version (found 5, expected 7)
2018-09-20 15:18:16.711665+0100 Runner[7370:3358571] Dumping native stack trace for thread 9e03
2018-09-20 15:18:16.735476+0100 Runner[7370:3358571] [0x00000001056f5d64] dart::Profiler::DumpStackTrace(void*)
2018-09-20 15:18:16.735963+0100 Runner[7370:3358571] [0x00000001056f5d64] dart::Profiler::DumpStackTrace(void*)
2018-09-20 15:18:16.736001+0100 Runner[7370:3358571] [0x0000000000000000] Unknown symbol
2018-09-20 15:18:16.737556+0100 Runner[7370:3358571] [0x00000001055f7378] dart::kernel::Program::ReadFromBuffer(unsigned char const*, long, bool)
2018-09-20 15:18:16.737589+0100 Runner[7370:3358571] -- End of DumpStackTrace
This is my flutter doctor:
[✓] Flutter (Channel master, v0.9.3-pre.3, on Mac OS X 10.13.4 17E199, locale en-GB)
• Flutter version 0.9.3-pre.3 at /Users/heyab/flutter
• Framework revision 8b5af14f24 (17 hours ago), 2018-09-19 15:42:51 -0700
• Engine revision 2e8e96fad1
• Dart version 2.1.0-dev.4.0.flutter-4eb879133a
[✓] Android toolchain - develop for Android devices (Android SDK 27.0.3)
• Android SDK at ....
• Android NDK location not configured (optional; useful for native profiling support)
• Platform android-27, build-tools 27.0.3
• Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1024-b01)
• All Android licenses accepted.
[✓] iOS toolchain - develop for iOS devices (Xcode 9.4.1)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Xcode 9.4.1, Build version 9F2000
• ios-deploy 1.9.2
• CocoaPods version 1.5.3
[✓] Android Studio (version 3.1)
• Android Studio at /Applications/Android Studio.app/Contents
• Flutter plugin version 24.2.1
• Dart plugin version 173.4700
• Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1024-b01)
[✓] Connected devices (2 available)
• No issues found!
Can anyone help me please?

I have managed to fix this issue: by going to Build Phases -> Run Script and add:
/bin/sh "$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh" build
and then untick "run script only when installing" -> Code Cleanup -> Build Project -> And perfectly working now! :)

Related

Flutter desktop MacOS - Unable to create FlutterView

Latest Flutter stable, version 3.7 on MacOS. Hello world application (created with flutter create command). Everything is fine on iPhone and web (Chrome). But if I try to flutter run macOS, I'm getting error:
and empty window displayed.
~ % flutter doctor -v
[✓] Flutter (Channel stable, 3.7.0, on macOS 13.1 22C65 darwin-x64, locale
pl-PL)
• Flutter version 3.7.0 on channel stable at
/usr/local/Caskroom/flutter/3.7.0/flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision b06b8b2710 (7 days ago), 2023-01-23 16:55:55 -0800
• Engine revision b24591ed32
• Dart version 2.19.0
• DevTools version 2.20.1
[✗] Android toolchain - develop for Android devices
✗ Unable to locate Android SDK.
Install Android Studio from:
https://developer.android.com/studio/index.html
On first launch it will assist you in installing the Android SDK
components.
(or visit https://flutter.dev/docs/get-started/install/macos#android-setup
for detailed instructions).
If the Android SDK has been installed to a custom location, please use
`flutter config --android-sdk` to update to that location.
[✓] Xcode - develop for iOS and macOS (Xcode 14.2)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Build 14C18
• CocoaPods version 1.11.3
[✓] Chrome - develop for the web
• Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
[!] Android Studio (not installed)
• Android Studio not found; download from
https://developer.android.com/studio/index.html
(or visit https://flutter.dev/docs/get-started/install/macos#android-setup
for detailed instructions).
[✓] Connected device (2 available)
• macOS (desktop) • macos • darwin-x64 • macOS 13.1 22C65 darwin-x64
• Chrome (web) • chrome • web-javascript • Google Chrome 109.0.5414.119
[✓] HTTP Host Availability
• All required HTTP hosts are available
! Doctor found issues in 2 categories.
What's wrong?
It seems that Flutter won't work in VMs anymore as they have removed OpenGL support in version 3.7.0 https://github.com/flutter/flutter/issues/108304

Error: Expected ios/Runner.xcodeproj but this file is missing

I am getting the issue after reinstall my Xcode from 13.2 beta version to 13.2.1 release version, by-mistake I have deleted my project build folder & runner.
Expected ios/Runner.xcodeproj but this file is missing. No application
found for TargetPlatform.ios. Is your project missing an
ios/Runner/Info.plist? Consider running "flutter create ." to create
one.
I also gone through it's suggestion
flutter create .
but still having the same issue. my flutter doctor -v result is
apple#apples-Mac-mini test_ios % flutter doctor -v
[✓] Flutter
(Channel stable, 2.8.1, on macOS 11.6.1 20G224 darwin-x64, locale
en-GB)
• Flutter version 2.8.1 at /Users/apple/Desktop/flutter_sdk/flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision 77d935af4d (12 days 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 31.0.0)
• Android SDK at /Users/apple/Library/Android/sdk
• Platform android-31, build-tools 31.0.0
• ANDROID_HOME = /Users/apple/Library/Android/sdk
• Java binary at: /Applications/Android Studio.app/Contents/jre/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 11.0.10+0-b96-7281165)
• All Android licenses accepted.
[✓] Xcode - develop for iOS and macOS (Xcode 13.2.1)
• Xcode at /Users/apple/Downloads/Xcode.app/Contents/Developer
• CocoaPods version 1.11.2
[✓] Chrome - develop for the web
• Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
[✓] Android Studio (version 2020.3)
• 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 11.0.10+0-b96-7281165)
[✓] Connected device (2 available)
• iPod touch (7th generation) (mobile) • A7FF5F55-96CF-4DD4-9790-6162A82AA0B7 • ios •
com.apple.CoreSimulator.SimRuntime.iOS-15-2 (simulator)
• Chrome (web) • chrome • web-javascript • Google Chrome 96.0.4664.110
• No issues found!
also I have created the new flutter project from Android Studio but unfortunately it is also not containing the same file.
I had the same issue after I manually deleted xcode profile using xcode IDE.
Please try the following:
Create a new flutter project.
Run the project - confirm its in good working order (you will see xcode compilation)
3)I copied all files under ios folder of the new project to my current one & it worked like a charm.
Good luck.
Unfortunately I could not get solution online I had to try my own ways and it worked. This error occurs when you update Xcode. For me I downloaded the Xcode beta, and installed it then recreated the project
. You can extract if you have a backup. Then run Xcode beta simulator. That all. ALL the best.
Some how i found the files Runner.xcodeproj and Runner.xcworspace in bin and restoring them back solved my issues!

X Code failing to archive flutter project

I have a flutter projects which runs smoothly in IOS simulators. But when I try to build archive it keeps failing with error
sent 417348630 bytes received 120 bytes 166939500.00 bytes/sec
total size is 417297279 speedup is 1.00
/Users/blb/Library/Developer/Xcode/DerivedData/Runner- grwmtliatfewpwgywhanjiefmgxn/Build/Intermediates.noindex/ArchiveIntermediates/Runner/InstallationBuildProductsLocation/Applications/Runner.app/Frameworks/App.framework/App: errSecInternalComponent
Command PhaseScriptExecution failed with a nonzero exit code
I have all the developer certificates and accounts etc. Tried every solution I found in internet but didn't worked.
blb#Bhargavs-MacBook-Pro customer % flutter doctor -v
[✓] Flutter (Channel beta, 1.25.0-8.3.pre, on macOS 11.1 20C69 darwin-x64, locale en-IN)
• Flutter version 1.25.0-8.3.pre at /Users/blb/Development/flutter
• Framework revision 5d36f2e7f5 (3 days ago), 2021-01-14 15:57:49 -0800
• Engine revision 7a8f8ca02c
• Dart version 2.12.0 (build 2.12.0-133.7.beta)
[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
• Android SDK at /Users/blb/Library/Android/sdk
• Platform android-30, build-tools 30.0.3
• 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-6915495)
• All Android licenses accepted.
[✓] Xcode - develop for iOS and macOS
• Xcode at /Applications/Xcode.app/Contents/Developer
• Xcode 12.3, Build version 12C33
• CocoaPods version 1.10.1
[✓] Chrome - develop for the web
• Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
[✓] 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-6915495)
[✓] VS Code (version 1.51.1)
• VS Code at /Applications/Visual Studio Code.app/Contents
• Flutter extension version 3.16.0
[✓] Connected device (3 available)
• Redmi Note 7 Pro (mobile) • a682ccfc • android-arm64 • Android 10 (API 29)
• iPhone SE (2nd generation) (mobile) • 2FEBA15E-A172-4FF2-B915-ECF8D222F57A • ios • com.apple.CoreSimulator.SimRuntime.iOS-14-3 (simulator)
• Chrome (web) • chrome • web-javascript • Google Chrome 87.0.4280.141
• No issues found!
It might be related to a singing issue.
I was facing the same issue where the app was forking fine when I did
flutter run // Working
But when I tried creating the ipa for distribution, it used to give me an archive failed error.
flutter build ipa // Error
I tried to do flutter clean, xcode clean and all the other different things but nothing worked.
So, I tried with a sample app, and then ran flutter build ipa which asked me to setup my certificate on that project which I did and it worked fine.
When, I came back to my original project, and it also started working. So, it was definitely some certificate issue which was leading to all these problems. Using a sample project, helped resolve it.

Display an error while debug the flutter App in vscode

I can't debug my Flutter App in Vscode , and DEBUG CONSOL returned :
Unable to locate a development device; please run 'flutter doctor' for
information about installing additional components.
I can show my emulator after run this :
flutter emulators
And i can run it :
flutter emulators --launch 4.7_WXGA_API_22
flutter doctor -v :
[✓] Flutter (Channel stable, v1.7.8+hotfix.4, on Linux, locale en_US.UTF-8)
• Flutter version 1.7.8+hotfix.4 at /home/ZZZ/Dev/Flutter/flutter
• Framework revision 20e59316b8 (10 days ago), 2019-07-18 20:04:33 -0700
• Engine revision fee001c93f
• Dart version 2.4.0
[✓] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
• Android SDK at /media/ZZZ/B0B8B687B8B64C1A/Dev_ubuntu/android-sdk-linux/
• Android NDK location not configured (optional; useful for native profiling support)
• Platform android-28, build-tools 28.0.3
• ANDROID_HOME = /media/ZZZ/B0B8B687B8B64C1A/Dev_ubuntu/android-sdk-linux/
• Java binary at: /usr/local/android-studio/jre/bin/java
• Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1343-b16-5323222)
• All Android licenses accepted.
[✓] Android Studio (version 3.4)
• Android Studio at /usr/local/android-studio
• Flutter plugin version 37.1.1
• Dart plugin version 183.6270
• Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1343-b16-5323222)
[✓] VS Code (version 1.36.1)
• VS Code at /usr/share/code
• Flutter extension version 3.2.0
[✓] Connected device (1 available)
• Android SDK built for x86 • emulator-5554 • android-x86 • Android 5.1.1 (API 22) (emulator)
• No issues found!
My operating system is Ubuntu 18.04 and i want to use emulator for debug , please help me.
You are having 3 options:
You can open your emulator in Android Studio and after that debug your application from VSCode.
You can also check whether adb(Android debugger bridge) is installed in your machine or not.
Or else you can run your application in a real device.
My problem was solved by this command
flutter config --android-sdk <sdk-location>
link

Flutter App IOS Release Build Error: Missing Required Icon File

I built the IOS release build and created the Product archive on Xcode. But when I try to validate the archive I get this error:
flutter doctor -v output:
[✓] Flutter (Channel beta, v0.8.2, on Mac OS X 10.13.6 17G65, locale en-US)
• Flutter version 0.8.2 at /Users/westworld/development/flutter
• Framework revision 5ab9e70727 (2 weeks ago), 2018-09-07 12:33:05 -0700
• Engine revision 58a1894a1c
• Dart version 2.1.0-dev.3.1.flutter-760a9690c2
[✓] Android toolchain - develop for Android devices (Android SDK 28.0.2)
• Android SDK at /Users/westworld/Library/Android/sdk
• Android NDK location not configured (optional; useful for native profiling support)
• Platform android-28, build-tools 28.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_152-release-1024-b01)
• All Android licenses accepted.
[✓] iOS toolchain - develop for iOS devices (Xcode 10.0)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Xcode 10.0, Build version 10A255
• ios-deploy 1.9.2
• CocoaPods version 1.5.3
[✓] Android Studio (version 3.1)
• Android Studio at /Applications/Android Studio.app/Contents
• Flutter plugin version 28.0.1
• Dart plugin version 173.4700
• Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1024-b01)
[✓] VS Code (version 1.27.2)
• VS Code at /Applications/Visual Studio Code.app/Contents
• Flutter extension version 2.18.0
[!] Connected devices
! No devices available
! Doctor found issues in 1 category.
Xcode Deployment Target is 10.0.
Also, the Assets.xcassets folder exists in the ios/Runner folder:
But I don't see it in the Xcode folder structure:
So, for the App Icons Source I cannot choose the AppIcon folder:
Not sure if I asked this clearly, but have anyone encountered the same problem?
I think your file system has gotten out of sync somehow. If you right click on Assets.xcassets in Android Studio and then click Reveal in Finder what does that show? Does it actually exist in your project folder? If it is then you might just need to drag it into Xcode, and delete the current AppIcon file.
Before you do any of that you might also try running flutter clean and File->Sync with File System in Android Studio.

Resources