flutter Project is not working in simulator mac os - flutter

I installed the flutter and using android studio to run the flutter project on simulator. I clone the project from git and run it shows this error
Error: To set up CocoaPods for ARM macOS, run:
arch -x86_64 sudo gem install ffi
Error running pod install
Error launching application on iPhone 14 Pro Max.
but when I make the new basic project it runs fine but not the cloned project. I tried some stuff.
open ~/.profile and add these
exports export LANG=en_US.UTF-8
export LANGUAGE=en_US.UTF-8
export LC_ALL=en_US.UTF-8
Also uninstall cocoapods and reinstall again. but nothing works for me.
what i am missing here?

Spending few hours on this problem finally it works for me.
Step 1: Uninstall the cocoapods by running this command in your project folder terminal
sudo gem uninstall cocoapods
Step 2: Install the cocoapods by running this command
brew install cocoapods
Note: Not forget to restart the android studio otherwise it would show another error. just close your project, close android studio, rerun the project or simulator.
Hope it will help someone.

Related

cocoapods intallation Errors in mac for flutter doctor

I install Homebrew.
Then I run command
"brew install cocoapods". It install successfully
but in flutter doctor i got error: cocoapods installed but not working properly. Error because of ruby incompatible version.
Tried another method
"sudo gem install cocoapods"
and got error:
While executing gem ... (Gem::FilePermissionError)
You don't have write permissions for the /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/gems/2.6.0 directory.
This is m1 pro 2020 machine.
For MAC M1 chip Users try this solution
install ffi first (if not) In regular terminal using command: sudo arch -x86_64 gem install ffi then arch -x86_64 pod install --repo-update
Run flutter clean
Once complete, rebuild your Flutter application: flutter run
Try to avoid linking with system ruby and download a new ruby version using brew:
brew install ruby
Then add this line to .bash_profile or .zshrc
export PATH=/usr/local/opt/ruby/bin:$PATH
Close the terminal and open it again, then run this line to make sure the default ruby is the newly installed:
which ruby
Uninstall gem cocoapods and download it using brew
brew install cocoapods

Installing Flutter using Homebrew

I would like to install Flutter on my Apple M1 machine using Homebrew. But I am a bit hesitant because I am not sure if this will provide any benefits or it will create more trouble (e.g. permission issues). An alternative way would to be install Flutter using its installer from its docs.
My question is, is there a recommended way to install Flutter on an Apple M1 macbook? I could not find any docs regarding installing Flutter using Homebrew.
I ended up installing Flutter in with the following steps:
Install Homebrew (if you dont already have)* - install Homebrew
Install fvm using Homebrew - install fvm
Install your wanted flutter version through fvm - fvm documentation
Not necessary: Install Sidekick which basically gives you a visualization of your installed versions and flutter projects - install sidekick
Example of using fvm: fvm install {version} - # Installs specific version
#ilpianoforte Does a great job outlining the steps, but I needed to do an additional step for macOS 13.x. So, I thought I would consolidate here.
To install Flutter via Homebrew.
Install Homebrew
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
Install fvm with Homebrew (this manages multiple versions of Flutter)
brew tap leoafarias/fvm
brew install fvm
Install the latest stable version of Flutter
fvm install stable
Append the path to Flutter to PATH by copying the line below into .zshrc (located in the home directory). IMPORTANT: Make sure to replace [USER_HERE] with your user name.
export PATH=$PATH:"/Users/[USER_HERE]/fvm/default/bin"
Reload .zshrc
source ~/.zshrc
Optional: Test Flutter installation.
flutter doctor

Dart multiple installs on the system?

I'm having a bit of confusion about Dart and Pub installs on my system. I Use Android Studio and Flutter which comes with Dart, and if run Dart --version command in terminal I get Dart SDK version: 2.10.4 (stable) (Wed Nov 11 13:35:58 2020 +0100) on "macos_x64" which is the latest Flutter stable channel I installed.
Then to install Aqueduct with pub global activate aqueduct I was having the error pub command not found so I installed it and I had to also install PostgreSQL and Dart via home-brew .
Now to try and solve a bug that seems to be related to the latest version of dart Aqueduct db generate error: Bad state: NoSuchMethodError: The getter 'length' was called on null
I run brew install dart#2.8 but then if I run Dart --version again I still get Dart SDK version: 2.10.4 (stable) (Wed Nov 11 13:35:58 2020 +0100) on "macos_x64"
Here is the print from console:
Updating Homebrew...
==> Auto-updated Homebrew!
Updated 1 tap (homebrew/core).
==> Updated Formulae
Updated 7 formulae.
==> Installing dart#2.8 from dart-lang/dart
==> Downloading https://storage.googleapis.com/dart-archive/channels/stable/rele
Already downloaded: /Users/vinnytwice/Library/Caches/Homebrew/downloads/f3ce4b575125184d766bb56931b479589b16972fb0bcfd1e00c841a316c85e25--dartsdk-macos-x64-release.zip
Warning: Your Xcode (11.5) is outdated.
Please update to Xcode 12.3 (or delete it).
Xcode can be updated from the App Store.
Warning: A newer Command Line Tools release is available.
Update them from Software Update in System Preferences or run:
softwareupdate --all --install --force
If that doesn't show you an update run:
sudo rm -rf /Library/Developer/CommandLineTools
sudo xcode-select --install
Alternatively, manually download them from:
https://developer.apple.com/download/more/.
==> Caveats
Please note the path to the Dart SDK:
/usr/local/opt/dart#2.8/libexec
dart#2.8 is keg-only, which means it was not symlinked into /usr/local,
because this is an alternate version of another formula.
If you need to have dart#2.8 first in your PATH run:
echo 'export PATH="/usr/local/opt/dart#2.8/bin:$PATH"' >> ~/.zshrc
==> Summary
🍺 /usr/local/Cellar/dart#2.8/2.8.1: 502 files, 486MB, built in 34 seconds
How can I check what versions I have installed on the system and Flutter?
Many thanks
Update
After running brew uninstall dart when I open the aqueduct project then I get Dart SDK is not configured message from Android Studio.
If I then point to the Flutter's dart-sdk folder Android Studio accept it but I need a 2.7 version to work well with Aqueduct's Postgres db.
So I guess the system should be set with both Flutter with its own Dart version for Flutter projects and a global Dart version for non Flutter projects like this Aqueduct project.
But then how do I set my path? Should I include both in my .zshrc file?
Not to answer your whole question... addressing this part:
I was having the error pub command not found so I installed it
pub is going away. Learn to start typing "dart pub" or "flutter pub", depending on which subset of commands you want.
Finally figured it out..
To have a different Dart version for non Flutter projects use Home-brew as install instructions say with brew install dart command and it will install the latest version.. If you need a specific version as I did install with brew install dart#2.7, and then to use it install docs says to use the brew switch dart command but I got the switch command is disabled in terminal message in terminal so I used the link command instead as suggested as brew link --overwrite dart#2.7
To set it in Android Studio the correct path is /usr/local/Cellar/dart#2.7/2.7.0/libexec as when installing it the dart#2.7 is keg-only, which means it was not symlinked into /usr/local, because this is an alternate version of another formula. message suggested it doesn't get installed in normal route /usr/local/Cellar/dart there you'll find the latest SDK installed with the first brew install dart command..
Update the path for it in .zshrc file and it's all done..
Hope this will help others as getting it set up correctly got me scratching my head a bit ..
Cheers.

"Could not connect to lockdownd" while attempting to run flutter app

I am following the Get Started tutorial.
I can install everything, flutter doctor returns all checkmarks but in the end there is a message:
idevice_id returned an error:
ERROR: Could not connect to lockdownd, error code -2
Same message appears if I try to run the app using flutter run or if I try to list the devices using flutter devices.
The tutorial also states that:
Note: If the Run & Debug buttons are disabled, and no targets are listed, Flutter has not been able to discover any connected iOS or Android devices or simulators. You need to connect a device, or start a simulator, to proceed
I have two devices listed my Android phone and an iPhone simulator. Run and Debug buttons are ENABLED!
How can I run my app using flutter? It can be either using the command line or IntelliJ IDE.
Disconnect all iOS devices, then:
brew uninstall ideviceinstaller
brew uninstall libimobiledevice
brew install --HEAD libimobiledevice
brew link --overwrite libimobiledevice
brew install --HEAD ideviceinstaller
brew link --overwrite ideviceinstaller
sudo rm -rf /var/db/lockdown/*
Connect an iOS device, and choose "Trust" when prompted, after that:
sudo chmod -R 777 /var/db/lockdown/
This workaround worked for me when loosing the connection:
close everything (Visual Studio Code, Xcode, Simulator)
disconnect any physical device
Start Visual Studio Code
connect a physical IOS phone
Start XCode
build from XCode (it will work)
Disconnect your physical device
Start without debug
You will be prompted to connect to a device
and from there it worked again!
This just to help to debug the loos of connection bug. I have also observed that it begins just after the "stop debugging" command from Visual Studio Code.
I was having similar issues, and resolved them using the below. Hopefully this will help you. flutter doctor was telling me the answers, but they were a bit buried. Look for something like this:
[-] iOS toolchain - develop for iOS devices (Xcode 8.3.3)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Xcode 8.3.3, Build version 8E3004b
✗ libimobiledevice and ideviceinstaller are not installed or require updating. To update, run:
brew uninstall --ignore-dependencies libimobiledevice
brew install --HEAD libimobiledevice
brew install ideviceinstaller
• ios-deploy 1.9.1
✗ ios-deploy out of date (1.9.2 is required). To upgrade:
brew upgrade ios-deploy
• CocoaPods version 1.2.0
There are four brew commands in there to run. When I did them, this problem disappeared for me. Good luck!

ionic 2 installation requirements

Am just getting started with ionic 2 and am having problems with the installation . I want to know the requirements for installing ionic 2 apart from node and npm.
Do i need to have android sdk installed? What other stuff should I have.
You would need java sdk 1.7 or higher.
You do need to download the Android Studio and install the required android sdk version for which you would want to build.
You would also need the node version of minimum of v6.9.0 or higher.
try running node --version
And do read up on ionic appscripts in github. There are changes perhaps you would need to apply - https://github.com/driftyco/ionic-app-scripts
You could also Try installing nvm -
https://github.com/creationix/nvm
its called the node version manager. will allow you to have multiple versions of node installed and certainly recommended.
Preferably try and build on the linux platform, to avoid silly issues in windows.
Things you need for installing ionic with windows
nodejs
android sdk
java sdk.
setting path is most important
apache ant
You could check out this link for installing and running to android device
http://www.tiagoporto.com/blog/environment-setting-tutorial-ionic-android-on-windows/
to setup ionic you need to do the following
run
sudo apt-get install nodejs
sudo npm install -g cordova
then
sudo npm install -g ionic
Done run ionic serve inside app folder created using
ionic start todo super --type v2 !!
this will help you to run app on browser
now to install on device,
you need android SDK,
and then you will be able to install apk on phone.
to do that you need to setup android SDK
use the following lines to do that
Install openjdk
sudo apt-get install openjdk-7-jdk lib32stdc++6 lib32z1
Download android sdk
wget http://dl.google.com/android/android-sdk_r24.2-linux.tgz
tar -xvf android-sdk_r24.2-linux.tgz
install all sdk packages
cd android-sdk-linux/tools
./android update sdk --no-ui
Set android-sdk path
pico ~/.bashrc
Add these lines on top, save, and exit
export PATH=${PATH}:~/android-sdk-linux/tools
export PATH=${PATH}:~/android-sdk-linux/platform-tools
Reload bashrc
source ~/.bashrc