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.
Whenever I checkout a different branch and build the app, this particular task takes around 10 minutes. It's awfully long.
app:transformClassesWithDexBuilderForDebug
Android Studio : 3.2.1
Gradle plugin: 3.1.3
I tried many things such as invalidate cache, clean build, clean whole gradle cache etc.
My app contains libraries which uses annotation processor.
Is there any direction to find out the root cause or anyone had a similar issue and solved it?
Does anyone have this weird glitch that came with AS Canary 16 that when you build the app all the references via Kotlin Android Extensions light up red and show compilation error.
Even though the app builds I loose all autocomplete on Views and auto import always deletes imports for methods that are called on views because it thinks that they are not used.
Clean build helps sometimes but not always. Can anyone suggest how to fix this irritating issue?
Looks like this is an issue with Android Synthetics in Kotlin. There is an open issue with JetBrains for it. You can track it here:
https://youtrack.jetbrains.com/issue/KT-23908
The reporter states that he can simply re-sync Gradle and things go back to normal. This works for me some of the time, but often times I will have to close & re-open the entire project. Rare occasions require actually quitting the IDE. Even more rare, I have to clear IDE caches. After all that, if I still have problems, I'll delete .gradle/caches and let everything re-sync & re-download.
Definitely a huge headache.
I'm using Android Studio to develop my app, and it used to work well. Until recently I noticed that I could still build and deploy my app, however, when I tried to run some unit tests it will give me some class undefined exception, and after looking at the exception, I noticed that it seems there is some problem with support v4 and support v7. Here is a screenshot of the imports strange behavior.
Any solution or idea? I already removed my caches for AS2.0, 2.3, 3.0 and uninstall and reinstall AS3.1.3 and Invalidate and restart, remove gradle cache, clean build, rebuild.
I still don't know the reason yet. But I did get the solution. I switched to an older version of code and synched Gradle, and it works, then I switched to new version of code and synched, and it still works.
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.