Just upgraded to Android Studio 3.4 and am trying to compile my apks for the first time with it. Seems to be stuck forever at:
Shall I give this up as a bad job, or be patient?
No, I gave up after 1 hour (had to force close Android Studio), log out and back in again. I then noted that R8 is enabled by default, so I disabled it as per this and now it's back to normal (using ProGuard rather than R8 though).
EDIT I tried enabling R8 again and this time I got an error message Out of memory: Java heap space, with a suggestion to increase the amount of memory allocated to Gradle by using the following line in gradle.properties:
org.gradle.jvmargs=-Xmx1024m
... and it worked! Seems to compile a lot quicker using R8 compared to Proguard.
Even after having 16GB-RAM/256SSD/Core-i7 configuration, I ran into similar issue while building project in release mode on Android Studio 3.4 version with gradle-5.1.1, but after updating to gradle-5.2.1 all issues gone. Just go to File menu and open the Project Structure dialog to update the version.
Related
AndroidStudio keeps failing to generate the binding classes for classes using ButterKnife when I make changes to the views / bindings, making ButterKnife no longer work. The problem goes away when I do a full rebuild of the project... for a while, and then comes back. I haven't been able to nail down what changes trigger it.
How can I fix this? And short of fixing it, is there any way to manually get AndroidStudio to re-run AnnotationProcessors without having to do a full rebuild of the project?
Setup details:
Windows 7
Android Studio v2.2.3
CompileSDKVersion 25
Jack Enabled compiling using Java 8
ButterKnife v8.5.1
Disabling the (now finally deprecated) Jack toolchain solved this issue - as suggested by the Butterknife founders in the issue I opened
At the time of this writing, if you are using JAVA 8 to compile, you will have to install an AS version > 2.3.2 and update your gradle version and plugin accordingly. Then the annotations work as expected AND you get InstantRun capabilites back :)
my android studios started freezing up on me so I killed the task using task manager and when I reopened android studio I got this error:
Error:Failed to complete Gradle execution. Cause: Gradle build daemon
disappeared unexpectedly (it may have been killed or may have crashed)
I tried cleaning and rebuilding the gradle and closing out and reopening android but it doesn't go away. The main answers on stack overflow seem to have outdated answers to click on things that are not there anymore such as Settings-->Gradle-->GradleVM options.
i solved it from information issue tracker it happen in android 3.0 canary 4
go to gradle.properties
add this code
android.enableAapt2=false
As outlined here:
https://developer.android.com/studio/intro/studio-config.html
To change the VM heap size do the following:
1. Help > Edit Custom VM Options
2. Add the line
-XmxheapSize
, where heapSize is the size you want.
ie.
-Xmx2g
for 2 gigs
This error is mainly associated with Android Studio 3.0 Canary 3 AAPT2(Android Asset Packaging Tool).
Improved incremental resource processing with AAPT2. To enable AAPT2, add >the following to your gradle.properties file: android.enableAapt2=true.
this is a new feature added to android studio in order to increase its performance.
Read more about improved android plugin.
But some how it cause an error Even a fresh install pop up this error on first start. You just need to do one thing to solve this issue.
Go to gradle.properties
Add this line android.enableAapt2=false(If its not already there.)
If you set android.enableAapt2=true the same error will reappear.
(heapSize have nothing to do with this issue.)
It is because of due to lack of RAM memory in System.
Close all instance of Android Studio and restart it.
Make sure RAM has released some space:
check in Windows Task Manager (by pressing Ctrl+Alt+Del it will display)-->Performance.
It may be happened cause of VM heap size. Once try by adding below line in
HELP --> Edit custom VM option
-Xmx2g
where 2g is size of heap
Close your android studio and restart your computer.
Then try building it again. Sometimes this error goes out by simply restarting your computer.
this error has to do with less ram so
for me it was fixed after I closed the emulator
as emulator was consuming much ram and restarted it
android studio needs so much ram to run...
So free some memory and restart studio
Im also having the same issue just close all other tabs and click invalid catches and restart the studio.It works fine
I'm doing a project in my office in Android Studio, it was working fine there.
But when I open the same project in my personal laptop in Android Studio it's taking a lot of time to build gradle.
Please, does anyone have a solution?
I have also face same problem, actually your personal laptop not compatible to run android studio, in the documentation of android they mentioned that 4 GB RAM is sufficient but my personal experience said that RAM should be 8 GB, its also depend on your operating system in MAC os android studios running smoothly then in Linux its also give good performance but in Windows its creating a problem, i think you need to upgrade your RAM.
Add this line to the file:
org.gradle.daemon=true
From now on Gradle will use a daemon to build, whether you are using Gradle from command line or building in Android Studio. You could also place the gradle.properties file to the root directory of your project and commit it to your SCM system. But you would have to do this, for every project (if you want to use the daemon in every project).
Note: If you don’t build anything with Gradle for some time (currently 3 hours), it will stop the daemon, so that you will experience a long start-up time at the next build.
Note: Performance improvements are one of the great tasks in the Gradle roadmap for 2014 (and reaching into 2015). So I hope, we’ll see the general performance increasing within these years.
Note: This does only affect console builds. Android Studio always uses a Gradle daemon (and depending on your settings some other optimizations).
Found the reason!! If Android Studio has a proxy server setting and can't reach the server then it takes a long time to build, probably its trying to reach the proxy server and waiting for a timeout. When I removed the proxy server setting its working fine.
On Windows File > Settings > Appearance & Behavior > System settings > HTTP Proxy
After updating the Android SDK, I started Android Studio. Now its showing background task continuously running with message
Updating indices: Scanning files to index.
In this mode, it is nearly hanged and I can not work on it. Not able to find a way to stop background task. A restart of Android Studio didn't work either.
I've find out that I should use the solution of #free3dom which is the Invalidate Caches / Restart option in the File menu.
I have to do this every time I change some project file by switching branches in GIT.
And yes, Android Studio really sucks and is full of bugs...
Unplug all the phones and plug them again, it gets working. It is related to adb as stated here : https://code.google.com/p/android/issues/detail?id=172387 and a known bug that is to be fixed in the future
The indexing is triggered through inotify on Linux.
There is a limit to how many directories a single user can set watches on. If your project is large, then this limit may be exceeded, and Android Studio falls back to recursive scanning mode, which is very slow.
To fix this, add this line to /etc/sysctl.conf file:
# Increase the limit for Android Studio
`fs.inotify.max_user_watches = 500000`
Then run sudo sysctl -p.
Stopping and closing the emulators that I had running solved this issue for me on the latest version of Android Studio.
I've this problem recently and in my case I'm using a linux 64bit SO and my android studio was in a ntfs disk. Since ntfs doesn't support executable permition the file fsnotifier64 was unable to execute and android-studio fallback into a compatibility mode that is much slower. The solution was copy the android-studio folder into my home folder that was ext4 and that way i was able to set permitions.
I struggled with this issue for almost one hour, and after that found that this is the adb connection issue, you can disconnect your device once and stops all the working adb processes. This issue may get resolved.
I'm also facing this issue, I've tried almost all the methods mentioned in this post, but none of them worked. The only solution that worked for me is to upgrade Android Studio to 3.5(which is still a test version at the time of writing this answer).
This happens to me after updating the Android Gradle plugin version from (3.5.3)
to (3.6.2) and Gradle version from (5.4.1) to (5.6.4)
it solved after downgrading the plugin again
to change Android Gradle plugin version and Gradle version:
File > Project Structure > Project
reference: https://developer.android.com/studio/releases/gradle-plugin.html
In my case, it was a module circular dependency problem. It wouldn't show until I removed all the changes into all build.gradle files, then reopen it and apply the stash.
It works :)
This was happening in my project every time I added a new Activity.
So I included my R file in that class and it stopped.
eg: import com.domain.appname.R;
This fixed the problem.
I love the new incremental Java compile in IDEA 12.0 but there seems to be a price to pay. Making now takes about twice as long as in 11.x, most of the time appearing to be spent
Executing DEX
(according to the status bar).
I can take a 12.0 project, revert to 11.x and making is back to "normal speed" (approx 4 minutes vs 30 seconds).
I don't get this. AFAIK, IDEA (or Eclipse or any other IDE) is just shelling out to dx.jar to compile the Dalvik executable. If there was a problem with the ADT, it would affect 11.x equally.
OS is Win 7 Ultimate. 3.2GHz quad core with 16GB but I suspect that the issue is not related to OS or PC since 11.x is OK.
Any ideas? I'll log a bug with Jetbrains but wanted to see if anyone has more concrete info or workarounds? There's nothing so far on the Jetbrains bug tracker or fora that I can find.
I have had this issue a couple of times in the past and it's always been due to the inclusion of a global library that hangs during build.
On one occasion it was due to the Python libraries trying to execute when the Android project was built because I had a python file in my Android project and IntelliJ decided to add the Python runtime libs to my project dependencies.
More recently the same thing happened with Groovy when I had a gradle file in the Android project.
For me I simply removed these dependencies from the project and the problem resolved itself.
In my case I discovered this by force killing (kill -9) the java process that was running the make. This caused intellij to dump the error to the Messages view in the IDE where I could see groovy trying to execute.