Recent articles


Error occurred while installing package Xamarin.Android.Support.v4 -Version 26.0.2

Posted by seven.srikanth@gmail.com at 10 Nov 2017 in Errors


The below error occurred while trying to run below command on my Xamarin Project.

Install-Package Xamarin.Android.Support.v4 -Version 26.0.2

Install failed. Rolling back...

Package 'Xamarin.Android.Support.v4.26.0.2' does not exist in project 'FrameAnimation'

Package 'Xamarin.Android.Support.v4.26.0.2' does not exist in folder 'C:\Users\Srikanth\Documents\Visual Studio 2017\Projects\FrameAnimation\packages'

Executing nuget actions took 384.71 ms

Install-Package : Could not install package 'Xamarin.Android.Support.v4 26.0.2'. You are trying to install this package into a 

project that targets 'MonoAndroid,Version=v7.1', but the package does not contain any assembly references or content files 

that are compatible with that framework. For more information, contact the package author.

At line:1 char:1

+ Install-Package Xamarin.Android.Support.v4 -Version 26.0.2

+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    + CategoryInfo          : NotSpecified: (:) [Install-Package], Exception

    + FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PackageManagement.PowerShellCmdlets.InstallPackageCommand

 

Fix:

Steps to Fix this issue:

1) Go to tools -> Android -> Android SDK Manager.

2) Install Android 8.0.0 (APID 26) SDK Platform. If already installed go to next step.

3) Go to Application properties and Set Compile using Android version: (target Framework) to Android 8.0 (Oreo).

4) Close and Open the app once again.

5) Now try to install the Package. It will install fine.


Tags: Xamarin.Android.Support.v4 -Version 26.0.2




Installing Xamarin - 1) Up and running on your computer with Xamarin

Posted by reach2prakash@gmail.com at 09 Nov 2017 in Article


Just wanted to share some quick information to help those who are looking to get started with Xamarin on their computer.

Xamarin enables developers to leverage C# or .NET skills to create native mobile apps for iOS, Android, Mac and Windows.

Follow the steps below to get started:

*)Computer pre-reqs: intel or AMD with CPU i3 and above works great.

*)Disk Space: Your OS Drive(C:) should have a minimum of 30GB freespace. You may choose the install location to other drive than OS but note that the Visual studio still copies its libraries and associated files to the OS Drive(C:), therefore a minimum of 20-25 GB required in the OS drive.

*)RAM: 4 GB works ok but preferrably 8GB for efficiency.

*)OS pre-reqs: Windows 7 Service Pack 1 but Windows 10 is preferable.

 

Once you verified that the pre-reqs are met, you can get the installer from https://www.visualstudio.com/downloads/ by choosing one of the options:

Visual Studio Community 2017 - community edition does not require any licence and you can activate the product using Microsoft account.

Visual Studio Professional 2017 - one month trial and require licence to continue using the product.

Visual Studio Enterprise 2017 - one month trial and require licence to continue using the product.

 

Online installation: Usually the downloaded installer is just 1 MB size is it is just the bootstrap and pulls the package from internet on the fly during setup.

Steps:

  • Right click on the downloaded installer vs_community__1458625144.1502876884.exe and run as Administrator.  

  • Agree and Continue.  

  • Page Installing Visual Studio 2017 - 15.4.3 (you will see recent version)  

  • Under Workloads tab - Choose     Mobile development with .NET (Build cross-platform applications for iOS, Android or Windows using Xamarin.)   

Note: Visual Studio allows you to build apps for many platforms, using many technologies, making the download size is significant.   Select just the required components for mobile development if you only develop for mobile platforms. 

  • You would see the Total install size as around 20 GB.

  • Click on Install and continue.  

Note:Installation will take atleast an hour or more than that depending on internet connection.  

  • You may need to reboot the computer to apply changes to complete the installation.

  • Once the installation is complete, start Visual Studio and check for any updates available for Visual Studio, along with Android SDKs (from Tools > Android > Android SDK Manager), etc. Create a new cross-platform app project once all of the updates are installed, Xamarin.Forms for example, and run it on your device or emulator.

  • If you get the app running with a ‘Welcome to Xamarin.Forms’ message, then you have installed Visual Studio with all of the required tools for cross-platform mobile development.

 

Offline Installation:

To do a offline installation, we must download the install packages to a target directory and start installing..

Mobile development with .NET (Build cross-platform applications for iOS, Android or Windows using Xamarin.)

(Note: Visual Studio allows you to build apps for many platforms, using many technologies, making the download size is significant. Select just the required components for mobile development if you only develop for mobile platforms.)

1) Download details:  

To download Xamarin and related components:

C:\>vs_enterprise.exe --layout C:\VS2017 --lang en-US --add Microsoft.VisualStudio.Workload.NetCrossPlat

To download all of the installation components, with the language set to English:

C:\>vs_enterprise.exe --layout C:\VS2017 --lang en-US

This will download the packages to C:\VS2017 and this will be huge in size (usually in excess of 20GB).

Almost every mobile app needs to connect to at least one service, such as ASP.NET MVC WebAPI hosted inside Azure. Additional components are required to build and use such services. To download all the required components:

C:\>vs_enterprise.exe --layout C:\VS2017 --lang en-US --add Microsoft.VisualStudio.Workload.Azure Microsoft.VisualStudio.Workload.ManagedDesktop Microsoft.VisualStudio.Workload.NetCoreTools Microsoft.VisualStudio.Workload.NetCrossPlat Component.Android.NDK.R13B Component.Android.SDK23 Component.Xamarin Component.Xamarin.Inspector Component.Xamarin.Profiler Component.Xamarin.RemotedSimulator Microsoft.VisualStudio.Workload.NetWeb Microsoft.VisualStudio.Workload.Universal

2) Install Certificates Once all of the components are downloaded, look for the certificate folder. Install all of the certificates before you run the installer.

3) Install Visual Studio Now you can run the offline installer from your folder. It will launch and install all of the components you selected.

4) Verify Installation Once the installation is complete, start Visual Studio and check for any updates available for Visual Studio, along with Android SDKs (from Tools > Android > Android SDK Manager), etc.

Create a new cross-platform app project once all of the updates are installed, Xamarin.Forms for example, and run it on your device or emulator. If you get the app running with a ‘Welcome to Xamarin.Forms’ message, then you have installed Visual Studio with all of the required tools for cross-platform mobile development.

That should be it!!  You now have the platform to start developing the mobile apps..

All the best!

 


Tags: Install Xamarin




Error CS0117 'Resource' does not contain a definition for 'anim'

Posted by seven.srikanth@gmail.com at 08 Nov 2017 in Errors


Severity	Code	Description	Project	File	Line	Suppression State
Error	CS0117	'Resource' does not contain a definition for 'anim'	FrameAnimation	C:\Users\Srikanth\Documents\Visual Studio 2017\Projects\FrameAnimation\FrameAnimation\MainActivity.cs	23	Active

Above error occurred while following the frame_animation article,
The fix for this issue is to change the below code. 
Old Code:
  
        public override void OnWindowFocusChanged(bool hasFocus)
        {
            if (hasFocus)
            {
                ImageView imageView = FindViewById(Resource.anim.animated_android);
                AnimationDrawable animation = (AnimationDrawable)imageView.Drawable;
                animation.Start();
            }
        }

Fixed Code:
public override void OnWindowFocusChanged(bool hasFocus)
        {
            if (hasFocus)
            {
                ImageView imageView = FindViewById(Resource.Id.animated_android);
                AnimationDrawable animation = (AnimationDrawable)imageView.Drawable;
                animation.Start();
            }
        }
Thanks, Srikanth

Tags: 'Resource' does not contain a definition for 'anim'