miken.mkndev miken.mkndev - 1 year ago 153
Android Question

Xamarin.Android upgrade to API 24

I have an existing Xamarin.Android application that I built to support up to API 19 a few years back. I now want to update the codebase to support API 24 and running into a whirlwind of problems.

I have updated all packages and components in my codebase so that they are all on the latest and greatest. Now when I do a compile I get several hundred errors complaining that attributes in the Resources.designer.cs file are not defined. Below is an example of just one of these compilation errors.

[PATH_TO_PROJECT]/Resources/Resource.designer.cs(98,98): Error CS0117: `[PROJECT_NAMESPACE].Resource.Attribute' does not contain a definition for `barSize' (CS0117) ([PROJECT])

This line within the Resource.designer.cs file is highlighted as an error.

global::GooglePlayServices.Resource.Attribute.barSize = global::[PROJECT_NAMESPACE].Resource.Attribute.barSize;

The vast majority of these issues seem to be coming from some linking between my styles and Google Play Services. I have updated all of my GPS packages to the latest, and I still have these errors.

I have also made sure to delete all existing "bin" and "obj" folders within my app codebase as well as everything from the
~/.local/share folder

Does anyone have any idea how to help me resolve these issues? I'm worried Nougat doesn't support the
theme and will have todo a full Theme redesign :(


-- EDIT --

Here is the content of my packages.config file.

<?xml version="1.0" encoding="utf-8"?>
<package id="AWS-Mobile-SDK-Xamarin-Beta" version="4.1.0" targetFramework="MonoAndroid44" />
<package id="Humanizer" version="1.37.7" targetFramework="monoandroid70" />
<package id="Newtonsoft.Json" version="7.0.1" targetFramework="monoandroid70" />
<package id="sqlite-net" version="1.0.8" targetFramework="MonoAndroid44" />
<package id="Xamarin.Android.Support.Animated.Vector.Drawable" version="24.2.1" targetFramework="monoandroid70" />
<package id="Xamarin.Android.Support.Compat" version="24.2.1" targetFramework="monoandroid70" />
<package id="Xamarin.Android.Support.Core.UI" version="24.2.1" targetFramework="monoandroid70" />
<package id="Xamarin.Android.Support.Core.Utils" version="24.2.1" targetFramework="monoandroid70" />
<package id="Xamarin.Android.Support.Fragment" version="24.2.1" targetFramework="monoandroid70" />
<package id="Xamarin.Android.Support.Media.Compat" version="24.2.1" targetFramework="monoandroid70" />
<package id="Xamarin.Android.Support.v4" version="24.2.1" targetFramework="monoandroid70" />
<package id="Xamarin.Android.Support.v7.AppCompat" version="24.2.1" targetFramework="monoandroid70" />
<package id="Xamarin.Android.Support.v7.MediaRouter" version="24.2.1" targetFramework="monoandroid70" />
<package id="Xamarin.Android.Support.v7.Palette" version="24.2.1" targetFramework="monoandroid70" />
<package id="Xamarin.Android.Support.Vector.Drawable" version="24.2.1" targetFramework="monoandroid70" />
<package id="Xamarin.GooglePlayServices.Ads" version="" targetFramework="monoandroid70" />
<package id="Xamarin.GooglePlayServices.Base" version="" targetFramework="monoandroid70" />
<package id="Xamarin.GooglePlayServices.Basement" version="" targetFramework="monoandroid70" />
<package id="Xamarin.GooglePlayServices.Gcm" version="" targetFramework="monoandroid70" />
<package id="Xamarin.GooglePlayServices.Location" version="" targetFramework="monoandroid70" />
<package id="Xamarin.GooglePlayServices.Maps" version="" targetFramework="monoandroid70" />
<package id="Xamarin.GooglePlayServices.Measurement" version="" targetFramework="monoandroid70" />
<package id="Xamarin.Insights" version="" targetFramework="monoandroid70" />

Answer Source

I finally found what was causing the errors. There were some cached package files being stored in a "Shared" library that I have in my application codebase that I didn't know were there. There were also some cached package files in the directory "~/.local/share/Xamarin" that had to be removed also. I also had to update all of my Xamarin.Android packages to the latest versions as well as all of the Android SDK and tools. Once I did all of this it worked.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download