Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to run flutter app developed in AndroidStudio on iOS device?

I've developed a flutter app in AndroidStudio and everything is running perfect.

Now I want to display the app on iOS device. I see many similar questions which state that you have to have x-code, etc. setup on a MAC or virtually. Perfect, done all that setup, now, how do I get the AndroidStudio project into iOS IDE (VisualStudio?). I assume once I do that I just run like any other iOS app?

Seems that every flutter tutorial would have this but just don't see it when I google. Any help would be greatly appreciated!

like image 900
user1685767 Avatar asked Oct 16 '22 16:10

user1685767


1 Answers

A Flutter project is set up as follows:

Root directory
  - pubspec.yaml
  > lib
    - ... (dart files)
  > assets
    - ...
  > android
    - build.gradle
    > app
      - build.gradle
    > ...
  > ios
    - Runner.xcproject
    - Runner.xcworkspace * (this may not be there until running `pod install` or `flutter run`.
    - Podfile
    > ...

If you have XCode and everything set up properly on a mac, you should be able to run flutter run from the root directory and have it deploy to the device. You could possibly even do this from android studio, although I personally use IntelliJ so I cant verify that.

If you want to open the XCode project directly, you should actually get the option in IntelliJ (and possibly android studio) whenever you look at a swift or objc file. This is a fairly recent feature which has been introduced (as of June 2018).

Otherwise, you can directly open the Runner.xcworkspace file to open the XCode project. Running to a device should work from XCode after you've tried to build at least once with flutter (or you can run pod install in the iOS directory manually).

like image 66
rmtmckenzie Avatar answered Oct 21 '22 06:10

rmtmckenzie