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

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.

Related

PhoneGap Development

How easy is PhoneGap to build and deploy Android applications? The application I'm thinking of is not a beginner level app. How is the level of debugging and error handling and the support it gives?
Thanks in advance.
Deploying an app with Phonegap is quite easy. You can install Phonegap by using,
npm install -g phonegap#latest
and then create an app by,
phonegap create myApp
Refer the docs, PhoneGap Getting Started
When you create the app you will notice there is a directory called "WWW". All you have to do is copy a build of your existing web app to this directory.
All your assets and code in this directory will be used to build apps for the platforms you specify.
You can use Cordova to add the Android platform, which will be used to get an Android build out of your project.
Use,
cordova platform add android
Notice the directory "platforms". Inside it you will find another directory called "android" and this will be your Android project.
To build an Android app simply use,
phonegap build android
When you run the above command Phonegap will build an Android project using your code in WWW directory and place it in the platforms/android directory.
You can then use Android Studio to open the android directory which is an Android project now.
It's as simple as that and quite easy once you get the hang of it.
Then you can do all the regular debugging inside Android Studio using Logcat.

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.

Where to place jars in Cordova app developed in Visual Studio?

I am trying to create cordova app in visual studio, because I just want to explore. I have very good idea on Cordova CLI, eclipse and Android Studio environments. My goal is to add my own custom plugin to the Visual Studio Cordova project and execute my existing code.
With the help of below link, I successfully added my custom plugin.
https://taco.visualstudio.com/en-us/docs/manage-plugins/#Custom
Apart from js files, my custom plugin also needs some native(android) jars, which I am going to add manually in Eclipse/Android Studio.
My problem here is - I don't find any libs folder in Visual Studio environment (as I am newbie), can some one let me know where exactly I need to required jars.

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

add ionic framework to an existing android studio app

I'm developing a project with android studio for a ODROID XU4 board. Because of the nature of the project I'm using android studio to make a native app in order to use some of the Harware features of the board as Ethernet, GPIO,... and because there is no intention of developing this for any other platform.
The problem now is that the customer wants a nice looking ionic interface.
I've been testing most of the approaches I found in google, ionic forums, stack overflow and many others sites but without success.
The nearest I've got is creating an ionic app, adding android platform and importing it to android studio.
My first question is:
1- Is this the correct approach?
My work flow is:
ionic start myapp
ionic platform add android
ionic build android
and then I import the myapp folder with android studio.
first of all I get an android studio error:
19:40:40 Migrate Project to Gradle?
This project does not use the Gradle build system. We recommend that you migrate to using the Gradle build system.
More Information about migrating to Gradle
Don't show this message again.
19:40:41 Update Property Files
The structure of following Android modules was changed:
android
CordovaLib
Would you like to update related project.properties files?
Only once
Always for these modules
Never for these modules
19:40:44 Update Property Files
The structure of following Android modules was changed:
android
Would you like to update related project.properties files?
Only once
Always for these modules
Never for these modules
19:40:45 IndexNotReadyException: Please change caller according to com.intellij.openapi.project.IndexNotReadyException documentation
19:48:09 Error Report: Submitted
Now its time to migrate the project to gradle:
here is the main problem, I don't know where to put the new gradle file or how to continue.
thanks.
First off: Your looking in the right direction. This is the correct approach. However, I think your problem is based on the fact that you importing the wrong folder to Android Studio.
Please import the folder "android" that is generated by ionic (cordova) in your myApp/platforms folder.
The recent Versions of cordova are using the Gradle build system. So if generated with a recent version of cordova the gradle build configuration files are already existing in that "android" folder.
By importing the myapp folder (as you did) these files are not present in your Android Studio projekt. Hence you see the error: This project does not use the Gradle build system.

Categories

Resources