Xamarin installer fails to delete source directory on Windows - xamarin.ios

The problems in my log started with this:
[Exception] Failed to delete source directory '<USER_HOME>\Android\android-sdk\platform-tools' after copying it to '<USER_HOME>\Android\android-sdk\platform-tools.old464541238'
[Exception] System.UnauthorizedAccessException: Access to the path 'adb.exe' is denied.
[Exception] at System.IO.Directory.DeleteHelper(String fullPath, String userPath, Boolean recursive, Boolean throwOnTopLevelDirectoryNotFound)
[Exception] at System.IO.Directory.Delete(String fullPath, String userPath, Boolean recursive, Boolean checkHost)
[Exception] at Xamarin.Web.Installer.Utilities.MoveDirectory(String sourceDirName, String destDirName, Boolean move, Boolean overwrite, Boolean createSourceDirRootAtDestination)
Even though the Xamarin installer complained about a timeout, I figured that wasn't it.

After some googling, I found this similar error, which occurred while trying to install Droid Explorer, but it turns out we had the same problem and solution: if adb.exe is running, you must kill its process before proceeding with the installation.
This looks like it wouldn't happen on a system without any prior Android SDK installation (or even if adb.exe isn't running), but as I think it's common for people with Android development experience to try out Xamarin.Android, it could help other people with similar issues.

In my case, with Visual Studio 2022, the adb.exe process was not running but I was still getting the error. The solution was to find the SDK Manager .exe file (C:\Program Files\Microsoft Visual Studio\2022\Professional\Common7\IDE\Extensions\Xamarin\AndroidSdkManager) and manually run that as an Administrator. I was then able to run the SDK repair process, after-which it has been working fine in Visual Studio.

Related

Android Studio 3.0 - No server to serve request

After clean install of Android Studio I always get the error
Error:java.util.concurrent.ExecutionException:
java.lang.RuntimeException: No server to serve request. Check logs for
details.
and
Error:Execution failed for task ':Application:mergeDebugResources'.
Error: java.util.concurrent.ExecutionException: java.lang.RuntimeException: No server to serve request. Check logs for details.
Java is up to date and the path is set.
I am new to Android Studio, what should I try?
We ran into the same issue, and have been able to find the root cause: The error message means that Gradle cannot connect to some worker processes. In our case, the process was for 'aapt2'. Running 'ldd aapt2' indicated that some shared libraries were missing (mainly GLIBC). Since we're using Docker based on Alpine Linux, it comes with a reduced GLIBC (glibc-musl). The solution was to simply install glibc in the Docker container.
I suggest you run ldd build-tools/{version}/aapt2
to see which libraries are missing from the OS. You did not mention your OS, are you also using Docker and AlpineLinux ?
In my case, I did not need to re-download the sdk. I closed Android Studio and ran the following command in the Terminal:
sudo chmod 777 -R ~/Desktop/AndroidStudio
...where, ~/Desktop/AndroidStudio was the folder structure after Root which I needed to mention in order to provide permission to read all the SDK packages and perform required operation as and when necessary by the Android Studio, because my Sdk folder was inside "~/Desktop/AndroidStudio".
I am running Android Studio 3.0.1 on Ubuntu 16.04 LTS. This worked for me perfectly :-)
This error occurred because you might have accidentally remove the executable flag from aapt2 which is located in $ANDROID_HOME/build-tools/27.0.2.
Try this:
Re-download the sdk (recommended)
followed by-
sudo chmod 777 -R $ANDROID_HOME
Note:
$ANDROID_HOME is the location where I put android sdk
Hope this helps !!
Had to uninstall Android studio and delete the following
SDK folder in AppData folder
Delete .gradle folder
delete .AndroidStudio Projects folder
and did a fresh install which solved .
I had this problem on lubuntu-16 32bit (and also some other problems too). all of the problems were solved when I updated my system to lubuntu-16 64-bit.
Here how I fixed this Issue:
1.Deleted .gradle folder.
2.Closed android studio and run as administrator.
On Start android studio will rebuild the folder you deleted.
sudo chmod 777 -R $ANDROID_HOME
Note: $ANDROID_HOME is the location where you put android sdk
Hope this helps !!
If it is possible for you, please delete the build folder of project and test building android project with any other version of build-tools.
in my case, build-tools version: 26.0.2 had problem, I tested with 27.0.3 and it solved my problem unbelievably :)
I ran into the same problem, and it turned out I had messed up the file permissions inside the android-sdk folder (more specifically android-sdk/build-tools/{version}), and some binaries were missing execution permissions.
In my case, I simply gave x permissions to the relevant files in that directory, but if you're not sure, I suggest you uninstall the android sdk, completely remove its directory and then reinstall it again.
So after investigating the issue for long , I have a concrete solution .
Let`s look into it.
Go to Android Studio -> Help -> Show Log In Files
In the subsequent folder that opens, open idea.log
This would present you with a log file which contains logs of processes right from when the studio started. Now in this file, you have to search for the possible issue. For some the issue might be due to
java.io.IOException: Cannot run program "/home/mmt/Android-Sdk/android-sdk-linux_x86/emulator/emulator-check": error=13, Permission denied
For some others, it may be some other. The point is that this file contains lot of irrelevant logs and you have to identify the one that is causing this issue. For me , after discovering the above issue, I granted permission to that particular folder using the below commands
cd $ANDROID_HOME/sudo chmod -R 777 emulator/
After this, rebuild your project and tadaaa.. problem resolved.
for me it was a virus that corrupted my files from the "build tools" folder. so I uninstalled everything and made a new installation of android studio, SDK and build tools.
For me, this is the side effect of another issue that I haven't root caused yet. Every once in a while, I get aapt2 failures because some file /tmp/ld-linux-x86-64.so.2 is "busy", with the following error message.
AAPT err(Facade for 1745790725): cp: cannot create regular file '/tmp/ld-linux-x86-64.so.2': Text file busy
Slave 1745790725 failed to start java.lang.RuntimeException: AAPT slave failed to start. Please make sure the current build tools (located at ~/.../android-sdk-linux/build-tools/27.0.3/aapt2) are not corrupted.
When this happens I just rm that file and everything starts working again. I suspect this might be caused by me actually having two installs of adb (one through ubuntu via apt and one from Android studio) but I haven't had time to dive deeper.
I already had latest version of build-tool installed, so I just had to give permission to Android_home:
chmod 777 -R $ANDROID_HOME
and build again. This worked for me.
If you are on Windows 10 (sigh), close android studio and then right click on android studio icon and select 'Run as Administrator' from 'more' menu.
Build again.
You can run Android Studio as Admin.
I hope it will help you.
To Do So :
Right click
choose Run as Administrator
Best regards,

error cannot open file 'kernel32.lib'

I have installed VS2013 and VS2015 on Windows 7.
I have an existing C++ Dll project that was building fine but now all of a sudden it wont build using VS2015 and gives me the error:
LINK : fatal error LNK1104: cannot open file 'kernel32.lib'
From this post: fatal error LNK1104: cannot open file 'kernel32.lib' I went looking for the kernel32.lib file and it is located here:
C:\Program Files (x86)\Windows Kits\8.1\Lib\winv6.3\um\x86
When I go to my Projects Properties-->Linker-->Input and select Macros I see that this path is indeed there:
My Platform Toolset is set to Visual Studio 2013 - Windows XP (v120_xp) which is what it always has been set to.
Why has my Project all of a sudden stopped building? What could have gone wrong?
I had this similar problem today with Visual Studio 2013 when I changed my VC++ Directories:
Project->Properties->VC++ Directories:
Include Directories
If the cause is some plug-in/extension that changes your props files, it may in consequence change the "Visual C++ Directories" settings of your project.
So, the solution that worked for me is described on my own answer Can't compile 64 bits Visual Studio 2010 projects, which I fully transcribe to here:
After I asked a colleague for help, we noticed, that even getting
clean builds of the projects from TFS, with overwrite option, the
Project's Configuration Properties > VC++ Directories on my computer
were always different from other computers.
Searching more we found the solution on the last post of Reset
include/lib path, which I will fully transcribe:
use "del %HOMEPATH%\AppData\Local\Microsoft\MSBuild\v4.0\Microsoft.Cpp.Win32.user.props"
is not always the right way.
Better use "del %USERPROFILE%\AppData\Local\Microsoft\MSBuild\v4.0\Microsoft.Cpp.Win32.user.props"
where the application data folder is normally placed in.
Then I've looked inside the contents of Microsoft.Cpp.x64.user.props
and I've seen that there were things added by Visual Leaks Detector.
Which is reasonable, as one month before, I did a memory leak analysis
using VLD.
So, I deleted the file and now everything compiles fine at 64bits!
I had to install the Visual C++ for Desktop Development.
Open Visual Studio Installer and go to Installed tab. Click on the Change Button on your installed Visual Studio Community Edition. -> On the Workloads Tab there should be a option Desktop Development with C++. Activate that option and modify the changes.
Afterwards it was working for me.
I had the same problem today. As it turned out somehow the SDK 10.0.15063.0 got installed on my system but without the Desktop C++ files. Selecting the SDK in the list of installed programs, doing a change install and there selecting the Desktop C++ options added the necessary files and now I can link again.
I got this error fatal error lnk1104: cannot open file 'kernel32.lib'.
this error is getting because there is no path in VC++ directories.
To solve this probelem
open visual studio 2008
go to Tools-options-Projects and Solutions-VC++ directories-*
then at right corner select Library files
here you need to add path of kernel132.lib
In my case It is C:\Program Files\Microsoft SDKs\Windows\v6.0A\Lib
Thank you.
I had this following upgrade of some projects from VS2013 to VS2017.
Original project had a manual modification to the "Library Directories" item under VC++ Directories in the project settings.
This meant it did not pick up changes from the upgrade.
Using the option will reset this to something that works (assuming the SDK is installed OK) provided anything other than the default is not needed of course. In my case it was trying to point at the v7.1 SDK but that was not installed for vs2017.
in vs 2019, just run the installer, click modify, and then in the individual components tab, remove windows 10 SDK. then again run the installer and add windows 10 sdk!
I had this similar problem today with Visual Studio 2017. My cause turned out to be a bad environment setting in NETFXSDKDir, specifically:
NETFXSDKDir=C:\Program Files (x86)\Windows Kits\NETFXSDK\4.6.1
It needed to have a value of:
C:\Program Files (x86)\Windows Kits\10\Lib\10.0.10240.0\um\x86
I have a more detailed response here:
fatal error LNK1104: cannot open file 'kernel32.lib'
In VS 2022 I was trying to compile an old solution that originally ran in VS 2010 then in VS 2019. It continually gave me the "cannot find Kernel32.lib" error. I spent 8 hours trying everything, including everything on this page. What worked for me: Configuration Properties -> VC++ Directories -> Library Directories and "inherit from parent" (guessing this sets to defaults) fixed this for me. Also note: I'm using winsock and directinput.

Visual Studio Team Services build server in Azure

I am trying to create a custom build server for Visual Studio Team Services in Azure. I have installed the build agent and Visual Studio Express on a virtual machine which is running and connected to my project on visualstudio.com as a build agent in the "Default" pool.
However when I tried to run a build I got the following error:
No agent found in pool 1 which satisfies the specified demands:
msbuild
visualstudio
vstest
Agent.Version -gtVersion 1.98.1
MSBuild was already in the list of capabilities on visualstudio.com but not the other two, so I dug through C:\Program Files (x86) and added these two capabilities to the list:
vstest: C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\CommonExtensions\Microsoft\TestWindow
visualstudio: C:\Program Files (x86)\Microsoft Visual Studio 14.0
The build then runs at least but I get another error during the "Test Assemblies" step. I think the most important part of the error message is Unable to determine the location of vstest.console.exe, here it is in full anyway:
System.Management.Automation.CmdletInvocationException: Unable to determine the location of vstest.console.exe ---> System.IO.FileNotFoundException: Unable to determine the location of vstest.console.exe
at Microsoft.TeamFoundation.DistributedTask.Task.Internal.PowerShell.InvokeVSTestCmdlet.GetVsTestLocation()
at Microsoft.TeamFoundation.DistributedTask.Task.Internal.PowerShell.InvokeVSTestCmdlet.ProcessRecord()
at System.Management.Automation.CommandProcessor.ProcessRecord()
--- End of inner exception stack trace ---
at System.Management.Automation.Runspaces.PipelineBase.Invoke(IEnumerable input)
at System.Management.Automation.PowerShell.Worker.ConstructPipelineAndDoWork(Runspace rs, Boolean performSyncInvoke)
at System.Management.Automation.PowerShell.Worker.CreateRunspaceIfNeededAndDoWork(Runspace rsToUse, Boolean isSync)
at System.Management.Automation.PowerShell.CoreInvokeHelper[TInput,TOutput](PSDataCollection`1 input, PSDataCollection`1 output, PSInvocationSettings settings)
at System.Management.Automation.PowerShell.CoreInvoke[TInput,TOutput](PSDataCollection`1 input, PSDataCollection`1 output, PSInvocationSettings settings)
at Microsoft.TeamFoundation.DistributedTask.Handlers.PowerShellHandler.Execute(ITaskContext context, CancellationToken cancellationToken, Int32 timeoutInMinutes)
at Microsoft.TeamFoundation.DistributedTask.Worker.JobRunner.RunTask(ITaskContext context, TaskWrapper task, CancellationTokenSource tokenSource)
I have looked and vstest.console.exe is located in the vstest folder I specified above, I've also tried adding this folder to the system PATH but that makes no difference.
How can I set up a working build agent in Azure?
Visual Studio Express doesn't have the testing tools. Install Visual Studio Community (assuming you qualify for Community based on the licensing terms), or a Visual Studio edition (professional/enterprise) for which you or your organization is licensed.
In TFS Build Logs under Test Assemblies I see the error:
System.Management.Automation.CmdletInvocationException: Unable to determine the location of vstest.console.exe
I had VSTest set as Visual Studio 2015, I'm using VS/TFS2017 so switching to Latest solved the problem:
You'll want to install Visual Studio on your build server. At that point, the build agent will recognize the capabilities available like msbuild, visualstudio, and vstest.
I found a solution, you just have to convince your build machine that it does actually have VS installed. From the link:
What worked for me was to create the following registry key:
HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\14.0
and within that key, create a new value of type string with name
ShellFolder and value C:\Program Files (x86)\Microsoft Visual Studio
14.0.
Hope it helps

VS 2012 not starting

I tried to start my Visual Studio 2012 Professional as every day.
Out of nothing, it will not start anymore.
Already googled around but can't find a solution that realy solves my problem.
If possible I would like not reinstallin Visual Studio completely.
Some facts I already figured out:
I did not install any new packages/updates since yesterday
It starts with devenv.exe /SafeMode
It does not start with devenv.exe /ResetSettings
Starting with devenv.exe /Log will fail, but it shows the following:
Could not load file or assembly 'Microsoft.VisualStudio.SmartDevice.ProjectSystem.Base.dll' or one of its dependencies. The system cannot find the file specified.
C:\PROGRAM FILES (X86)\MICROSOFT VISUAL STUDIO 11.0\COMMON7\IDE\COMMONEXTENSIONS\MICROSOFT\TESTWINDOW......\PrivateAssemblies\Microsoft.VisualStudio.SmartDevice.ProjectSystem.Base.dll
The file mentioned is locally not existing. At my colleagues computer this file also not exists but Visual Studio is running normally.
I'm currently running sfc /scannnow in case any system-files are somehow corrupted. (Nothing found)
Any ideas what I can do next to find the issue?
Plugins/Extensions installed:
ReSharper 7
GitExtensions
Update:
Repairing ReSharper through Programs and Features seems to fix the problem. After restarting same error occurs

Visual Studio 2012 won't start

I installed VS2012 Premium from our MSDN subscription and it was working fine the first couple of days but then I installed a few extensions I can't now start VS2012 and it gives the error:
Faulting application name: devenv.exe, version: 11.0.50727.1, time stamp: 0x5011ecaa
Faulting module name: ntdll.dll, version: 6.1.7601.17725, time stamp: 0x4ec49b8f
Exception code: 0xc0000374
Fault offset: 0x000ce6c3
Faulting process id: 0xee8
Faulting application start time: 0x01cd89bb777fc1dd
Faulting application path: C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\devenv.exe
Faulting module path: C:\Windows\SysWOW64\ntdll.dll
I'm running it on Windows 7 64 bit.
I've tried to repair, uninstall and install again and nothing. I tried to restore to a previous restore system point but nothing.
The extensions I installed I can remember:
VS10x Code Map
VSCommands
Visual SVN
Nuget manager
(all the above my colleagues have it too and it works fine for them) and:
Web Essentials
Visual Studio Color Theme Editor
SlowCheetah
Mobile Ready HTML5
Questions are:
Anyone else has had this problem?
Is there a way I can uninstall extensions from a command line or software? (I removed the extensions folder but that doesn't do
anything)
Can I repair the "C:\Windows\SysWOW64\ntdll.dll"? Is it really a problem with this dll?
I haven't been able to find any similar issue in other versions and because VS2012 is new doesn't seem to be much information either.
It is working now!. This is what I did:
Following the suggestion here:
Removed the key: [HKEY_CURRENT_USER\Software\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers]. VS2012 loading but then crashing before I could do anything else (error in C:\Windows\syswow64\KERNELBASE.dll)
Then I removed:
[HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\11.0]
[HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\11.0_Config]
and started again and is working fine.
I obviously lost all my settings but no big deal as I can now do some work! :)
Running devenv.exe with the /SafeMode argument would probably have also fixed it.
I opened a different .sln and then went back to my faulting project and it loaded! Maybe something with a faulty close-down of the project
Removing all VS settings is a bit harsh unless all visual studio instances crash immediately.
What probably happens when you encounter this is that Visual Studio opens the designer window that caused it to crash in the first place... this is often an extension, but it might also just be a bug in VS. For example: I sometimes experience this when working with LINQ-TO-SQL and have the database-schema designer open.
The easiest resolution is to simply remove the SUO file with the solution settings, and open the SLN. You can then do whatever you want, except go to the file with the issue- once you know what that file is, you can fix it (f.ex. in the case of a DBML by simply removing it and regenerating it)
Just copy all dte*.olb files, from C:\Program Files (X86)\Common
Files\Microsoft Shared\MSEnv to C:\Program Files X86\Microsoft Visual
Studio 9.0\Common7\IDE.
From https://mycodepad.wordpress.com/2013/12/07/visual-studio-2012-4-run-as-administrator-the-application-cannot-start-error/
Simply running as Administrator seemed to be enough to get it running for me, at least temporarily.
I had a similar ntdll.dll issue ... C++ updating SQL Server ...
I fixed it by using the SQL Server OBDC connection rather than the SQL Server Native Client 11.0
We're trying to see why as it is working for some updates and not others ... but it works all the time for reading.
All the above solutions didn't work for me, but this one work.
Copy dte*.olb from C:\Program Files (X86)\Common Files\Microsoft Shared\MSEnv to
C:\Program Files X86\Microsoft Visual Studio 9.0\Common7\IDE.
http://www.clausconrad.com/blog/the-application-cannot-start-running-visual-studio-as-administrator
First launch devenv.exe with the /SafeMode option, then Uncheck the Allow macros to run from "Enviroment->Add-in/Macros Security" and test!
The problem is due to path variable. setting path variable in Environmental variables to below 2048 characters worked for me.

Resources