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

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.

Related

How to run flutter application natively on android and ios separately?

I am working on flutter application, and i want that application to load and run natively on android studio without flutter sdk separately so that i can put some dependencies of native kotlin or java there and run natively from there.
I copied the android folder from flutter project and create a new native android application from it
enter image description here
I have also faced the same issue , after researching the internet I got to know that there are one way to include our flutter project to android as module and than you can use Flutter.createView to load your flutter widget. It is simple as that, you can also follow this blog for step by step instrucation
https://medium.com/flutter-community/add-flutter-to-existing-android-ios-app-ae8c4fb1582e
You can just open android folder in Android Studio and ios folder in Xcode. Flutter tools will generate needed modules for Android Studio project and CocoaPods for iOS project. You can also run and debug your app using native debuggers (Java/C/Objective-C/Swift) from these IDEs.
Then you can easily add dependencies by changing build.gradle of your android application. I think it's a bit more complicated with ios.

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

How to convert the ionic project in to android app

i had build the ionic project (sample in 'www' folder) and run the sample in browser. but i need to convert the sample/project in to android app, and want to test that sample in my android phone. please provide what are all the software needed to do this and what are all the step by step procedure.
You will need the Android SDK to compile Android code. Set ANDROID_HOME environment variable to the SDK location.
On windows: set ANDROID_HOME=/path/to/sdk
From the command line, run the following command which generates an Android project:
ionic add platform android
Then build an apk file using this command:
ionic build android
Copy the apk to an Android device for testing.
The next step after starting an ionic project and building the app is deployment.
Make sure your device connected to your machine. Make sure android ionic support is enabled via $ionic platform add android. Check that android is supported via $ionic platform list.
Then build your app.
$ionic build android and run it $ionic run android
This should run to the connected device to test. You can also use emulators by adjusting the run syntax.

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