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.
Related
Every time I run Android Studio, this loading screen pops up, but Android Studio stays here and doesn't load. It's like this following picture except that the loading bar is loaded all the way but stuck there. I am running Windows 10.
I have tried many things, including setting the system variables JDK_HOME to where my JDK is located and the same for JAVA_HOME. I have also set a path. I ran as admin many times and let AS through a firewall.
I have also restarted and reinstalled countless times.
The version of AS is 2.0, and I am running the latest versions of Java.
Any help?
Open file Android Studio setup directory/bin/idea.properties
Add disable.android.first.run=true to end
Restart Android Studio
PLEASE NOTE: This will break patch updating to the next version. We
now check full binary checksums on the whole installation to prevent
various install corruption bugs as well as to preserve application
signatures. Therefore, make a copy of this file first, and before
updating, put it back.
Please try the following method to fix that issue:
Find the folder of your AndroidStudio: based on the following directory
macOS: ~/Library/Application Support/Google/AndroidStudio[version]
Delete the AndroidStudio folder.
Restart
Ref:https://developer.android.com/studio/known-issues#studio-config-directories
In order to know how to debug the problem, I executed the bin\studio.bat script in the terminal and inspected the actual Idea exceptions in order to fix the problem.
For me, this was the issue:
ERROR - llij.ide.plugins.PluginManager - java.net.BindException: Address already in use: bind
java.util.concurrent.CompletionException: java.net.BindException: Address already in use: bind
This means the plugin manager is trying to listen on a port that is not available. Is something listening on that port? For me, it was the stupid "excluded ports" by Windows, so I simply stopped the service:
net stop winnat (as administrator), and confirmed that Android Studio started to work.
No need to re-install, delete precious configuration (and plugins, etc.). Just read the log provided by the bin\studio.bat script, and I was able to fix the issue.
i'm trying to install my app debug from my android studio. it's work well yesterday, but today when i try to install it again, the application cant be installed on my device and showing error like below on my android studio.
Installation did not succeed.
The application could not be installed: SHELL_UNRESPONSIVE
The device timed out while trying to install the application.
Retry
what should i do? i tried install on other device, and it worked fine. My device is Redmi 4X and other device is Samsung J3
Faced the same issue, not sure of the reason but in Android studio, Click on the File -> Invalidate Caches/ Restart and then it starts to work.
I got same issue with my device. i restart my device and its work properly.
The problem is because you don't have the proper SDK for the Android version. I'm telling you because a month has passed for me too. The solution is to download the appropriate pack in the SDK Manager.
If you have doubts how to enter:
Close the project.
In the welcome panel click on settings, then choose the SDK Manager option.
Click show package details and select the version for Android and choose all packages.
Finally you click ok XD
Try this method if it works perfect greetings
If other answers didn't help and previously application was installing correctly on your device, try to check your AndroidManifest file. Check that nothing forbids to install your app because of os version conflict or manifest merging errors or other reasons.
I came across this problem recently, through process of elimination I determined the cause was related to dependencies in the build.gradle(your app name).
I suggest working backwards and comment out everything that was added since the last known working build/install.
In my case I have a legacy app developed back in 2016 being rewritten, dependencies for signalR have changed quite a bit since then, the original libs where causing the install to fail while everything else seemed excellent, not even a single build error was occurring. Commenting out the libs and references got the application to a runnable state.
In my case, I deleted the emulator and recreated it. It solved the issue.
Before this, I had already tried following which did not work for me:
From menu: File->Invalidate cache/restart.
Deleting .cxx, .idea, .gradle, build folders and rebuilding.
Cold boot device emulator
Posting this in case someone is trapped in my kind of situation.
I'm on Windows. I created a new project on Android Studio for Marshmallow at least.
The only thing I've done so far is generating the main activity which is a tabbed activity with view pager. Also, you should know that this project is a private git repo that I cloned.
I'm working on this project with another developer and the project is perfectly working on his side.
The problem is:
When I try to launch the app (wether it is a virtual device or my real phone), the gradle build gets stuck at the app:processDebugResources step. I waited more than an hour and nothing happened. Moreover, when I want to cancel the gradle build, it doesn't respond and I have to kill Android Studio process. Then I restart Android Studio and I have to kill a gradle process that prevents the initial gradle build (at Android Studio startup) from working.
The crazy thing is that I was able to launch the app before. I even installed it on my phone!
What I've tried so far:
Do what stackoverflow was giving as solutions like tick the offline mode in the settings
Create a new project --> It doesn't change anything
Reinstall Android Studio --> It doesn't change anything
Deactivating Avast antivirus
Invalidate cache/restart + Clean + rebuild (the rebuild gets stuck like when I try to launch the app)
And maybe other solutions that I forgot...
It's getting very annoying as it's making me lose days of development.
If you have any more solutions, or if you think I should try again some of the previous solutions, help would be greatly appreciated !
I know this is an old post, but I faced the same problem during the last few days and since i got crazy I hope I can help someone else out there.
After many hours of troubleshooting I found that the Java Platform SE binary executable goes in "suspended mode" in Windows 10, preventing Android Studio from compiling (it hangs at app:processDebugResources).
Example Screenshot
Killing the suspended process and recompiling the project works just fine... until Java gets suspended again.
Maybe your gradle version is not compatible with it. Try again with latest version of gradle in your project.
I did several things:
Install NDK
Change JDK from embedded one to Jdk 8
Redownload SDK i was using (6,7,8)
And now the problem is solved ! I have no idea which of these things made the tricks but I'm happy ! It may be useful to someone else one day.
For 2 days I can't start coding my first android app, because of an issue with Android Studio 2.3.1.
There is many discussions about that out there, but non of them helped me so far.
I'm not able to use Run button for my app or even to edit the main_activity.xml file in the program window. Also the following error occurs when Android Studio starts running.
Screen shot of the error:
I'm workin' on Windows 7, 64bit, 8gb RAM, Java 1.8.0.121. Installed Android Studio 2.3.1 using android-studio-bundle-162.3871768-windows.exe file with no custom settings.
To solve the problem I've tried:
reinstall Android Studio
remove .gradle catalog
use File>>Invalidate Crashes/Restart
nothing helps.
Problem solved!
In my particular case the problem was caused by uncomplete Android Studio installation.
The reason of such an installation was Comodo AntiVirus
I noticed that there was some .bat files blocked during the installation. Comodo doesn't inform about it, but you can check it on blocked features list.
So I removed completely Android Studio, turned off all blocking functions in Comodo and quited it. Then installed AS once again.
Now it works fine. Ad least so far... Luckilly there's no Gradle error, so I hope there won't occur further problems.
Hope that this tip's gonna be helpful to somebody.
Have a good day folks!
The issue I've had over the past few months is that Android Studio would often get stuck on Gradle: build, as seen here. Android Studio itself would stay responsive but the build simply wouldn't progress. It also never generates any kind of error, so I can't really post any useful information. Once in a blue moon it might suddenly work, but nothing reliable.
Recently I found a post here on Stack Overflow where someone's Android Studio would get stuck on Gradle: build when he tried to create a new project, and he noticed that this issue didn't exist in the 32-bit version of Android. So I thought, why not try that. Turns out that building isn't an issue anymore, but assembleDebug is, when trying to build the application. As can be seen here.
Of course all these commands work flawlessly when run using command prompt and gradlew.
What I've tried so far:
Reinstalling Android Studio (including the removal of .AndroidStudioProject)
Upgrading Android Studio to the latest version
Removing any build files from projects
Creating completely new projects in Android Studio
Switching from 64-bit to 32-bit Android Studio
I'm running the latest version of Android Studio, using version 19.1.0 of the build tools, gradle v0.11+ and am on Windows 8.1.
Is there anything else I can try? This is starting to become seriously annoying. The last possible solution I can come up with is just doing a complete format and a fresh Windows installation.
I was experiencing the same problem, and the solution was very unexpected in my case: AVAST antivirus was somehow interfering with the Gradle:build process.
Deactivating this antivirus solved the problem!
Because there is no answer to this problem I will share, what I have done, to solve this issue. From what I have seen, the problem is that there is a dependancy(or many) from a maven repo that can not be loaded. So you have to take all dependacy one by one and check if exist on the maven repo.
For example I was having a dependancy for "org.jraf:android-switch-backport:1.3.1" from "http://JRAF.org/static/maven/2" that at that time could not be opened.
My build.gradle looked like this:
repositories {
mavenCentral()
maven {
url "http://JRAF.org/static/maven/2"
}
}
compile "org.jraf:android-switch-backport:1.3.1
For me, this problem occurred when I was USB tethering using an Android device. The first build took anywhere from 5-10 minutes, and every subsequent build took about 3-7 seconds. I found that by disabling USB tethering, the first build completed quickly (and so would all subsequent builds). After the first build completed, I could reenable USB tethering.
If you have a fresh Ubuntu 14.04 with Android Studio 1.5, you may be missing a library. Try this:
sudo apt-get install lib32z1
Another stack overflow answer
It happens 1 in 2 times for me. The hack that works for me is File->Exit and confirm exiting. Then a message shows up telling me that Gradle is running and then all of a sudden the screen to choose the device shows up. I Click NO and all goes well again.
Anyway, still a bummer, but I have not found an answer yet.
My problem was that the Android Sdk executables were missing the executable bit. You can check some of your binaries like /Sdk/build-tools//aapt to see if they have permission to execute. If not you can solve it by running this on the Sdk folder
chmod -R +x ./
If you are behind a proxy on ubunthu you might need to set your gradle system wide proxy:
sudo nano ~/.gradle/gradle.properties
And enter the following entries:
systemProp.http.proxyHost=<Your Host>
systemProp.http.proxyPort=<Your Host Port>