I know this topic was created on the past, but since none of the suggested solution worked for me. I create it again with the hope to get helped and help others too.
Each project I create only run once. If I restart my computer for example, I get for the project a gradle related error message and build fails:
Timeout waiting to lock journal cache (C:\Users\SKUL.gradle\caches\journal-1). It is currently in use by another Gradle instance.
Owner PID: 16056
Our PID: 11672
Owner Operation:
Our operation:
Lock file: C:\Users\SKUL.gradle\caches\journal-1\journal-1.lock
The journal-1.lock file I was not able to delete this as was suggested, so from task manager I end the OpenJDK Platform Binary task. Then I was able to delete it. But again, the build crash at 33% with the same error message.
The only solution that worked for me was
End OpenJDK Platform Binary Task
Delete the whole “caches” folder (.gradle\caches)
Then the project takes too much time to build again but runs successfully.
What would you suggest me to try? Gradle version? Downgrade to another version?
//I had no issue when I used expo for react native
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.
After a new installation of Android Studio 3.6.3 (portable). When I try to build and run my project, I keep getting
app\build\intermediates\compile_and_runtime_not_namespaced_r_class_jar\debug\R.jar:
The process cannot access the file because it is being used by another
process.
Not sure what it wants from me. I run Android Studio "as administrator" and even closing the project and reopening it, the first time it runs, the second time I get the error.
I tried invalidate caches and restart, I tried deleting folders under app/build but it seems to come back. What am I missing?
Thanks
Update:
When trying to clean the project, I get the following
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:clean'.
> Unable to delete directory 'C:\Users\name\Downloads\portable\android-studio\projects\appm\app\build'
Failed to delete some children. This might happen because a process has files open or has its working directory set in the target directory.
- C:\Users\name\Downloads\portable\android-studio\projects\appm\app\build\intermediates\compile_and_runtime_not_namespaced_r_class_jar\debug\R.jar
- C:\Users\name\Downloads\portable\android-studio\projects\appm\app\build\intermediates\compile_and_runtime_not_namespaced_r_class_jar\debug
- C:\Users\name\Downloads\portable\android-studio\projects\appm\app\build\intermediates\compile_and_runtime_not_namespaced_r_class_jar
- C:\Users\name\Downloads\portable\android-studio\projects\appm\app\build\intermediates
If I wait for several minutes, for example, the time it took me to update this question, then it works again...
update:
Updated to Android Studio 4 and the same problem occurs.
Try
taskkill /im java.exe /f
in cmd (windows 10)
I encountered the same problem but on Android Studio Arctic Fox while working on a Jet Compose project.
I simply changed the run configuration and the build error was resolved.
Change DefaultPreview to app and the issue is resolved.
Killing the "OpenJDK Platform binary" process from Task manager worked great for me.Thanks to Abed Murad, which I saw on his link. (I have no reputation to cast a vote yet - my bad!)
It's an internal bug in AS, I reported it as a bug, you can follow up here
https://issuetracker.google.com/issues/167701947
I used to try to delete the file R.jar on ...\app\build\intermediates\compile_and_runtime_not_namespaced_r_class_jar\debug and when it's locked, I had to close Android Studio then delete R.jar before reopening the Android Studio.Is it (killing the "OpenJDK Platform binary") the best solution? I don't know, however, it's what I got for now. Once I get a better one, I'll update it. Luck there guys!
It's an internal bug in AS, I reported it as a bug, you can follow up here
https://issuetracker.google.com/issues/167701947
Try removiong all *.xml files from %USERPROFILE%\AppData\Roaming\Google\AndroidStudioPreview2020.3\workspace
I figured it out from this google issue.
I had the same issue all I did remove R.jar and re build my project.
Invalidate cache and restart solved my problem
My android studio worked normally and one day i started getting this message.
I tried reinstalling Android Studio and SDK multiple times, disabling firewall but nothing worked.
I dont know what should i tried also changing
org.gradle.jvmargs=-Xmx1536m
to
org.gradle.jvmargs=-Xmx1024m
Error:Unable to start the daemon process.
This problem might be caused by incorrect configuration of the daemon.
For example, an unrecognized jvm option is used.
Please refer to the user guide chapter on the daemon at https://docs.gradle.org/4.4/userguide/gradle_daemon.html
Please read the following process output to find out more:
-----------------------
Error: Could not find or load main class org.gradle.launcher.daemon.bootstrap.GradleDaemon
This error may have various reasons
Install/verify latest compatible Gradle version with Android Studio.Or
Some time IDE run on low memory so then you need to increase org.gradle.jvmargs in gradle.properties file. Or
File->Invalidate Caches/Restart Android Studio.Or
Close project remove .gradle folder from project and open project again.
Assuming it's a git repo, please try a
git stash it keeps your changes for "later"
git clean -xdf It removes your repo from non-checked-in files.
After you have to reopen your project again.
The question come, where to do so. Here you can see it
Then you can type here
I recently switched from Eclipse to Android Studio because I read that it is now the official IDE for Android application development. I downloaded and installed the latest version (1.0.2) for Windows. When using the program for the first time, I decided to create a test application to see if the program was working correctly. Unfortunately, it was not. Once I clicked the finish button to complete the New Project Wizard, A loading bar showed up that said Gradle: Build. This is where the program gets stuck. There is no error message and it appears that the program is running fine, however the build never actually completes. I am never given my MainActivity.Java class, or my activitymain.xml document. If I click the cancel button, the program freezes and I have to use the TaskManager to kill the program. If I re-enter the program and choose to open an existing project, my project will be there. However, upon trying to open the project, I am greeted with the same Gradle: Build loading bar.. I have been searching for an answer for the last 3 days and nothing has worked. Any help is greatly appreciated!
Things I have tried:
Simply letting the program sit for a while to see if it was actually downloading something and was just really slow. I let it sit for 45+ minutes before killing the program.
Uninstalling and re-installing Android Studio
Restarting my computer
Turning off my firewall (Kaspersky)
Running the program as an administrator
Connecting to a different network
Disconnecting my computer from any networks (to force the program to build in offline mode)
Manually downloading Gradle from the link that Android Studio attempts to use when it gets stuck and telling the program to use that file instead of downloading another one.
(I went to this link https://services.gradle.org/distributions/gradle-2.2.1-all.zip, downloaded the file, unzipped it, went to Gradle settings in Android Studio, checked the Offline work checkbox, and finally set the service directory path to my unzipped Gradle folder.)
Hopefully I have given enough information and made it clear what my problem is. If not please tell me what else I need to explain so I can get this issue resolved. Thanks!
Please note I am working on a 64 bit machine running Windows 8. Also, I use studio64.exe
to run the program.
From the discussion we had in the comments, it does not look like you have your gradle on your windows path.
Please change the below to point to your gradle install:
set GRADLE_HOME=C:\<installation location>\gradle-1.11
set PATH=%PATH%;%GRADLE_HOME%\bin
After this, verify that in the terminal running the following works:
gradle tasks
once you get this working, you will want to run the following in your project:
gradle wrapper
This will produce a .bat file which you can then use to run gradle through the wrapper, letting you support multiple native gradle installations.
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.