SwipeRefreshLayout does not exist on Visual Studio + Xamarin - c#

I have a problem when I'm trying to run my program on my phone. I'm using Visual Studio 2015 and Xamarin for developing android app. I got this error :
error: package android.support.v4.widget.SwipeRefreshLayout does not exist
android.support.v4.widget.SwipeRefreshLayout.OnRefreshListener
Here is my References Pic, I already added Xamarin.Android.Support.V4 and Xamarin.Android.Support.V13 and this is my SDK Manager Pic
Does anyone see anything that I missed?

A downloaded package (zip file) from Google is truncated/corrupt and does not inflate properly can cause this.
Try:
Remove the Nuget package and re-add it. Perform a clean all/build all on your solution
Otherwise:
Check the following location:
C:\Users\[YourUserID]\AppData\Local\Xamarin\Android.Support.v4\[Version])
You can delete those files, restart Visual Studio and perform a clean all/build all on your solution and those support files will be downloaded and cached from Google again.

Related

UWP: Package is not getting generated with error

I have a about 2 yr old in UWP that we are successfully compile and creating package until Visual Studio 16.9. But yesterday I update my Visual Studio to 16.10 and now whenever I try to create a package I got following error
Severity Code Description Project File Line Suppression State
Error System.Runtime.InteropServices.COMException (0x80070716): The
specified resource name cannot be found in the image file. (Exception
from HRESULT: 0x80070716) at
Microsoft.VisualStudio.Deployment.AppxFactory.CreatePackageReader(IStream
inputStream) at
Microsoft.VisualStudio.Deployment.AppxInteropHelpers.GetAppxManifestReader3(String
appxFilePath) at
Microsoft.Build.AppxPackage.AppxPackageFile.ReadAppxPackageFile()
at
Microsoft.Build.AppxPackage.GenerateAppInstallerFile.AddPackageDependencies(XElement
dependenciesRoot) at
Microsoft.Build.AppxPackage.GenerateAppInstallerFile.AddDependenciesIfNecessary(XElement
element) at
Microsoft.Build.AppxPackage.GenerateAppInstallerFile.CreateAppInstallerFile(String
uri, Boolean addOnLaunchUpdateCheck) at
Microsoft.Build.AppxPackage.GenerateAppInstallerFile.ExecuteImplementation() Package C:\Program
Files (x86)\Microsoft Visual
Studio\2019\Community\MSBuild\Microsoft\VisualStudio\v16.0\AppxPackage\Microsoft.AppXPackage.Targets 6362
I initially thought that installation of VS is corrupted, so I try to reinstall but it was not the case. My application is working fine in debugger mode. But when I try to create package it fails. I can however able to create package if I change my Windows SDK Target to latest 2004 but then when I run the application from Installed version on test machine it crash after Splash Screen i.e. my AppShell do not load.
When searching that error in google it shows that some windows back service has this issue. No reference is found for UWP Package in this regard. I am not sure if some image file is missing from package or application or if some system "Image" is missing as in packaging of application.
Any help is appreciated thanks.
EDIT: After I run DSIM to restore windows image it create it once, but only once.
EDIT 2: I found an old machine with Visual studio 16.7.4 and it compile same exact code without any modification just fine. So either the Visual studio update or Windows update (it happens to be my machine get updated to 21h1 today only) with and I didn't realise as I have automatic update enable.

Nuget package update - Microsoft.Data.SqlClient.SNI.x64

when restoring a locally created nuget package I receive the following error:
Failed to add reference to 'Microsoft.Data.SqlClient.SNI.x64'.
Please make sure that the file is accessible, and that it is a valid assembly or COM component
When I look at the nuget build I see the following
click to enlarge
The highlighted yellow "missing" dlls in the screenshot above do actually exist in the project.
I am using Visual Studio 2017 professional
Thanks for any help
Mark
Nuget package update - Microsoft.Data.SqlClient.SNI.x64
Please try the following steps:
1) close VS Instance, delete nuget.config file under C:\Users\xxx(current use account)\AppData\Roaming\NuGet.
2) delete .vs hidden folder under your solution folder, bin and obj folder then restart your project to test again.
3) Please try to create a new empty project in VS2019 and test whether you can install the package Microsoft.Data.SqlClient.
If you cannot install it, you should note that whether your VS or OS has broken. If the new project has no error, the issue is your project itself. You can try the above steps to troubleshoot the issue.
If the issue still persists in the new project,
You can try to repair VS or update VS to the latest version.
Also, try to update OS or use the System File Checker tool to repair missing or corrupted system files.
Besides, try another PC to test whether the issue persists.
Microsoft.Data.SqlClient.SNI.X64 or X32 files need to be removed from release folder before creating package.
Microsoft.Data.SqlClient.SNI.X64 will be added automatically while adding Microsoft.Data.SqlClient.
So, remove the dll before creating the package and then try installing it.

Visual Studio Build Error: The target "MainResourceGeneration" does not exist in the project

Getting the following error 'The target "MainResourceGeneration" does not exist in the project' on Any project I try to build with Visual Studio. Cannot run debugger, cannot build/rebuild solution or projects.
Backing up a bit:
I had VS2012 and VS2017 (always used 2017) installed.
Got an error that pointed me to the Microsoft.Common.CurrentVersion.targets file. I mistakenly edited this file thinking it was part of my project.
Started getting the aforementioned build error on all my projects. Including simple, brand new, unaltered C# .NET framework console app.
Also had the same error on VS2012...
Tried VS2017 repair.
Tried VS2017 uninstall/reinstall.
Tried uninstall VS2017/2012, manually delete visual studio program files folders, reinstall 2017.
Still have the problem. Brand new fresh VS2017 install and not even a new console app will build.
Build output just shows this...
C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\15.0\Bin\Microsoft.Common.CurrentVersion.targets(2789,7): error MSB4057: The target "MainResourcesGeneration" does not exist in the project.
Visual Studio Build Error: The target “MainResourceGeneration” does not exist in the project
Since this issue still occurs on a new console app, it seems that the Visual Studio installation file is corrupted. You can try to following steps to clean up the Visual Studio and reinstall it:
See if you have this file on your machine:
"%programfiles(x86)%\Microsoft Visual
Studio\Installer\resources\app\layout\InstallCleanup.exe"
Start an admin command prompt
Right-click on cmd.exe and select Run AsAdministrator
If so, please launch it from an admin command prompt with a -full
param
InstallCleanup.exe -full 
If not, please manually delete the "%programfiles(x86)%\Microsoft
Visual Studio\Installer” folder
Verify that your initial install location for VS is removed.  If it
is not, delete it manually.
Relaunch the newly downloaded vs_enterprise.exe (or
vs_professional.exe or vs_community.exe…)
Allow the first step to install the installer  Once the installer
comes up and you can see workload choices (.net desktop and the
like), close it
Go launch the same InstallCleanup.exe to clean up old build of VS
Then relaunch vs_enterprise.exe and install VS
Please let me know if it works for you.
I tried several further steps like manually deleting Visual Studio related folders in my Users and ProgramData directories, and repairing .NET framework. None of those changes worked. Still had the same issue.
As a last resort I fully uninstalled .NET Framework (4.7.1) and grabbed the latest version (4.7.2) from https://www.microsoft.com/net/download/dotnet-framework-runtime. I no longer received the error and could then build my projects again.
I do not know or understand the root cause, but a full uninstall/reinstall of .NET framework fixed it...

Xamarin forms (Visual Studio) - Error while loading project after updating to Xamarin and jdk 1.8

After updating Xamarin for Visual Studio to v'4.3.0.789' and jdk 1.8. I am getting this error. I have tried all possible way but unable to resolve.
Severity Code Description Project File Line Suppression State
Error An error occurred trying to install required android components
on Project 'CrossPlatformApp2.Android'. Project
'CrossPlatformApp2.Android' requires the following components
installed on your machine: Xamarin.Android.Support.v7.AppCompat
JavaLibraryReference:
https://dl-ssl.google.com/android/repository/android_m2repository_r29.zip-m2repository/com/android/support/appcompat-v7/23.3.0/appcompat-v7-23.3.0.aar-23.3.0.0
AndroidResources:
https://dl-ssl.google.com/android/repository/android_m2repository_r29.zip-m2repository/com/android/support/appcompat-v7/23.3.0/appcompat-v7-23.3.0.aar-23.3.0.0
Xamarin.Android.Support.v7.MediaRouter JavaLibraryReference:
https://dl-ssl.google.com/android/repository/android_m2repository_r29.zip-m2repository/com/android/support/mediarouter-v7/23.3.0/mediarouter-v7-23.3.0.aar-23.3.0.0
JavaLibraryReference:
https://dl-ssl.google.com/android/repository/android_m2repository_r29.zip-m2repository/com/android/support/mediarouter-v7/23.3.0/mediarouter-v7-23.3.0.aar-23.3.0.0
AndroidResources:
https://dl-ssl.google.com/android/repository/android_m2repository_r29.zip-m2repository/com/android/support/mediarouter-v7/23.3.0/mediarouter-v7-23.3.0.aar-23.3.0.0
Please double-click here to install it.
Intallation Errors: XA5209 Unzipping failed. Please download
'https://dl-ssl.google.com/android/repository/android_m2repository_r29.zip:m2repository/com/android/support/appcompat-v7/23.3.0/appcompat-v7-23.3.0.aar'
and extract it to the
'C:\Users\prashantvarma\AppData\Local\Xamarin\Xamarin.Android.Support.v7.AppCompat\23.3.0.0\embedded'
directory XA5209 Reason: The process cannot access the file
'C:\Users\prashantvarma\AppData\Local\Xamarin\Xamarin.Android.Support.v7.AppCompat\23.3.0.0\embedded\res\drawable-xxhdpi-v4'
because it is being used by another process. XA5207 Please install
package: 'Xamarin.Android.Support.v7.AppCompat' available in SDK
installer. Java library file 'C:\Program Files
(x86)\Android\android-sdk\extras\android\classes.jar' doesn't exist.
XA5207 Please install package:
'Xamarin.Android.Support.v7.MediaRouter' available in SDK installer.
Java library file 'C:\Program Files
(x86)\Android\android-sdk\extras\android\classes.jar' doesn't exist.
XA5207 Please install package:
'Xamarin.Android.Support.v7.MediaRouter' available in SDK installer.
Java library file 'C:\Program Files
(x86)\Android\android-sdk\extras\android\libs/internal_impl-23.3.0.jar'
doesn't exist. 0
However, my old application (created in old Xamarin version) is able to run.
I used to have this error as well. Try the underlying fix I wrote and use myself.
If you get multiple errors when trying to build the project (e.g. ~14 errors) which state that the unzipping of packages failed and that you will have to do it manually, then do the following:
Go to the path stated in the error
Go a folder (or 2) higher until you see a folder called "zips".
Delete all the content in that (“zips”) folder and retry building.
The build will take a bit longer, so have some patience.
This error is caused by a corrupted zip of a needed package in the build, mostly caused by aborting a build. Deleting the files will force the compiler to redownload the packages which will fix the corrupted zips issue.
Ok, I am able to resolve this issue simply by uninstalling Xamarin and installing again the older version (v4.2.1) that shows in Visual studio Professional 2015 Setup.

Xamarin.Droid: Resource.Designer.cs broken after update

I'm using Xamarin for Android and I'm using the support libraries. The project work fine, but after updating the support repositories from 23.1.1.1 to 23.3.0, the Resource.Designer.cs is broken.
Note: I did delete the file, I did a complete rebuild with manually deleting the obj and bin folders and I made shure all of my Android packages are up to date (Android SDK Manager).
The errors are all part of the public static void UpdateIdValues() function all basically all look like this:
'Resource.Color' does not contain a definition for 'design_textinput_error_color'
With the code:
global::Acr.UserDialogs.Resource.Color.design_textinput_error_color = global::EVM.Droid.Resource.Color.design_textinput_error_color;
Any Idea, where this error is coming from and how to fix it? Thanks for your help.
Same issue, with visual studio comunity 2015, it seems to be a version problem, this was an old resorce definition, that now has been substituted with _dark and _light. At the moment to solve I've added the missed values copying them from the dark version. Seems that Xamarin includes some old version (e.g API 22) instead of the latest one (API 23)
Flavio
[EDIT]
Find another quick solution, from nuGet package manager of the .droid project remove ALL the installed packages, then add the latest available release of xamarin related (I've user power shell adding them one by one in order of dependency from the nuget page of xamarin https://www.nuget.org/packages/Xamarin.Forms/)
Build all...and this does the trick!

Categories

Resources