简体   繁体   中英

How to export flutter app from android studio to Xcode?

I have an application running on Android, and it's on play store already. Now I want to start deploying to Appstore,I managed to get a Mac for this. I'm trying to import the project to Xcode,but flutter run gives errors for different paths of flutter and packages.

Is there an easy way to export from Windows and Android studio to Mac Xcode and not wasting hours only to open the project?

EDIT: The error it gives: Your application could not be compiled, because its dependencies could not be established. The following Dart file: /Users/bojke/Desktop/app/lib/main.dart...refers, in an import, to the following library: /C:/flutter/.pub-cache/hosted/pub.dartlang.org/cloud-firestore-0.8.2+3/lib/cloud_firestore.dart Unfortunately, that library does not appear to exist on your file system.

That's because I can't name a directory with doubledot..

Thanks!

Forgot to do: flutter packages get . This solved my problem.

You don't "export from Android Studio to Xcode". The flutter project contains the projects for both native problems. Run

flutter build ios --release

Then go into the iOS project and open your Runner workspace for iOS then archive your project from there.

Once you're in the xcode project follow these instructions

Connection to physical iPhone device is not necessary. Run any sample project in xcode. Start a Simulator. (Only One simulator preferrably).

  1. clone the repository from github into Mac (with X-Code Installed)

  2. open terminal.

  3. cd to your pubspec.yaml

  4. flutter run (it will automatically run flutter pub get) (It will launch on the already running iOS simulator)

follow steps on flutter.dev to install flutter. Above steps will only work from terminal if flutter doctor(any flutter command) is recognized

I would definitely recommend installing Android Studio on your Mac and run your app on an iOS simulator or real iOS device from Android Studio. Make sure everything works fine, and only then build for release.

Here is a step by step instruction on how to set up your Mac environment for Flutter

And when you feel your app is ready for the open-world - check out this doc on how to build and release an iOS app

Also, if you don't have a Mac you can start a virtual machine with Mac OS X, hosted on your Windows or Linux. It will give you the ability to run your Flutter app both on iOS simulator and on physical iOS devices, as well as Android emulator/real device.

For example, I have an OS X Mohave running on my host Windows 8.1 on VMware. Make sure you have enough RAM and CPU to run both OS. I allocated 6GB of RAM to the virtual machine and it runs at a speed enough to make some fixes for iOS, run on iPhone simulator and release a build on XCode. Clearly it would be annoying to work at that speed all the time but for my purposes its enough.

If you don't want to mess around with virtual machine - check https://www.macincloud.com/ it's a cloud service for getting remote access to a dedicated Mac. (with XCode installed) for $20/mo. For 8 hours per day, it's something like $35/mo. Good as a temporary solution if you don't want to spend $2k for a MacBook Pro

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM