Can't Compile/Run Android App With Google Maps / Xamarin Maps

I'm trying to do the most basic thing. I just want to create a Xamarin Forms solution that imports the Google/Xamarin maps NuGet packages. All I did was create a new solution with the Visual Studio template, and then add the Maps components through the NuGet package manager.

Can someone please look at my solution and tell me why it won't compile? I've been trying for about 3 days straight to get our Android app to compile and run again.

Git repo: https://[email protected]/ChristianFindlay/xamarin-forms-scratch.git
Solution: xamarin-forms-scratch\Other\Xivic.sln

I get these compilation errors:
Severity Code Description Project File Line Suppression State
Error Build action 'EmbeddedResource' is not supported by one or more of the project's targets. Xivic C:\GitRepos\xamarin-forms-scratch\Other\Xivic\Xivic\App.xaml 0
Error Build action 'EmbeddedResource' is not supported by one or more of the project's targets. Xivic C:\GitRepos\xamarin-forms-scratch\Other\Xivic\Xivic\MainPage.xaml 0
Error Error: No resource found that matches the given name: attr 'colorPrimary'. Xivic.Android C:\GitRepos\xamarin-forms-scratch\Other\Xivic\Xivic.Android\Resources\values\styles.xml 2
Error Error: No resource found that matches the given name: attr 'colorPrimaryDark'. Xivic.Android C:\GitRepos\xamarin-forms-scratch\Other\Xivic\Xivic.Android\Resources\values\styles.xml 2
Error Error retrieving parent for item: No resource found that matches the given name 'Theme.AppCompat.Light.DarkActionBar'. Xivic.Android C:\GitRepos\xamarin-forms-scratch\Other\Xivic\Xivic.Android\Resources\values\styles.xml 2
Error Error: No resource found that matches the given name: attr 'windowNoTitle'. Xivic.Android C:\GitRepos\xamarin-forms-scratch\Other\Xivic\Xivic.Android\Resources\values\styles.xml 2
Error Error: No resource found that matches the given name: attr 'windowActionBar'. Xivic.Android C:\GitRepos\xamarin-forms-scratch\Other\Xivic\Xivic.Android\Resources\values\styles.xml 2
Error Error: No resource found that matches the given name: attr 'colorAccent'. Xivic.Android C:\GitRepos\xamarin-forms-scratch\Other\Xivic\Xivic.Android\Resources\values\styles.xml 3
Error Error: No resource found that matches the given name: attr 'colorAccent'. Xivic.Android C:\GitRepos\xamarin-forms-scratch\Other\Xivic\Xivic.Android\Resources\values\styles.xml 4
Error Error retrieving parent for item: No resource found that matches the given name 'Theme.AppCompat.Light.Dialog'. Xivic.Android C:\GitRepos\xamarin-forms-scratch\Other\Xivic\Xivic.Android\Resources\values\styles.xml 4
Error Error: No resource found that matches the given name: attr 'windowActionModeOverlay'. Xivic.Android C:\GitRepos\xamarin-forms-scratch\Other\Xivic\Xivic.Android\Resources\values\styles.xml 4

Answers

  • cwphillicwphilli USMember ✭✭✭
    edited May 2017

    I switched content types on the properties windows for the XAML pages to Content and then back to Embedded Resource and re-compiled, resulted in generated changes in the project file which allowed the project to compile successfully:

    I'm not sure if this will have impact on your ability to view designer files as I did not investigate further after compiling successfully.

  • MelbourneDeveloperMelbourneDeveloper AUMember ✭✭✭

    Thanks, I can see why that would fix your problem. In this case, Visual Studio would drop and recreate the generated code. But, I my case, I have a different problem. In my case, the out-of-the-box standard Xamarin Forms project for Android requires a bunch of resources. But, I don't what those resources are or where I'm supposed to put them.

    I guess, probably what I need is a sample Xamarin Forms with a working copy of Google maps running on Android.

  • cwphillicwphilli USMember ✭✭✭

    @MelbourneDeveloper said:
    Thanks, I can see why that would fix your problem. In this case, Visual Studio would drop and recreate the generated code. But, I my case, I have a different problem. In my case, the out-of-the-box standard Xamarin Forms project for Android requires a bunch of resources. But, I don't what those resources are or where I'm supposed to put them.

    I guess, probably what I need is a sample Xamarin Forms with a working copy of Google maps running on Android.

    When I posted my response before, it was after getting your code from BitBucket and performing the change directly.
    That screenshot is a git diff between you're actual .csproj file after I performed the changes :)

  • MelbourneDeveloperMelbourneDeveloper AUMember ✭✭✭

    @cwphilli said:
    When I posted my response before, it was after getting your code from BitBucket and performing the change directly.
    That screenshot is a git diff between you're actual .csproj file after I performed the changes :)

    Sorry! Thanks, I should have put two and two together that you had grabbed my repo.

    I tried the step that you recommended, but it didn't result in the changed csproj file. So, I manually removed the lines that you pointed out and voilà!

    Your answer led to me being able to fix the problem. However, it seems to me that this is a whopping bug somewhere in Xamarin, Visual Studio, or the compiler, or something...

    Why did it give me so many misleading errors?

    I did another Git clean, and rolled back to the previous revision with the SubType=Designer tag, and this is what I get:

    The secret really was removing these:

    I looked up this tag in the csproj. This is the documentation:
    https://msdn.microsoft.com/en-us/library/aa984495(v=vs.71).aspx

    I think the Xamarin Team probably needs to look at this. It seems like using the designer on XAML pages screws up Android builds.

  • MelbourneDeveloperMelbourneDeveloper AUMember ✭✭✭

    I've logged a bug with the Xamarin Android team here. Please comment on the bug so that they do something about it:

    https://bugzilla.xamarin.com/show_bug.cgi?id=56984

  • cwphillicwphilli USMember ✭✭✭

    @MelbourneDeveloper I'm glad that answer was able to resolve your issue.
    I've additionally commented there, hope that you find the additional information in the bug report :smile:

  • MelbourneDeveloperMelbourneDeveloper AUMember ✭✭✭
    edited June 2017

    Thanks. Yes, I agree, but also, half the problem is that the IDE should validate the csproj file and complain if the lines are there. I don't know how the tags snuck in (through the IDE, or some other means), but the point is, once they're there, it's impossible to know why the app won't compile.

    I've added this comment to the bug:

    Yes, but the problem isn't so much that the extra lines get added through the IDE, the problem is that if they are there, seemingly random compilation error messages appear. If the tags are invalid for the project type, Visual Studio should validate the project file and complain with a useful error message. Perhaps something along the lines of "Designer is an invalid SubType for a Xamarin Forms XAML file as an EmbeddedResource."

Sign In or Register to comment.