Flutter: Cant build app anymore since upgrade flutter and channel - flutter

Please help me!
The app was close to be finished and since I did run flutter upgrade to solve a bug I had to run:
flutter clean
flutter channel master
flutter upgrade
flutter run
and now its not starting anymore and the following code shows up..
Launching lib/main.dart on iPhone 12 Pro Max in debug mode...
Running Xcode build...
Xcode build done. 7,6s
Failed to build iOS app
Error output from Xcode build:
↳
** BUILD FAILED **
Xcode's output:
↳
/Users/patrickmeyer/AndroidStudioProjects/my_fitness_challenge/ios/Pods/GoogleDataTransport/GoogleDataTransport/GDTCORLibrary/GDTCORPlatform.m:140:55: error: 'currentRadioAccessTechnology' is deprecated: first deprecated in iOS 12.0 [-Werror,-Wdeprecated-declarations]
networkCurrentRadioAccessTechnology = networkInfo.currentRadioAccessTechnology;
^~~~~~~~~~~~~~~~~~~~~~~~~~~~
serviceCurrentRadioAccessTechnology
In module 'CoreTelephony' imported from /Users/patrickmeyer/AndroidStudioProjects/my_fitness_challenge/ios/Pods/GoogleDataTransport/GoogleDataTransport/GDTCORLibrary/Public/GoogleDataTransport/GDTCORPlatform.h:32:
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator14.3.sdk/System/Library/Frameworks/CoreTelephony.framework/Headers/CTTelephonyNetworkInfo.h:154:61: note: 'currentRadioAccessTechnology' has been explicitly marked deprecated here
#property (nonatomic, readonly, retain, nullable) NSString* currentRadioAccessTechnology API_DEPRECATED_WITH_REPLACEMENT("serviceCurrentRadioAccessTechnology", ios(7.0, 12.0)) API_UNAVAILABLE(macos);
^
1 error generated.
PromisesObjC-crewhghtjvlepwbqltmbxkeqlsao
note: Using new build system
note: Building targets in parallel
note: Planning build
note: Constructing build description
Could not build the application for the simulator.
Error launching application on iPhone 12 Pro Max.
My flutter doctor looks good...
[✓] Flutter (Channel master, 1.26.0-2.0.pre.117, on Mac OS X 10.15.7 19H114
darwin-x64, locale de-DE)
• Flutter version 1.26.0-2.0.pre.117 at
/Users/patrickmeyer/Developer/flutter
• Framework revision 15c009b805 (17 hours ago), 2020-12-22 20:09:03 -0500
• Engine revision b7cd3f8e70
• Dart version 2.12.0 (build 2.12.0-173.0.dev)
[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.3)
• Android SDK at /Users/patrickmeyer/Library/Android/sdk
• Platform android-29, build-tools 29.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 12.3)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Xcode 12.3, Build version 12C33
• CocoaPods version 1.10.0
[✓] 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)
[✓] Connected device (2 available)
• iPhone 12 Pro Max (mobile) • 11ACA273-A0C3-405D-993A-A9AF9057887C • ios
• com.apple.CoreSimulator.SimRuntime.iOS-14-3 (simulator)
• Chrome (web) • chrome •
web-javascript • Google Chrome 87.0.4280.88
• No issues found!

This could be because of compatible issues between flutter and Xcode version. Switch to the previous version and see if the error is there. Try other versions of flutter manually, using flutter version .
You can also run the program from Xcode, and try opening the emulator from there.

You can indeed use
flutter create .
to "repair" the current project to a limited degree.
If the ios/ or android/ folders are missing, they are created.
You can use this to switch native language Java/Kotlin, ObjC/Swift or to get the generated files updated to match newer Flutter versions by deleting the directories and running
flutter create . [options]
You need to re-apply previously made manual changes yourself though.

Related

flutter iOS Simulator - Connecting to the VM Service is taking longer than expected

I'm getting this error when I try to run my application on the iOS simulator:
Launching lib/main.dart on iPhone 14 Pro Max in debug mode...
Running Xcode build...
└─Compiling, linking and signing... 9,2s
Xcode build done. 27,9s
Connecting to the VM Service is taking longer than expected...
Still attempting to connect to the VM Service...
If you do NOT see the Flutter application running, it might have crashed. The device logs (e.g. from adb or XCode) might have more details.
If you do see the Flutter application running on the device, try re-running with --host-vmservice-port to use a specific port known to be available.
At the end of the Xcode build done. 27,9s print in the terminal, the App opens in the iOS simulator for a few milliseconds, but is instantly closed, and a crash screen from Xcode is opened.
Here is my flutter doctor -v:
[✓] Flutter (Channel master, 3.8.0-9.0.pre.18, on macOS 13.2 22D49 darwin-arm64, locale pt-BR)
• Flutter version 3.8.0-9.0.pre.18 on channel master at /Users/rafael/Documents/flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision f945ad99c3 (55 minutes ago), 2023-02-10 00:05:44 +0100
• Engine revision 40e17fb524
• Dart version 3.0.0 (build 3.0.0-218.0.dev)
• DevTools version 2.21.1
[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.0-rc2)
• Android SDK at /Users/rafael/Library/Android/sdk
• Platform android-33, build-tools 33.0.0-rc2
• 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 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 (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)
[✓] VS Code (version 1.75.1)
• VS Code at /Applications/Visual Studio Code.app/Contents
• Flutter extension version 3.58.0
[✓] Connected device (3 available)
• iPhone 14 Pro Max (mobile) • 49BFE69F-8CDD-4726-A6A4-60AC1E87E6E9 • ios • com.apple.CoreSimulator.SimRuntime.iOS-16-2 (simulator)
• macOS (desktop) • macos • darwin-arm64 • macOS 13.2 22D49 darwin-arm64
• Chrome (web) • chrome • web-javascript • Google Chrome 109.0.5414.119
[✓] HTTP Host Availability
• All required HTTP hosts are available
• No issues found!
I solved the problem by removing a package that I had in the application that has the pub google_mobile_ads in its .yaml, and as I am not implementing Ads in this App I did not configure the necessary items in AndroidManifest.xml and Info.plist.

(M1 Mac) Android Studio Doesn't Detect Android Emulator

I just downloaded android emulator through android studio. Didn't use the GitHub repo to download dmg file. Then I started the S level API android emulator from and manager. Android emulator boots but android studio doesn't detect and doesn't run app on it.
What could be the problem?
Reproduced:
Remove *.lock files in avd folder (Didn't work)
flutter doctor -v
[✓] Flutter (Channel stable, 2.2.1, on macOS 11.4 20F71 darwin-arm, locale tr-TR)
• Flutter version 2.2.1 at /Users/alperenbaskaya/Desktop/flutter
• Framework revision 02c026b03c (2 weeks ago), 2021-05-27 12:24:44 -0700
• Engine revision 0fdb562ac8
• Dart version 2.13.1
[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
• Android SDK at /Users/alperenbaskaya/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.5, Build version 12E262
• CocoaPods version 1.10.1
[✓] 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)
[!] Connected device
! No devices available
! Doctor found issues in 1 category.
1)Try enabling USB Debugging in the Android emulator itself, as you would do on a real device. Settings-> Developer options-> enable USB Debugging.
2)Probably the project you are running is not compatible (API version/Hardware requirements) with the emulator settings. Check-in your build.gradle file if the target SDK and minimum SDK version are lower or equal to the SDK version of your Emulator.
You should also uncheck Tools > Android > Enable ADB Integration
If your case is different then restart your Android Studio and run the emulator again.
For more info:
Android studio: emulator is running but not showing up in Run App "choose a running device"
Android Studio does not detect the emulator
I went to the AVD Manager and in the options for the particular emulator I selected "Cold Boot Now" and it resolved my issue.

Flutter/ fatal error: 'Flutter/Flutter.h' file not found

Hello i am having this error when I run my app.
Failed to build iOS app
Error output from Xcode build:
↳
** BUILD FAILED **
Xcode's output:
↳
In file included from /Users/daegilpyo/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/url_launcher-5.7.10/ios/Classes/FLTURLLauncherPlugin.m:7:
/Users/daegilpyo/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/url_launcher-5.7.10/ios/Classes/FLTURLLauncherPlugin.h:5:9: fatal error: 'Flutter/Flutter.h' file not found
#import <Flutter/Flutter.h>
^~~~~~~~~~~~~~~~~~~
1 error generated.
5
Command CompileSwift failed with a nonzero exit code
note: Using new build system
note: Building targets in parallel
note: Planning build
note: Constructing build description
Could not build the precompiled application for the device.
Error launching application on DAEGIL의 iPhone.
Exited (sigterm)
This is happening after I change the channel from stable to master..
I don`t know why I am having this error.
Plz let me know, I am waiting for you help..
this is flutter doctor - v
[✓] Flutter (Channel stable, 1.22.5, on macOS 11.0.1 20B50 darwin-x64, locale en-CA)
• Flutter version 1.22.5 at /Users/daegilpyo/Developer/flutter
• Framework revision 7891006299 (5 days ago), 2020-12-10 11:54:40 -0800
• Engine revision ae90085a84
• Dart version 2.10.4
[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.3)
• Android SDK at /Users/daegilpyo/Library/Android/sdk
• Platform android-29, build-tools 29.0.3
• Java binary at: /Applications/12.app/Contents/jre/jdk/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 1.8.0_212-release-1586-b4-5784211)
• All Android licenses accepted.
[✓] Xcode - develop for iOS and macOS (Xcode 12.2)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Xcode 12.2, Build version 12B45b
• CocoaPods version 1.10.0
[✓] Android Studio (version 3.6)
• Android Studio at /Applications/12.app/Contents
• Flutter plugin version 47.1.1
• Dart plugin version 192.8052
• Java version OpenJDK Runtime Environment (build 1.8.0_212-release-1586-b4-5784211)
[✓] Connected device (1 available)
• DAEGIL의 iPhone (mobile) • 00008020-0011243A2279002E • ios • iOS 14.2
• No issues found!
I had this problem a week ago, I removed the ios/Flutter folder from my directory and ran these commands and changed by deployment target to 11.0
-> flutter create
-> flutter pub cache repair
-> cd ios
-> pod init
-> pod install
After following these commands, I could build the iOS on the simulator and also create the archive.
The project absolute path don't have Space ' '.
My project path is '/Volumes/Macintosh Data/work/test/ios' then error, move to '/Users/macbook/Documents/workspace/test/ios' is OK.
if modify pubspec.yaml file dependencies, then redo:
rm -rf ./ios
flutter create -i swift .

Exception: [!] Your app is using an unsupported Gradle project

I am trying to run my existing flutter application and I am getting this exception. How can I solve this issue?
Exception: [!] Your app is using an unsupported Gradle project. To fix this problem, create a new project by running flutter create -t app <app-directory> and then move the dart code, assets and pubspec.yaml to the new project.
Here are my Flutter doctor results:
[✓] Flutter (Channel stable, v1.17.1, on Mac OS X 10.15.4 19E287, locale en-EE)
• Flutter version 1.17.1 at /Users/varsik/Documents/flutterConfigurationFiles/flutter
• Framework revision f7a6a7906b (2 weeks ago), 2020-05-12 18:39:00 -0700
• Engine revision 6bc433c6b6
• Dart version 2.8.2
[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.3)
• Android SDK at /Users/varsik/Library/Android/sdk
• Platform android-29, build-tools 29.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_212-release-1586-b4-5784211)
• All Android licenses accepted.
[✓] 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
[✓] Android Studio (version 3.6)
• Android Studio at /Applications/Android Studio.app/Contents
• Flutter plugin version 45.1.1
• Dart plugin version 192.8052
• Java version OpenJDK Runtime Environment (build 1.8.0_212-release-1586-b4-5784211)
[✓] Connected device (1 available)
• Pixel 3 XL • 8B8Y0VETV • android-arm64 • Android 10 (API 29)
• No issues found!
Maybe you removed a line from the
project/android/app/build.grade
Try adding this Piece of Code
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
after the line
apply plugin: 'com.android.application'
I resolve this issue by syncing project with gradle files.In android studio from menu open File option and click option sync project with gradle files.
Could you check this solution The project is using an unsupported version of Gradle
If you have the backup of your project than go to
project/android/app/build.grade
copy all the code and paste it to your project app/build.grade file.
Clean Project
Now Enjoy. Your error will not appear.
Thankyou.
For everyone landing here after making changes to the gradle for firebase or smth, it might seem stupid but check that the autoformat(if you have it enabled) didn't make funny things like putting spaces between "->" or "+=" turning them into "- >" or "+ ="

CocoaPods could not find compatible versions for "edge_detection" building flutter iOS app

After trying to build a flutter app for iOS I got the following error:
$ flutter build ios --no-codesign
Warning: Building for device with codesigning disabled. You will have to manually codesign before deploying to device.
Building com.example.mmpgui for device (ios-release)...
Running pod install... 0,8s
CocoaPods' output:
↳
Preparing
Analyzing dependencies
Inspecting targets to integrate
Using `ARCHS` setting to build architectures of target `Pods-Runner`: (``)
...
[!] CocoaPods could not find compatible versions for pod "edge_detection":
In Podfile:
edge_detection (from `.symlinks/plugins/edge_detection/ios`)
Specs satisfying the `edge_detection (from `.symlinks/plugins/edge_detection/ios`)` dependency were found, but they required a higher
minimum deployment target.
...
Error output from CocoaPods:
[!] Automatically assigning platform `iOS` with version `8.0` on target `Runner` because no platform was specified. Please specify a
platform for this target in your Podfile. See `https://guides.cocoapods.org/syntax/podfile.html#platform`.
First, I tried to follow the advice in the link and update the Pod file (ios/Pods/Pod)
by setting the platform version to 10.0
# Uncomment this line to define a global platform for your project
platform :ios, '10.0'
Now it compiled but I got lots of compilation errors:
$ flutter build ios --no-codesign
Warning: Building for device with codesigning disabled. You will have to manually codesign before deploying to device.
Building com.example.mmpgui for device (ios-release)...
Running pod install... 38.3s
Running Xcode build...
Xcode build done. 665.5s
Failed to build iOS app
Error output from Xcode build:
** BUILD FAILED **
...
error: the following command failed with exit code 0 but produced no further output
CompileC
/Users/administrator/Library/Developer/Xcode/DerivedData/Runner-gjlpspwywczpboarjfvvefatdons/Build/Intermediates.noindex/Pods.build/Release-iph
oneos/camera.build/Objects-normal/arm64/CameraPlugin.o
/Users/administrator/development/flutter/.pub-cache/hosted/pub.dartlang.org/camera-0.5.7+3/ios/Classes/CameraPlugin.m normal arm64 objective-c
com.apple.compilers.llvm.clang.1_0.compiler
/Users/administrator/development/flutter/.pub-cache/hosted/pub.dartlang.org/edge_detection-1.0.4/ios/Classes/HomeViewController.swift:29:49:
error: value of optional type 'UIImage?' must be unwrapped to a value of type 'UIImage'
var imagePath = saveImage(image:results.scannedImage)
^
/Users/administrator/development/flutter/.pub-cache/hosted/pub.dartlang.org/edge_detection-1.0.4/ios/Classes/HomeViewController.swift:29:49:
note: coalesce using '??' to provide a default when the optional value contains 'nil'
var imagePath = saveImage(image:results.scannedImage)
^
?? <#default value#>
/Users/administrator/development/flutter/.pub-cache/hosted/pub.dartlang.org/edge_detection-1.0.4/ios/Classes/HomeViewController.swift:29:49:
note: force-unwrap using '!' to abort execution if the optional value contains 'nil'
var imagePath = saveImage(image:results.scannedImage)
Flutter doctor showed the following:
$ flutter doctor -v
[✓] Flutter (Channel master, v1.15.3-pre.37, on Mac OS X 10.14.6 18G3020, locale de-AT)
• Flutter version 1.15.3-pre.37 at /Users/sebastiankubeck/Software/flutter
• Framework revision 6dc3bfaa98 (2 days ago), 2020-02-07 18:28:02 -0800
• Engine revision 6158f03ef5
• Dart version 2.8.0 (build 2.8.0-dev.8.0 514a8d4c84)
[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
• Android SDK at /Users/sebastiankubeck/Library/Android/sdk
• Android NDK location not configured (optional; useful for native profiling support)
• Platform android-29, build-tools 29.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_202-release-1483-b49-5587405)
• All Android licenses accepted.
[✓] Xcode - develop for iOS and macOS (Xcode 11.3.1)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Xcode 11.3.1, Build version 11C504
• CocoaPods version 1.8.4
[✓] Chrome - develop for the web
• Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
[✓] Android Studio (version 3.5)
• Android Studio at /Applications/Android Studio.app/Contents
• Flutter plugin version 40.2.2
• Dart plugin version 191.8593
• Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b49-5587405)
[✓] VS Code (version 1.41.1)
• VS Code at /Applications/Visual Studio Code.app/Contents
• Flutter extension version 3.8.0
[✓] Connected device (3 available)
• macOS • macOS • darwin-x64 • Mac OS X 10.14.6 18G3020
• Chrome • chrome • web-javascript • Google Chrome 80.0.3987.87
• Web Server • web-server • web-javascript • Flutter Tools
• No issues found!
The project was created with an older version of flutter and it seems that the ios directory is not updated correctly. Alternatively, it could be that my CocoaPods version is too new, so I tried 1.7.5, which wasn't successful either.