Android studio flutter project giving pod not installed error - ios

I have already installed cocoapods in my Mac.
Cocoapods
$ pod --version
1.9.3
$ which pod
/Users/user/.rbenv/shims/pod
$ which gem
/Users/user/.rbenv/shims/gem
$ which ruby
/Users/user/.rbenv/shims/ruby
Problem
But if I add device specific codes like I setup firebase or add geolocator plugin, then clicking on Android studio Run green button, I always get below error:
Launching lib/main.dart on iPhone 11 Pro in debug mode...
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:
sudo gem install cocoapods
CocoaPods not installed or not in valid state.
Error launching application on iPhone 11 Pro.
What didn't worked
I updated Mac OS Catalina (10.15.6)
I re-installed cocoapods couple of times, with different approaches (with homebrew, with system ruby, with rbenv ruby)
Updated to latest xcode
It didn't worked
What works
Finally, if I run below command in terminal it is working as expected:
flutter build ios --simulator
flutter run
So, I think its an issue with Android Studio. anyone else facing this issue, and have workaround for this problem?
Requirement
I want android studio to run project when I click on Android Studio Run icon.

This is not a android studio issue, it is a pod version issue for flutter.
Please downgrade your cocoapods and try again.
Here is my solution.
sudo gem uninstall cocoapods
sudo gem install cocoapods -v 1.7.5
pod setup
sudo gem install cocoapods
Update:
if you got still issue, please open it on xcode project and try run it.
once you fixed issue on xcode, it will work on android studio, too
Update 2:
please check your flutter sdk path. if there is any Capital letters, it can cause the issue.
Update 3: Try using Android Studio on termnial if all above methods do not work.
open /Applications/Android\ Studio.app

Try launching Android Studio from Terminal:
open /Applications/Android\ Studio.app
It would then use another PATH variable than if started with launchpad. And that PATH would contain valid path to CocoaPods.
Taken from https://github.com/flutter/flutter-intellij/issues/4981#issuecomment-751443625

Yes, It's an Android Studio issue and this worked for me
flutter clean in flutter project dir
In Android Studio: File > Invalidate Caches / Restart > Invalidate and Restart
Now the project should run on Android Studio when you click on the run button.

this is happened to me on vscode because cocoapods is looking for ruby version 2.6 and what I did to fix it with rbenv
rbenv global 2.6.8
gem install cocoapods
then restart vscode

I had tried a large number of options, but Android Studio continued to fail. So I tried using the Terminal options.
It is important to perform these while in the directory that holds your current project.
Once you are in the right place, type :-
flutter build ios --simulator
then type :-
flutter run
That compiled and ran my code correctly. Oddly it subsequently fixed Android Studio so that my code ran in the simulator without needing further input via the terminal.
Blockage cleared.!

Related

Android studio new version BumbleBee show error when run old project in IOS Device/Simulator in Flutter

It Will shows Error like this:-
After updating the Android studio it's throwing the error in IOS run
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.
Error launching application on iPhone 13 Pro Max.
It's run easily in android device and when we run through terminal its runs easily.
I have the same issue and I am hoping they will fix it soon. But, running flutter run from the terminal window inside Android Studio works fine and I can build and deploy for Android and iOS devices. Not a great solution, but works for now.
Upgrade with the new version of Bumblebee resolve the issue for me
Version: Android Studio Bumblebee | 2021.1.1 Patch 1

Warning: CocoaPods not installed. Skipping pod install. ERROR

i get this Error, when trying to run my app from android studio IDE.
Error mesasge
I can run it from my terminal, with flutter run, it works all fine. But my IDE fails. And i have cocoapods, and it works finde too.
I am running this on a old mac, with Catalina 10.15.7.
UPDATE
I did not found a solution, but using Visual Studio Code, did the job, now i can run my app on IOS again. I think its a Android Studio problem.
I face this same issue with new upgrade of Android Studio Bumblebee in new M1 Mac Chip...
So I solve this issue via this...
Check you gem list to find the all version of cocoapods
Uninstall your Cocoapod: sudo gem uninstall cocoapods
3.Then Install it again : sudo gem install cocoapods
close android Studio
open terminal
run chmod +x /Applications/Android\ Studio.app/Contents/bin/printenv
run Android Studio from dock

Android Studio fails to find Cocopods installation after upgrade to Bumblebee on Mac M1

I had an upgrade on Android Studio from Arctic Fox to Bumblebee v2021.1.1 on Mac M1 and surprisingly iOS version of Flutter app stopped working. It says
Cocoapods not installed.skipping pod install
However, I can locate cocoapods and its components installed
gem list --local | grep cocoapods
I can run the iOS project from Xcode without any issues, and looks like linking of cocoapods is messed up on Android upgrade. Looking for some help.
It's a issue of flutter integration with new update of android studio
Here you can find more about this https://github.com/flutter/flutter/issues/97251
for now there are two solutions:
Open android studio using command line, run below command in terminal -
open /Applications/Android\ Studio.app
Add missing flag to android studio, run below command in terminal -
chmod +x /Applications/Android\ Studio.app/Contents/bin/printenv

CocoaPods not installed. Skipping pod install

My app was working fine until I did 2 small changes.
On Target runner in Xcode I enabled bitcode for the project.
I update the Android studio to the latest version.
Android Studio Bumblebee | 2021.1.1
Build #AI-211.7628.21.2111.8092744, built on January 19, 2022
Runtime version: 11.0.11+0-b60-7590822 x86_64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.
macOS 12.0.1
GC: G1 Young Generation, G1 Old Generation
Memory: 1280M
Cores: 4
Registry: external.system.auto.import.disabled=true
Non-Bundled Plugins: Dart (211.7798), org.jetbrains.kotlin (211-1.6.10-release-923-AS7442.40), io.flutter (63.2.2)
After that When I run my flutter app on iOS simulator I'm getting this error.
Although I have disabled bitcode and tried again.I got same error. I installed and reinstalled cocapoads still same error. I don't know what causing this error. Can you help? please
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.
Error launching application on iPhone 13.
UPD: Fixed in 2021.1.1 patch 1, see release notes here
This might happen because AndroidStudio doesn't know anything about $PATH provided in ~/.*rc files (.bashrc,.zshrc, etc.)
You can ensure by launching it from terminal:
open /Applications/Android\ Studio.app
EDIT: It's a confirmed bug in Bumblebee release
The workaround is to add missing flag:
chmod +x /Applications/Android\ Studio.app/Contents/bin/printenv
You have to do it only once
Open terminal run -> chmod +x /Applications/Android\ Studio.app/Contents/bin/printenv
Try again...And it should work.
I got an exception on the pod availability check.
which pod
It seems that $PATH env for the updated studio is not picked properly. (you can check it by enabling verbose logging mode on the flutter plugin).
Workaround is to start Android studio from the terminal:
open /Applications/Android\ Studio.app
Updated:
Android Studio Bumblebee (2021.1.1) Patch 1 fixes this issue.
I came across this problem too using Android studio on Apple Silicon MacBook launching from command line or directly both failed
I updated the ruby version to 2.7.3 using rbenv, and then it worked from the command line.
open /Applications/Android\ Studio.app
Note: default macOS system ruby is version is 2.6.8, and there are some incompatible gems with this version
If the top voted solution doesn't fix this for you with the Bumblebee release, then you can try the beta Chipmunk release of Android Studio.
I am running the M1 Mac and this version 2021.2.1 Beta 1 is able to run the flutter apps from the toolbar correctly.
I've searched all of solutions, and current post's answers do the trick. But basically it seems like flutter android studio(only lately-updated bumblebee version) plug-in triggers the pod error, since both xcode and android studio terminal run work just fine.
We might have to keep tracking this issue. Before flutter team gives a clear answer, i'm planning to use flutter run --debug, since terminal run provides "r" for hot reload and "R" for hot restart. Or we can also use open /Applications/Android\ Studio.app everytime.
I fixed it by running:
sudo gem install ffi
In my case i check $PATH variable and in this do not exist path to pod executable
Using MacBook Pro M1 with pod installed by brew

Class AMSupportURLConnectionDelegate is implemented in both

I'm trying to build a flutter app on M1 mac and getting the following error.
$ flutter build ios --release
Building XXX for device (ios-release)...
Automatically signing iOS for device deployment using specified development team in Xcode project: XXX
Running pod install... 13.2s
Running Xcode build...
Xcode build done. 6.7s
Failed to build iOS app
Error output from Xcode build:
↳
objc[65074]: Class AMSupportURLConnectionDelegate is implemented in both ?? (0x1f66de518) and ?? (0x1160d82b8). One
of the two will be used. Which one is undefined.
objc[65074]: Class AMSupportURLSession is implemented in both ?? (0x1f66de568) and ?? (0x1160d8308). One of the two
will be used. Which one is undefined.
** BUILD FAILED **
Xcode's output:
↳
note: Using new build system
note: Building targets in parallel
note: Planning build
note: Constructing build description
error: The linked framework 'Pods_Runner.framework' is missing one or more architectures required by this target:
armv7. (in target 'Runner' from project 'Runner')
Encountered error while building for device.
Here is my flutter doctor -v
flutter doctor -v
[✓] Flutter (Channel stable, 1.22.4, on macOS 11.0 20A2411 darwin-arm, locale en-AU)
• Flutter version 1.22.4 at /Users/mlee/development/flutter
• Framework revision 1aafb3a8b9 (3 weeks ago), 2020-11-13 09:59:28 -0800
• Engine revision 2c956a31c0
• Dart version 2.10.4
[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.2)
• Android SDK at /Users/mlee/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-6915495)
• 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 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)
[✓] VS Code (version 1.51.1)
• VS Code at /Applications/Visual Studio Code.app/Contents
• Flutter extension version 3.16.0
[✓] Connected device (2 available)
! Doctor found issues in 1 category.
try a simple, documented step first
In Terminal:
sudo xcode-select -r
explanation
The command resets xcode to the default path (see documentation excerpt below). This command
resolved the issue for me and
avoided the risk of introducing random, undocumented ideas from strangers.
These advantages make it worth trying first, especially since documented approaches typically won't interfere with future version upgrades. Experimental workarounds may need to be undone first.
documentation
% xcode-select -h
Usage: xcode-select [options]
Print or change the path to the active developer directory. This directory
controls which tools are used for the Xcode command line tools (for example,
xcodebuild) as well as the BSD development commands (such as cc and make).
Options:
-h, --help print this help message and exit
[...]
-r, --reset reset to the default command line tools path
I had the same issue. I saw the same error when I ran flutter build ios.
The error message was displayed red color on my VS code terminal, but it was kind of misleading. I found it was not the main issue.
The actual issue should be on the following error section.
So, please run flutter build ios --verbose and read the output carefully.
In my situation, there were other issues of the failure of flutter build ios. The issues were like forget to put in GoogleService-Info.plist or iOS target version is less than the requirement of flutter packages.
installing ffi helped me. I was stucked from last two days and then I finally found this solution.
arch -x86_64 sudo gem install ffi
use this if you are using m1
sudo gem install ffi
if you are intel Macs
Thanks Hope this will work.
Got the same error, also on an M1 macbook. Fixed it by:
flutter clean inside the project directory.
flutter build ios
'Start debugging' (vs code).
Somehow I managed to fix the issue by removing the flutter/bin/cache folder.
This could be a combination of other random things I did to solve this issue.
Things I've tried.
Running the terminal using Rosetta.
Upgrade dependency versions as well as running flutter pub upgrade
Remove ios/Pods & Podfile.lock
Reorganise xcconfig files - make sure to include Generated.xcconfig
I've created base.xcconfig and configure it with the existing Pods-Runner.release.xcconfig
This is my base.xcconfig
#include "Generated.xcconfig"
#include "Env-defaults.xcconfig"
#include "Env.xcconfig"
I was running into the same error using the M1 chip on my mac. I created a new project and realized that the new projects build settings exclude
Any IOS Simulator SDK: arm64 i386
under 'Excluded Architectures'
I replaced all /app/ios files with new from fresh application created by flutter create
FINALLY got it working -- here's what I had to do starting from the project root:
cd ios
rm -rf ~/Library/Caches/CocoaPods
rm -rf Podfile.lock
rm -rf Pods
rm -rf ~/Library/Developer/Xcode/DerivedData/*
Then:
pod deintegrate
pod setup
pod install
For anyone running into this issue on M1 run the iTerm/Terminal from Rosetta. Follow the below commands.
Installation of Rosetta,
softwareupdate --install-rosetta
Running from Rosetta,
Goto applications folder.
Right click on iTerm >> Get Info.
Check open using Rosetta.
Thats it open the terminal, the issue will be fixed.
Got the same issue on Macbook M1.
Changed the iOS Deployment Target of the project Runner to 10.0.
Fixed the issue.
Normally it is working after these steps
flutter clean
flutter pub get
cd ios
pod install
cd ..
flutter build ios
This time it worked for me with an additional command flutter upgrade pub as I was using the newer version of flutter with old pub file. I hope it may help someone using M1 processor.
My Solution for this problem was:
Delete /flutter/iOS/Podfile & /flutter/iOS/Pods & flutter/iOS/Podfile.lock
flutter clean
Enjoy :)
I solved this problem!
rebuild new flutter project
open terminal
move to ios directory (project)
pod init
pod install
modify ios/Podfile file as this content
link : https://github.com/t-sakurai816/flutter_todo_new/blob/main/ios/Podfile
I tried pretty much everything yet nothing worked for me.
Except this -
Open your podfile and do the following
change
use_frameworks!
to
use_frameworks! :linkage => :static
I kept running into a similar problem from React Native too on M1 and I am leaving this here if anyone might need it.
What worked for me is having to run the project from inbuilt terminal with Rosetta enabled. All the project related config, npm install and pod installs had to happen on inbuilt terminal for the error to go away
npm install
cd ios && pod install && cd ..
npm run ios
If you have installed cocoapods using gem as well as home-brew also then please remove gem installed cocoapods.
On my Mac mini m1 cocoapods installed using "gem" was not working so installed from home-brew. Because of that system was having both versions. I got this same problem for every flutter command run because of this.
After removing "sudo gem uninstall cocoapods" this error disappeared.
Open ios/Runner.xcworkspace in xCode and try to run it on your iPhone and the error should tell you your issue.
In my case, I had to login with my apple ID in Xcode and download certificates.
This was quite a journey for me to fix. I tried many things and I'm not exactly sure which one fixed it but here's what I did
First off try building the app for Android instead of iOS. This will tell you if the error is specific to iOS or if it's something else. After building for android I had the error "member not found package root". To fix this I did
flutter pub upgrade
I use Apple silicon, I ran this command
sudo gem install ffi
Along my journey of fixing this I realized I use the system ruby when I should be using homebrew installed ruby
brew install ruby
echo 'export PATH="/usr/local/opt/ruby/bin:$PATH"' >> ~/.zshrc
uninstall all cocoapods from gem
gem list --local | grep cocoapods | awk '{print $1}' | xargs sudo gem uninstall
install cococapods from brew
brew install cocoapods
then try and rebuild your project
Delete the line
#include "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"
in ios/flutter/Debug.xcconfig
Works for me
I've fixed the issue by doing this:
cd ios
pod init
pod install
hope it will work for you also
It seems this error may occur due to various reasons and this 'Error output from Xcode build:' does not reflect the actual error.
I was able to fix this issue by opening ios/Runner.xcworkspace using Xcode and selecting the correct team in 'Signing & Capabilities'. Then I was able to run flutter run without getting this error
If you see an additional error that states: error: no such module 'Flutterz', go into your AppDelegate.swift file and change import Flutterz to import Flutter.
After fixing above, I no longer received the AMSupportURLConnectionDelegate is implemented in both error message.
I ran into the problem 2 times and it had 2 times separate root causes.
First cause was that one of the libraries I used got outdated - after upgrading from 1.x to 2.x. It was NOT visible on the pub.dev page that this plugin got outdated, only on the respective Github page. It was some Google library. Once the plugin got commented out, it worked.
The second case was way harder to find. It happened after upgrading to 2.2.0 and some of my images were suddenly not working anymore. I needed to comment them out, then the error went away. No clue why these PNGs suddenly not work anymore, but it is reproduce-able. Every time you find an image that doesn't work, run flutter clean afterwards followed by pub get and only THEN start again a build on the simulator.
Hope this helps someone, it cost me more than 5 days...
For the people using M1 chips:
In Xcode, target Runner, Go to Build Settings
Check Architecture and select standard if arm architecture is selected.
I had the same problem.
I fixed the problem:
Rename the ios folder to ios.old
I have created a new flutter project and copied the ios folder to my project
I have copied the info.plist file from the ios.old folder to the new ios folder
I think it would only be necessary to copy the images of the icons.
In my case, the problem was caused by an invalid release version number, it should contain only digits, no strings
Try Selecting For install builds only in the run script in the Build phases tab.
I changed
Another fix could be
flutter clean
rm -rf ios/Flutter/Flutter.framework
cd ios
pod install
Thanks to https://github.com/CocoaPods/CocoaPods/issues/7234#issuecomment-606591037
In my case the solotion was to comment this line of podfile:
# platform :ios, '14.3'
It has happened to me a few times. Almost always it was related to a mistyped name of an asset or pointing to a wrong asset package.

Resources