Cocoapods seems to install a wrong pod version.
Here is an example line from my pubspec.yaml:
webview_flutter: ^1.0.7
When running pod install, this is what I see:
Installing webview_flutter (0.0.1)
In my flutter/.pub_cache/hosted/pub.dartlang.org/ I see the only the following versions:
webview_flutter-0.3.24
webview_flutter-1.0.7
When building with XCode, I get a few warnings from webview_flutter that point to the correct 1.0.7 version, so it seems the right pod is being used despite the cocoapods output. However, this is really confusing. Any thoughts how to solve this would be greatly appreciated.
I have tried re-installing cocoapods, deintegrating pods and building again, cleaning, updating pod repo, deleted Podfile.lock etc usual suspects.
Here's my environment:
[✓] Flutter (Channel stable, 1.22.5, on Mac OS X 10.15.7 19H15 darwin-x64, locale en-FI)
• Flutter version 1.22.5 at /Users/ilonamooney/Documents/dev/flutter
• Framework revision 7891006299 (10 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 30.0.2)
• Android SDK at /Users/ilonamooney/Library/Android/sdk
• Platform android-30, build-tools 30.0.2
• ANDROID_HOME = /Users/ilonamooney/Library/Android/sdk
• 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
[!] Android Studio (version 4.1)
• Android Studio at /Applications/Android Studio.app/Contents
✗ Flutter plugin not installed; this adds Flutter specific functionality.
✗ Dart plugin not installed; this adds Dart specific functionality.
• Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6915495)
[✓] Connected device (1 available)
• Ilona’s iPhone (mobile) • a12e6e165529c7307dfdb723f37e02f3901f17d0 • ios • iOS 14.2```
Related
I want to upgrade my project which is on Flutter 2.0 to the latest version of flutter (2.5).
I have already seen this question which is most relevant.
How do I upgrade an existing Flutter app?
In my Mac, I have Flutter upgraded to 2.5. You can see the output of flutter doctor -v below:
[✓] Flutter (Channel stable, 2.5.0, on macOS 11.5.2 20G95 darwin-arm, locale
en-PK)
• Flutter version 2.5.0 at /Users/ahmad/development/flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision 4cc385b4b8 (9 days ago), 2021-09-07 23:01:49 -0700
• Engine revision f0826da7ef
• Dart version 2.14.0
[✓] Android toolchain - develop for Android devices (Android SDK version 31.0.0)
• Android SDK at /Users/ahmad/Library/Android/sdk
• Platform android-31, build-tools 31.0.0
• Java binary at: /Applications/Android
Studio.app/Contents/jre/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 11.0.10+0-b96-7249189)
• All Android licenses accepted.
[✓] Xcode - develop for iOS and macOS
• Xcode at /Applications/Xcode.app/Contents/Developer
• Xcode 12.5.1, Build version 12E507
• CocoaPods version 1.11.0
[✓] 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-7249189)
[✓] Connected device (2 available)
• iPhone 12 Pro Max (mobile) • 57868E1C-4871-4185-A797-383121736AB8 • ios
• com.apple.CoreSimulator.SimRuntime.iOS-14-5 (simulator)
• Chrome (web) • chrome •
web-javascript • Google Chrome 93.0.4577.82
• No issues found!
I have searched over the internet about it. Mostly, I see two things, either how to upgrade to null-safety (which means from earlier versions to 2.0) or how to upgrade Flutter sdk in your system.
I have tried running flutter upgrade command which says I'm up-to-date.
I have also tried running flutter pub upgrade.
Both do not change the version of flutter in the pubspec.lock file inside my project which says at the end of file:
sdks:
dart: ">=2.14.0 <3.0.0"
flutter: ">=2.0.0"
Please guide me how can I upgrade my project to the latest version.
Thanks in advance :)
The Flutter project will have the same version as your system does. If you have the latest Flutter version on your system, then the app built from that system will have the latest version.
For example, if your system has Flutter 2.8 (latest while answering) and you build an app through it, your app is based on 2.8.
You're using flutter: >=2.0.0 which basically tells your app to use 2.0.0. Usually using the flutter sdk constraint is only used in plugins. It's okay to leave this out, if you remove flutter: >=2.0.0 it will automatically use your SDK version
When upgrade flutter has an exception and the application can't run again how can I solve it?
In file included from
/Users/raitotec/developer/flutter/.pub-cache/hosted/pub.dartlang.org/shared_preferences-0.5.12+4/ios/Classes/FLTSharedPreferencesPlugin.m:5:
/Users/raitotec/developer/flutter/.pub-cache/hosted/pub.dartlang.org/shared_preferences-0.5.12+4/ios/Classes/FLTSharedPreferencesPlugin.h:5:9
: fatal error: 'Flutter/Flutter.h' file not found
#import <Flutter/Flutter.h>
^~~~~~~~~~~~~~~~~~~
flutter doctor -v
[✓] Flutter (Channel stable, 1.22.5, on Mac OS X 10.15.7 19H524 darwin-x64, locale en-SA)
• Flutter version 1.22.5 at /Users/raitotec/developer/flutter
• Framework revision 7891006299 (9 months 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 30.0.2)
• Android SDK at /Users/raitotec/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 12.4)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Xcode 12.4, Build version 12D4e
• CocoaPods version 1.10.0
[✓] Android Studio (version 4.0)
• Android Studio at /Applications/Android Studio.app/Contents
• Flutter plugin version 50.0.1
• Dart plugin version 193.7547
• Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6222593)
[✓] Connected device (1 available)
• iPhone 12 mini (mobile) • A9648508-3B05-4468-B593-477288FC7370 • ios • com.apple.CoreSimulator.SimRuntime.iOS-14-4 (simulator)
try flutter clean then flutter pub upgrade
Had a similar issue.
After pub upgrade, (long story short) the app was not working as before.
The file pubspec.yaml contains the dependencies(packages) used by the app, usually the min version of the added packages.
The file pubspec.lock, contains all the dependencies(packages) of the app, with the exact version of each dependency.
When you run pub upgrade it fetches the newest versions of all the dependencies and updates the pubspec.lock,
so for example, a dependency in pubspec.yaml may states version 1.0, after the pub upgrade the used version can be 1.1(in the pubspec.lock)
Although this file should not included in the commits, if you have access to the previous version of it, you can compare it with the one after the pub upgrade` and revert it where needed.
Downgrading a dependency solved the problem for me.
I have problem with archiving my project in Xcode, it fails and throws an error: Module 'firebase_admob' not found
Build project: $flutter build ios
Select Product > Archive
Also I had to rollback Google-Mobile-Ads-SDK version from the newest 8.0.0 to 7.69.0 to make $flutter build ios work as described here
I've already cleaned and updated pods:
$flutter clean
$rm ios/podfile.lock
$rm ios/podfile
$pod update
$flutter pub get
I set target version to 12.0 in Podfile and Xcode settings.
For now I can build my project with $flutter build ios command but I can't archive it in Xcode for further distribution.
Flutter doctor
[✓] Flutter (Channel stable, 1.22.6, on Mac OS X 10.15.7 19H2 darwin-x64, locale ru-RU)
• Flutter version 1.22.6 at /Users/bob/Documents/Projects/Flutter/flutter
• Framework revision 9b2d32b605 (3 weeks ago), 2021-01-22 14:36:39 -0800
• Engine revision 2f0af37152
• Dart version 2.10.5
[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.1)
• Android SDK at /Users/bob/Library/Android/sdk
• Platform android-29, build-tools 29.0.1
• 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-1343-b01)
• 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.1
[✓] Android Studio (version 3.4)
• Android Studio at /Applications/Android Studio.app/Contents
• Flutter plugin installed
• Dart plugin version 201.9245
• Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1343-b01)
[✓] VS Code (version 1.53.0)
• VS Code at /Applications/Visual Studio Code.app/Contents
• Flutter extension version 3.19.0
[!] Connected device
! No devices available
! Doctor found issues in 1 category.
Dart SDK 2.10.5
Flutter SDK 1.22.6
app 1.0.0+1
dependencies:
- cupertino_icons 1.0.0
- firebase_admob 0.11.0+1 [meta flutter firebase_core]
- firebase_core 0.7.0 [firebase_core_platform_interface flutter quiver meta firebase_core_web]
One way to get around this is to build ipa file. You have to change Flutter's channel to the beta or master and upgrade to the latest version:
$flutter channel beta
$flutter upgrade
Then you should use the new feature of build tool:
$flutter build ipa
It generates archive in your project folder: <app_name>/build/ios/archive/<provisioning_profile_name>.xcarchive
So, you can open generated archive (i.e. My Test App.xcarchive) with Xcode and then validate it and upload to AppStore Connect as usual.
Steps to Reproduce
Simply trying to publish my app to ios store. Already available on Play store.
I cannot archive in Xcode, constantly running into issues. Currently have these issues when attempting to archive:
When attempting to run pod install in the ios directory, I continue to get this warning (which according to my research seems to be more of an error):
I tried following everything in this very long thread thread to resolve this issue, but nothing has worked.
I was able to remove another warning by uncommenting line #2 in the Podfile, platform :ios, '9.0'.
I have tried closing Xcode while making changes, and have tried restarting my computer.
I can flutter run and the app will work correctly on my iPhone when it is connected to my macbook.
Other threads from which I've tried everything:
https://github.com/flutter/flutter/issues/42974
https://github.com/flutter/flutter/issues/20685
https://github.com/flutter/flutter/issues/48103
https://github.com/X-Wei/flutter_catalog/issues/26
https://github.com/flutter/flutter/issues/28870
Expected results:
I can successfully archive in Xcode.
Actual results:
Flutter doctor seems to indicate everything is fine, but I continue to get this errors when trying to archive.
AdministorsMBP4:mem_plus_plus matt$ flutter doctor --verbose
[✓] Flutter (Channel stable, v1.12.13+hotfix.5, on Mac OS X 10.15.3 19D76, locale en-US)
• Flutter version 1.12.13+hotfix.5 at /Users/matt/development/flutter
• Framework revision 27321ebbad (9 weeks ago), 2019-12-10 18:15:01 -0800
• Engine revision 2994f7e1e6
• Dart version 2.7.0
[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.1)
• Android SDK at /Users/matt/Library/Android/sdk
• Android NDK location not configured (optional; useful for native profiling support)
• Platform android-29, build-tools 29.0.1
• 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-1343-b01)
• All Android licenses accepted.
[✓] Xcode - develop for iOS and macOS (Xcode 11.1)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Xcode 11.1, Build version 11A1027
• CocoaPods version 1.8.4
[✓] Android Studio (version 3.4)
• Android Studio at /Applications/Android Studio.app/Contents
• Flutter plugin version 37.1.1
• Dart plugin version 183.6270
• Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1343-b01)
[!] IntelliJ IDEA Community Edition (version 2019.2.4)
• IntelliJ at /Applications/IntelliJ IDEA CE.app
✗ Flutter plugin not installed; this adds Flutter specific functionality.
✗ Dart plugin not installed; this adds Dart specific functionality.
• For information about installing plugins, see
https://flutter.dev/intellij-setup/#installing-the-plugins
[✓] Connected device (1 available)
• Takkeezi’s iPhone • {redacted} • ios • iOS 12.4.4
Try to this.
flutter clean
pod install
build project
Check a pods module
Pod file
Facing this error on running flutter build ios. Sqflite is not reflected in the GeneratedPluginRestraints file after flutter build.
Tried flutter clean, pod update etc nothing works.
Flutter version - 1.7.8 and cocoapods version - 1.6.1
sqflite version in pubspec.yaml - ^1.6.1 in dependency overrides
flutter doctor -v output -
[✓] Flutter (Channel unknown, v1.7.8, on Mac OS X 10.14.5 18F132, locale en-GB)
• Flutter version 1.7.8 at /Users/oyo/Downloads/flutter
• Framework revision d51fd86cdb (6 months ago), 2019-06-21 22:31:55 -0400
• Engine revision d004bcd4d6
• Dart version 2.4.0
[!] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
• Android SDK at /Users/oyo/Library/Android/sdk
• Android NDK location not configured (optional; useful for native profiling
support)
• Platform android-29, build-tools 29.0.2
• ANDROID_HOME = /Users/oyo/Library/Android/sdk
• 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-1343-b01)
! Some Android licenses not accepted. To resolve this, run: flutter doctor
--android-licenses
[✓] Xcode - develop for iOS and macOS (Xcode 11.1)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Xcode 11.1, Build version 11A1027
• CocoaPods version 1.6.1
[✓] iOS tools - develop for iOS devices
• ios-deploy 1.9.4
[✓] Chrome - develop for the web
• Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
[✓] Android Studio (version 3.4)
• Android Studio at /Applications/Android Studio.app/Contents
• Flutter plugin version 37.1.1
• Dart plugin version 183.6270
• Java version OpenJDK Runtime Environment (build
1.8.0_152-release-1343-b01)
[✓] IntelliJ IDEA Ultimate Edition (version 2019.1.3)
• IntelliJ at /Applications/IntelliJ IDEA.app
• Flutter plugin version 37.0.3
• Dart plugin version 191.7830
[✓] IntelliJ IDEA Community Edition (version 2019.2)
• IntelliJ at /Applications/IntelliJ IDEA CE.app
• Flutter plugin version 37.1.4
• Dart plugin version 192.5728.98
[✓] Connected device (2 available)
• macOS • macOS • darwin-x64 • Mac OS X 10.14.5 18F132
• web • web • web-javascript • Google Chrome 79.0.3945.88
Just run command in your IDE's terminal,
flutter doctor --android-licenses
There are some android SDK licenses are not accepted. So writing above command will ask you with different licenses to accept with y/n options. Accept all of them to continue your work flow.