Android Studio 3.0 VERY VERY VERY slow on run - android-studio

I have a very big problem using Android Studio.
Every time I make a code changing, I have to check if all has gone well launching my app; but as soon as I click the "Run app" or the "Apply changes", it's the end: it starts the Gradle build process, which take even 30 minutes to complete, and furthermore Android Studio take the full control of my computer, not allowing to do nothing anymore (like open the browser, open notepad++, and so on...).
Can anyone help me?
Thanks

If you use Eclipse you won't have this problem anymore. but if you want to stick with android studio and gradle you can run your emulator and gradle once and whenever you want to compile your code run it on the already built gradle. this means that do not close the emulator and run your program on it again and again. this way you will not have to spent alot of time on loading the emulator and gradle

Android Studio is not a very light software.It uses a lot of your system RAM and CPU power.So if you are using an old system then it is obvious that android studio will run slow.If possible then upgrade your system.
And one more thing it's better to use actual device rather than Virtual Emulator for our application working test.

Related

Android Studio 2020.3.1 - Run very slow, always re-build

I'm using latest AS, version 2020.3.1. Every time I change the code and run it again, AS run very slow, always re-build project (take about 10 minutes). My project is also quite large, using many libraries.
How to make AS run faster?
Please help me. Thanks.
It all depends on your system configurations. It does not matter which android studio version you are using. Try upgrading your machine or prevent using inbuilt AVD of android studio rather use your own mobile for testing. This could make Your AS run a bit faster.
Here is the link to know how it is done
https://developer.android.com/studio/run/device

Plugin 'org.jetbrains.android' failed to initialize and will be disabled. Please restart Android Studio

I left my computer to sleep with Android Studio open and this suddenly happens to me now.
I get this error when Android Studio starts and it forces me to restart it. Also, when it does restart, I have a bunch of errors of other plugins telling me that the plugin “Android Support” is disabled. I tried the solution of this answer with no avail.
Now, in the menu, under tools, I don't even have the AVD Manager nor the SDK Manager anymore!!!
I am at my workplace getting crazy with this. Please help!!
Thank you
it was not a sleep problem, it happens to me all the time whenever i try to change my system's language to other than ENGLISH.
for example when i try to install android studio on a PC that has its default system language HINDI, then this problem comes. because by changing this, date time formats becomes unreadable to android studio.
Simple solution is- dont change your system language and keep it as English.

Android Studio - automatic gradle sync at startup

Yesterday I updated the Android Studio to 2.2 (from 2.1.3). Since that the Android Studio always start gradle sync at startup on every opened projects. I found this question and I tried Mick's suggestion, but unfortunately that did'nt worked for me.
If I open Android Studio, and I wait until load my projects, sync gradle and then I close Android Studio (without any change on my projects), and after that, I open it again, AS also do the same as before (run a gradle sync again senselessly).
I think, this is not a serious problem, but it's pretty weird, because it sync senselessly (otherwise I start gradle sync manually if I need to, but AS start it on every startup senselessly), and I need to wait little more to start coding (a little waste of time and energy).
Maybe this is what you want.
gradle --stop

Android Studio avoid "make" while running

When you press the run button in Android Studio the project is buit again, and as you know this always take long, if e.g. I select Build -> Make Project and then "Run" the make process runs again, I don't understand why? I would expect that it only installs the APK that is already generated. Is there a way I can achieve this, is my expectation funded or am I thinking wrong?
I've used the approach described here to speedup my build.
Building and running app via Gradle and Android Studio is slower than via Eclipse
At the same time i've disabled "make project automatically" because sometime it produces old code.

Does Android studio need internet connection to build project

I am using Android studio version 0.4.2 and gradle version 1.9. I have successfully installed Studio and have created multiple projects. Today when I launched Studio without internet connection,
I got this error message:
"Gradle project sync failed. Basic functionality (e.g. editing,
debugging) will not work properly" and the Event Log window shows
"Failed to refresh Gradle project < Project Name >. Connection timed
out: connect. If you are behind an HTTP proxy, please configure the
proxy settings either in IDE or Gradle."
I need to know if internet connection is mandatory for building projects using gradle.
I think gradle checks for latest version on internet and throws Connection time out error. If so, is there any workaround to disable that.
Currently Android Studio's Gradle implementation requires a fast stable network connection. For whatever reason, the developers have decided to force this requirement on users at this time. There is a setting that you should be able to use to utilize a local gradle installation, but it doesn't hold. The developers know about both the network requirement and the broken switch, but are currently prioritizing other functionality. They may remove that requirement in the 1.0 or post 1.0 time frame.
[see: https://plus.google.com/u/0/115692564989237473252/posts/LGSbniYqj3Q ]
Gradle's offline mode, isn't. It should be properly named cached mode. All that switch does is tell gradle to not try to go online and instead utilize cached copies of the various networked resources. Unfortunately that assumes that you have had (and will have again) a network connection, preferably a fast stable one. Using Android Studio (last version tested 0.5.9) with a slow/unstable network results in watching Android Studio process Gradle ( and Maven ) processes usually for 2-5 minutes, sometimes for 10 minutes or more. Also at seemingly random times when coding the IDE will lock up and the cause usually involves one or more Gradle processes that have spun up.
As a comparison, using IntelliJ IDEA 13.1 Community edition (the IDE that Android Studio is based on) I compared a default "Hello Android" IDE generated program using the Android Gradle wizard (substantially similar to the only one in Android Studio) and the Ant based Android wizard. The results were as expected. The gradle based project experienced the same painful lock up and lag that projects in Android Studio exhibited. The ant based Android project was near instantaneous. No appreciable delay once the project was created and opened. Coding caused no random lockups. Testing was done on a Windows 8.1 update1 Pro machine with a dual Athlon x2 processor, 6GB RAM, and a 6Mb/0.75Mb DSL connection. I believe that last part is most likely the issue.
Unfortunately until Android Studio removes the network requirement I feel it will be unusable to a large number of developers. That's a shame because otherwise it looks to be a marked improvement over the existing Eclipse based development environment.
For me, I had to check and then uncheck the box in
Preferences->Gradle->Offline work.
Then I got back online.
You can download the gradle distribution locally and build the project again.
To do this, edit your gradle-wrapper.properties under gradle-> wrapper in your Android project.
Edit the
distributionUrl=https://services.gradle.org/distributions/gradle-2.2.1-all.zip
to
distributionUrl=file:///home/foo/downloads/gradle-2.2.1-all.zip
So just download the file from here as mentioned in your gradle-wrapper.properties.
There's an offline mode preference in Preferences > Compiler > Gradle. If you already have your dependencies downloaded, this will generally work for you.
In Android studio version 1.5.1 I could solve this error by following steps :
1) Go to file -> Settings -> HTTP Proxy -> & select Auto detect proxy settings.
2) After that you may get Dialog to accept or reject certificate
3) Select Accept.
That's it.

Resources