Flutter run in vscode taking unexpectedly long time - flutter

I am using vs code for flutter dev for the first time, while trying to run the app, it's showing me "this is taking an unexpectedly long time".However it builds the application, but takes around 17 mins. Any help??

So, I am a Windows PC user with 4GB RAM and i3 processors. I know the thing you're thinking. "Why is it taking so much time?" Believe me, I go through it a lot. Actually, it is not your fault or Flutter's. It is because of the slow PC.
Usually, the 1st run takes time. It has to build packages and stuff. So, it will take time. After the first build, as and when, new dependencies are added, the run time may increase. But after the first build, it runs faster.

Another issue I've found when building Flutter apps onto a physical Android device specifically, is that ADB may be causing the slow performance.
So running:
adb kill-server
Then unplugging and replugging the device and then:
adb start-server
Followed by:
flutter run
Increased performance

I am a windows user. My pc has a core i5-4200u(2 cores, 4 threads) with only 6GB ram.
If you are trying to run the app in an android emulator or in an android device try this.
Add following lines to the gradle.properties file found in your android folder in your project directory.
org.gradle.daemon=true
org.gradle.parallel=true
org.gradle.configureondemand=true
org.gradle.caching=true
Checkout these 3 links for more information
https://www.journaldev.com/12333/increase-gradle-build-speed
https://medium.com/#AthorNZ/how-to-speed-up-your-slow-gradle-builds-5d9a9545f91a
https://www.youtube.com/watch?v=7ll-rkLCtyk
Earlier I had build times like 200s or more. But after enabling these features my build times got significantly lower.
In the first run you won't notice a massive difference. But after that your build times will reduce massively.
After doing all this I got like 40s or less build times.
The build time without the changes mentioned above
The build time in the first run after the changes
The build time in the second run after the changes
Please note that I have only changed the gradle.properties file to improve build times.

Related

When you start a finished project downloaded from the internet Running Gradle task 'assembleDebug'

When creating a new app in Android Studio, everything starts normally. But if you download an example of some kind, then the application does not start and shows an infinite download, how to fix it? That is, I downloaded a ready-made project, try to run it, and show me the Running Gradle task assembleDebug and nothing else happens. But if I create a new project myself, it starts. Could it be because I didn't install Dart and Flutter separately? and I installed them through Android Studio and use them
this is a ready-made project that I downloaded from the internet and it does not start. It doesn't show any errors.
Dart comes with Flutter. So, you don't need to install them both separately.
Since there is no error, it means that it is just slow. What happens is that the first build requires a lot of files. Some of the packages need to be downloaded and certain files needed to be built. So, it will take time. The speed may also be affected by the internet speeds.
In your case, when you're creating a new project. It is a basic project. So, very few files. So, it gets done quicker.

Hybrid Application Sizes

Currently, I've been developing an application in flutter but after I install it on my android device I diagnosed that it takes huge amount of space.
Firstly I want to know if there is any solution to it?
Secondly, if there isn't any solution; is there any other hybrid language without this problem??
if you run flutter run and see the application size in your phone you will find it very large > 40 MB. This is because while in debug mode whole flutter engine is installed on phone to support debugging and Just in time compilation of your dart files. Effectively lets you hot reload your changes Just in time.
Now if you run flutter build apk or flutter run --release, this will generate an apk in release mode. Means no debugging support, everything Ahead of compiled to target machine code. And the size of the app should be as low as possible < 15 MB.

Android Studio: The emulator keeps crashing after sometime

Every time I run the emulator it runs normally at the beginning but after a couple of minutes it crashes and it's giving me this error:
emulator process finished with exit code 1073740791 (0xC0000409)
I am using windows 10 home edition. virtualization is enabled in bios. I don't have any other virtualization software installed (like virtual box).
any idea why this is happening?
It seems a buggy graphic card driver can cause a similar problem. I am not sure if this is generated your problem here or not, but it is worth to say; If you have an NVIDIA graphic card with the driver version of 378.49 (there may be other versions too!), you may experience this error due to some incompatibility with java.
Please update your graphic card driver or rollback it to version an older stable version and try again!. And read here for more information.
I might have an Idea what your problem is:
Restart the adb Server, you can do so by using the command Prompt in the following way:
First go to C/users/(YOUR USERNAME)/AppData/Local/Android/Sdk/platform-tools with the cd command.
Then just type adb kill-server, and adb start-server, so like this;
cd C/users/(YOUR USERNAME)/AppData/Local/Android/Sdk/platform-tools
adb kill-server
adb start-server
If that doesent work try to wipe and cold boot described in this question.
Try this :
Go to Tools ==> SDK Menager ==>Android SDK
(Appearance&Behavior=>System settings=>Android SDK)==>SDK Tools==>Intel x86 Emulator Accelerator(install this).
It will solve your problem.I hope it helps.
Here are a few things you can try:
Go to AVD manager and open settings for your virtual device. In the Emulated Performance section for graphics, change it from automatic to software.
Have a look at here. There could be an incompatability with other software incompatibility with other software such as Docker, Oracle Virtual Box and other products that use VCPU.
You could try a complete reinstall of Android Studio and make sure all updates are completed. There could be a bug in an older version of the emulator you are using that's fixed in a more recent release.
Edit
A couple more things you could try:
Open Android Virtual Device Manager, then click on options for virtual device, then wipe data, then cold boot.
Go to C:/users/(username)/AppData/Local/Android/Sdk/platform-tools in a terminal, then type adb kill-server, then adb start-server.
Edit
You could also try checking for memory leaks https://developer.android.com/studio/profile/memory-profiler and you could try increase the amount of RAM available for the emulator.
Go to Tools->Android->AVD Manager, then edit your AVD, then in the pop-up window click Show Advanced Settings, then finally increase the amount of RAM.
Edit
IT could be an issue with libGL or libstdc++. See here
It sounds like the emulator may have not installed correctly. Check these steps:
Ensure that you have installed Hyper-V . Documentation for running emulator on AMD
Then try this step to force a cold boot:
Android Studio Emulator and "Process finished with exit code -1073741511 (0xC0000139)"
If Its crashes again, then create a new emulator. You might also try and download a new image just to make sure that the one you installed is not corrupt.
You said you're using Windows 10? Error code 0xC0000409 is caused by a stack buffer overflow. It seems to have popped up a couple places all related by windows systems (might be totally irrespective of the android emulator). If this is the case I found a couple threads that might help solve your problem.
http://www.cplusplus.com/forum/windows/39061/
https://answers.microsoft.com/en-us/windows/forum/all/werfaultexe-the-exception-unknown-software/627da5c0-004a-e011-8dfc-68b599b31bf5?auth=1
http://windowsbulletin.com/solved-exception-code-0xc0000409-error/
https://www.tenforums.com/tutorials/16397-repair-install-windows-10-place-upgrade.html

ionic installation and build difficulties

Creating a new ionic project and doing an android build downloads innumerable packages; if anything goes wrong in this process, many things can get corrupted. I am now on my fourth re-install of Windows, for example.
Is there a way of downloading everything required for an ionic install and android build first so that I have all the downloads safely in place before I start on installation? This would also give the benefit of being able to create a number of projects without having to download everything again.
What I do now make copies of folders and base new projects on folders that are correctly downloaded and functional. Even a simple ionic project downloads and creates a folder of approx 200 MB. I find that this process can often go wrong.
On a good day, I can run
ionic start <projectName> blank
and answer YES to the question "Would you like to integrate with Cordova"
This then generates a folder of about 200 MB. If I am unlucky something goes wrong and this fails.
I check that the folder is correct by running
ionic serve
and verifying that the browser shows a basic page.
I then run
ionic cordova build android --debug
This increases the folder size to around 270 MB. Finally, I confirm that I can FTP the *.apk file to a website and install it to an android device.
I then make a copy of this folder and use that copy as a basis for all new projects. I never run "ionic start" again.
I have never had problems with the installation of other development environments, so this seems very unusual. I can only assume that the complexity of the installation can lead to faults. Achieving one correct download and then copying that is how I handle these problems. The best time for me in Scotland is to do installations in the middle of the USA night.

Emulator in AMD Processor is not working

I using AMD processor. I have installed everything related to eclipse perfectly. But I'm unable to start the emulator. program is hang and keep waiting for adb forever. The same issue in android studio also. Please give a solution.
I'm using a Android Studio on an HP x360, which is a nice little laptop but has a puny processor:). I spent ages getting the Intel Hax virtual machine thingy installed on my machine, as well as configuring bios (which I found AVAST blocked changes to, so had to uninstall it).
After probably hours this week (I'm new to Android) waiting for the emulator to do it's thing, start up, load program, and eat memory, I decided to plug in my phone (Moto-e).
This has made a massive improvement! Only takes a minute to compile and run now! You also have piece of mind that your app will run in the real world.
So as a newb to Android, I'd say don't bother with the emulator.... plug a real device in.
See here for setting up HAXM, if you have trouble installing, it may be antivirus etc blocking it....
Intel HAXM
All the best.
try these threads Virtualization threads