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

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!

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).

It is pretty straight forward. You open the root of the flutter project with Android Studio. You should also open your_project/ios with xcode to set the signing keys, dependencies and other stuff with a nice ui.
Important is that when you run flutter doctor it don't have any errors. If it has, fix those first.
Also when I used Android Studio I sometimes encountered a bug where the project would not run on the emulator. In such cases try to run your code in xcode first and the flutter clean.
Here is a nice reference for building on mac.

Related

Ionic 4 project - Android studio & ADB doesn't update with changes in code

I have an Ionic 4 mobile app project and have been previously been testing with with ADB with Android Studio. I can successfully run/build and install onto my android device. However, no changes I make in the code take affect when I view the app on my device.
This link was the closest I could find to my issue: Android studios doesn't update app on mobile device't-update-app-on-mobile-device/38919601
I have tried to Build > Clean Project in Android Studio but it hasn't worked for me.
This is my first question on here so any tips on how to improve my ability to ask would be much appreciated :)
Your suggested link having a solution. Try Re-build the Gradle.
Do build->Rebuild project then run it.
To be sure you are on right project :).
I needed to run an ionic build before running npx cap add android and npx cap open android

How to build .apk & .ipa in Flutter, using Android Studio?

I am new to Flutter developement.
I kept reading, understanding & following Flutter Documentation and has created my first flutter app in Android Studio IDE. It is working fine in android emulators.
Now I want to test application in iOS simulator but I don't know how to generate build for iOS.
Is it possible to generate .ipa through Android Studio IDE? If yes then how can I do that? Also I can not build .apk, what are the steps for that?
Thanks in Advance...
You can use
flutter build apk --release
flutter install
To build for iOS you need a Mac, because it depends on XCode to compile parts of the application.
You should first install X-Code and Android Studio (with Flutter settings and SDK enabled) on macOs, then copy your source code there and open with Android Studio.
After that run flutter clean, flutter packages get and flutter build ios commands in order.
If you have used some libraries that are not supported in iOS they must be omitted or replaced in the project (it can be determined by seeing the library's official page on pub.dev).
Then connect the iPhone to mac and if everything is OK it should be visible in device list section, finally press the Run button to finalize required dependencies by downloading from the internet.

Building Ionic framework in android studio

I'm trying to create a hybrid application through the IONIC framework which displays multiple moving graphics implemented through HTML5 Canvas and JS. But, the animation renders very slowly in mobiles (even those with 1GB RAM).
We have identified and downloaded FastCanvas (Cordova/PhoneGap plugin). We followed the instructions given in the URL - https://github.com/phonegap/phonegap-plugin-fast-canvas. But under "Adding FastCanvas to Your Application" we hit a roadblock when we come to instructions 3 and 4 as there are no Java folders in my project.
The example (HTML5 Game) given in the url is done through PhoneGap which has the mentioned folder structure and it works fine when we build through Android studio.
We have tried to build our project (done through ionic framework) through Android Studio but, gradle build system was unable to identify the framework. Request someone to please guide me further to solve this issue since, I'm struggling to come up with a solution for long.
Note: We have already tried Canvas, JS, CSS3 and wizCanvas plugin for the animation but, the output is same - slow.
Whoo-hoo.
After a long struggle, this is what finally worked for me:
Opening a Project in Android Studio
Cordova for Android projects can be opened in the Android IDE, Android Studio. This can be useful if you wish to use Android Studio's built in Android debugging/profiling tools or if you are developing Android plugins. Please note that when opening your project in Android studio, it is recommended that you do NOT edit your code in the IDE. This will edit the code in the platforms folder of your project (not www), and changes are liable to be overwritten. Instead, edit the www folder and copy over your changes by running cordova build.
Plugin developers wishing to edit their native code in the IDE should use the --link flag when adding their plugin to the project via cordova plugin add. This will link the files so that changes to the plugin files in the platforms folder are reflected in your plugin's source folder (and vice versa).
To open a Cordova for Android project in Android Studio:
Launch Android Studio.
Select Import Project (Eclipse ADT, Gradle, etc).
Select the Android platform directory in your project (/platforms/android).
For the Gradle Sync question you can simply answer Yes.
(If prompted to update gradle from v2.3 to 3.3. click Update)
Once it finishes importing, you should be able to build and run the app directly from Android Studio. See Android Studio Overview and Building and Running from Android Studio for more details.
Refs:
https://cordova.apache.org/docs/en/latest/guide/platforms/android/
https://www.codeproject.com/articles/1068176/step-by-step-guide-to-build-ionic-hybrid-app-using

Configure Eclipse for Phonegap build

I am new to Phonegap and have succesfully created my first app and compiled first on-line then set up phonegap, android SDK etc locally so I can build and run the app in the emulator using 'phonegap run android' at the command prompt (windows).
For an IDE I installed Eclipse and imported the project. I can now run the project from within Eclipse.
However I am really struggling with the Eclipse build. It's taken days already to solve all the problems and get to this stage but I've reached the point where I can't make progress although it would seem so simple.
The build project option is disabled. It turns on if I add something under 'Builders' under 'Configure Build Path...' but I have no idea what I should be doing here.
I can go back to the CMD prompt and build, refresh in Eclipse and run the modified version but this can't be the right way to do it?
I just need to tell Eclipse to 'phonegap build'. But how?
When you create a project using PhoneGap it creates a Gradle based build which can be opened in Android Studio or IntelliJ IDEA. I recommend using Android Studio for PhoneGap projects.

How to compile cordova project from visual studio (Hybrid App) to android / ios apk

I try to compile my Cordova Hybrid App from visual studio to apk file
After I deploy the project to Android / iOS the project bin folder still empty.
I try to upload the "www" folder to build.phonegap.com but I get error.
What is the best and correct way to compile the project (HTML, CSS, and JS) to APK for Android and IOS?
Thanks,
Tom
Update:
I try to build from the visual studio
this is my Project folder
When I try to build project from the visual studio on "Device" mode I get this error
1- If you have used Ripple simulator as the target, nothing will be generated in the bin folder. You need to switch the build configuration to "device" in order for the binaries to be generated
2 - The www folder that is generated by the Visual Studio template has nothing special and you shouldn't have issues with PhoneGap Build. If you have errors they are coming from your JS code itself
3 - To build the binaries for Android using the Multi-Device Hybrid extension for Visual Studio, you should be good by simply switching the build configuration to "device" instead of Ripple simulator. For iOS you need to use the Remote Build and Simulation Agent for iOS (which require have a Mac as the iOS tools are NOT available for Windows and you cannot generate the iOS binary directly on your Windows machine. Otherwise, you can consider using PhoneGap Build service
From the image the error looks to be similar to the one I was getting about my device not being recognized/found.
This answer explains how to get the APK directly just by setting the solution to Release, and only Building the project rather trying to do a full deploy to a device. It pretty much is the same answer as mentioned in point 3 above, just tested on a PhoneGap App solution.

Categories

Resources