Gradle sync failing - android-studio

Gradle sync failed:
Timeout waiting to lock file hash cache (C:\Users\HELLO\.gradle\caches\4.1\fileHashes). It is currently in use by another Gradle instance.
Owner PID: 10116
Our PID: 7136
Owner Operation:
Our operation:
Lock file: C:\Users\HELLO\.gradle\caches\4.1\fileHashes\fileHashes.lock
Consult IDE log for more details (Help | Show Log) (1m 23s 517ms)
-> Gradle build is failing
-> Unable to delete filehash lock file. It throws file in use

To handle this problem go through the following points.
Invalidate catch and and restart studio
If not work yet than Restart your computer
Go to file directory Restart your computer C:\Users\AdminUser .gradle\caches\4.1\fileHashes\ and delete filehash.lock
Now Restart your Studio it would work fine

Go to .gradle directory and delete all files in caches
Sometimes it was notable to delete filehash.lock file and it will throw an error unable to delete file. So do the following steps
For Windows machine:
Open Task Manager(Ctrl-Alt-Delete and check Process)
-> If you run two instance of android studio, Close One (End Task)
-> Then close OpenJDK Platform Binary
-> Gradle sync now on AndroidStudio and it will work now

Delete everything under below path.
C:\Users\HELLO\.gradle\caches\
There is a fileHashes.lock that is holding a global lock which is preventing you from running your script.

Related

dotnet publish Error: The process cannot access the file because it is being used by another process

I get the following error when tring to run dotnet publish:
The process cannot access the file because it is being used by another
process.
This appears to happen when you try to publish your app and you have been viewing the published version in the browser, for some reason it locks out the files.
Full error message:
C:\Program Files\dotnet\sdk\2.2.301\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Publish.targets(169,5): warning MSB3026: Could not copy "obj\Debug\netcoreapp2.2\TemplateWebApp.dll" to "bin\Debug\netcoreapp2.2\publish\TemplateWebApp.dll". Beginning retry 1 in 1000ms. The process cannot access the file '\cpft-bi-web01\d$\Websites\TemplateWebApp\bin\Debug\netcoreapp2.2\publish\TemplateWebApp.dll' because it is being used by another process. [\cpft-bi-web01\d$\Websites\TemplateWebApp\TemplateWebApp.csproj]
I can resolve this by closing the browser and the restarting the website on IIS Manager but this is really not ideal, does anyone know the cause of this?
To solve it, i recycle the apppool.
On local environment, i have a Post Build Event Project -> Properties -> Build Events -> Post-build event command line, that runs a .bat file that sits in project directory.
This is the code from bat file:
%SYSTEMROOT%\System32\inetsrv\appcmd recycle apppool /apppool.name:"YOUR APP POOL NAME"
dotnet publish --force --no-build
pause
Just make sure you replace YOUR APP POOL NAME with your actual pool name (and keep the double quotes)
So every time i build the solution, it recycles the pool and publishes the app. Because i just build the app (right before publishing), i specify --no-build to publish command.
I had the same error. Stopping the application pool on IIS, then publishing, then starting the pool again worked for me.

gradle lint stuck in command line only

I have an Android Studio project (3.1.3)
When i run Analyze -> Inspect Code Lint runs for a reasonable amount of time and gives results. It lets me pick which modules to run lint on, etcetera.
When i run it using ./gradlew lint --debug Lint runs and gets eventually stuck in a loop of the following:
3:52:50.637 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Lock acquired.
13:52:50.637 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Releasing lock on daemon addresses registry.
13:52:50.638 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Waiting to acquire shared lock on daemon addresses registry.
13:52:50.638 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Lock acquired.
13:52:50.638 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Releasing lock on daemon addresses registry.
How can i get the command line to run like it does on Android Studio?
Try to disable the gradle Daemon in the gradle config file (look "Disabling the Daemon" paragraph of THAT link to the how-to).
Now it should work, or at least it gave you the "real" error message.
Hope that help,
Legion-
P.s.: In case the link will be deleted or moved I quote the part i think you need:
The Gradle Daemon is enabled by default, and we recommend always
enabling it. There are several ways to disable the Daemon, but the
most common one is to add the line
org.gradle.daemon=false to the file
«USER_HOME»/.gradle/gradle.properties, where «USER_HOME» is your home
directory. That’s typically one of the following, depending on your
platform:
C:\Users\ (Windows Vista & 7+)
/Users/ (macOS)
/home/ (Linux)
If that file doesn’t exist, just create it using a text editor
To run the lint task for only a specific build variant, you must capitalize the variant name and prefix it with lint. details
./gradlew lintDebug

Gradle Copy Task causes file permission issue

Background
I have a JetBrains Plugin that I am developing. Recently, I moved from a Windows to a Ubuntu system. I am trying to set up everything correctly as before. Note: I am fairly new to Linux.
Issue
I am having an apparent file permission issue (as can be seen in the error section of this question) when I ran the following Gradle script. Note: Whenever I build the project, this Gradle script is automatically called. It also worked correctly on Windows.
If I comment out the copy{...} closure then everything works correctly. I just need to manually copy over the required file.
tasks.create(name: "copyJar_v${project['version']}") {
group GROUP_CHROMATERIAL
def mostCurrentJarFile = "ChroMATERIAL-${project['version']}.jar"
// comment this out and there are not errors, but I need to do this copy manually
copy {
into '/' // Copy into project's root folder
from 'build/libs', {
include mostCurrentJarFile
rename mostCurrentJarFile, 'ChroMATERIAL.jar'
}
}
}
Error
FAILURE: Build failed with an exception.
* Where:
Build file
'/home/ciscorucinski/IdeaProjects/ChroMATERIAL/ChroMATERIAL/build.gradle' line: 100
* What went wrong:
A problem occurred evaluating project ':ChroMATERIAL'.
> Could not copy file '/home/ciscorucinski/IdeaProjects/ChroMATERIAL/ChroMATERIAL/build/libs/ChroMATERIAL-2.5.1.jar' to '/ChroMATERIAL.jar'.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
Total time: 0.139 secs
/ChroMATERIAL.jar (Permission denied)
오후 12:20:39: Task execution finished 'copyJar_v2.5.1'.
What I tried
I have been using the UI to modify the file permissions of the Plugin Project Folder within IdeaProjects.
I gave everyone Create and delete files permissions and I Change Permissions for Enclosing Files...
Everyone has Read and write access to files and Create and delete files access to folders.
Clicked Change
Run the Gradle script again ... same error message
Thoughts
It appears that Linux is not letting Gradle modify these files. I can comment out the code and do everything myself, but I need to allow Gradle to have higher control. Don't know how though.
I notice that when I go back to Change Permissions for Enclosing Files... the shown permissions are not what I selected! Others has Read-only access to files and Access files access to folders. I don't know if this is common Ubuntu behavior, a bug, or something else.
It would be nice to know how to give as restrictive as possible access while fixing this.
Well, it is true -- you cannot (and should not) copy files into the Root folder in a linux box. You could if you ran the script as sudo, but that is a bad idea.
Edited
Since you want to copy to the root of the project, you can use ${projectDir} or ${rootDir}.
Also, you should be able to do this without the hassle of a closure -- and it makes your script cleaner, IMHO -- by using the built in Copy task:
task copyClientLoc(type: Copy) {
from "build/libs/"
into "${rootDir}"
include "ChroMATERIAL-${project['version']}.jar"
fileMode = 0644
}

Access to the path 'mscordbi.dll' is denied

when trying to deploy my uwp application (no difference for Simulator, local or x86, x64), I get the following error:
Error : DEP0500 : The folder "...\bin\x86\Debug\AppX" could not be deleted.
Access to the path 'mscordbi.dll' is denied
With the tool 'ProcessExplorer' I found that VS2015 itself is locking the file. After a manual delete, I can run a single deployment, but the second fails due to the locked file again. I already tried the following Things, without any effect:
- delete VS-Settings
- move projects to a new solution
Why is this file locked by Visual Studio?

Can't get azure web role to run locally using the emulator

I have a web role that I'm trying to run locally using the emulator. I have it working on another computer, but I cannot get it working on a different one, and have gone as far as to reformat it and start from scratch.
When I launch the site from Visual Studio, Chrome shows the following message:
This webpage is not available
The connection to 127.0.0.1 was interrupted.
There is also an error code listed at the bottom:
Error 101 (net::ERR_CONNECTION_RESET): The connection was reset.
One interesting thing from the build output are these lines:
Starting process 'C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\Extensions\Microsoft\Windows Azure Tools\v1.8\Debugger\WindowsAzureDebugger.exe' with arguments '"C:\Program Files\IIS Express\iisexpress.exe" /trace:error /config:"C:\Users\brian\AppData\Local\dftmp\Resources\159c7254-b7d0-4076-a4fd-820b00feca5f\temp\temp\RoleTemp\applicationHost.config" /site:"deployment18(27).AzureApp.MyApp.Web_IN_0_Web"'...
Process 'C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\Extensions\Microsoft\Windows Azure Tools\v1.8\Debugger\WindowsAzureDebugger.exe' exited with exit code 0.
If I run C:\Program Files\IIS Express\iisexpress.exe" /trace:error /config:"C:\Users\brian\AppData\Local\dftmp\Resources\159c7254-b7d0-4076-a4fd-820b00feca5f\temp\temp\RoleTemp\applicationHost.config" /site:"deployment18(27).AzureApp.MyApp.Web_IN_0_Web" from the command line, I get the following message:
The system cannot find the file specified.
Unable to start IIS Express in background.
I have no idea what file it cannot find, but I've verified that the config file I'm passing does in fact exist. Anyone have a clue what's going on here??
While I can not tell you what could be the actual root cause of your problem I can suggest a few ways to troubleshoot it:
Try changing IIS Express to Full IIS and see if it changes the behavior. You can do it by going to your Windows Azure Application project properties and look at "Web" option.
Try running application without debugging it
Launch CSrun at command prompt with /launchDebugger parameter of the /run option to verify that debugger does run without any issue
Try using IE as default browser
Clean your dftemp folder completely for any residual configuration and then launch Azure Emulator separately to verify there are no issues
Procmon "http://technet.microsoft.com/en-us/sysinternals/bb896645" may help you find the file that is missing...
Hopefully someone stumbles upon this answer with similar symptoms. When removing in role caching the <dataCacheClients> section was removed from . Somehow there was a left over <dataCacheClients> section left in the web.config. Everything and compiled and deployed to the emulator successfully. However, the role would fail to start since applicationHost.config was missing.
The fix was simply remove the unnecessary <dataCacheClients> section from the web.config file.

Resources