Reputation: 17432
I have VS Mac 2022
with xamarin.forms
project and android
project is set as startup.
When I want to run the app
there is no Run
button only Hammer icon showing up in VS at top left corner. I am not sure what's going wrong here.
This is android project android
configuration file
.
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<OutputType>Library</OutputType>
<RootNamespace>s_Order.Droid</RootNamespace>
<AndroidApplication>True</AndroidApplication>
<TargetFrameworkVersion>v11.0</TargetFrameworkVersion>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>portable</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug</OutputPath>
<DefineConstants>DEBUG;</DefineConstants>
<AndroidLinkMode>None</AndroidLinkMode>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release</OutputPath>
<AndroidManagedSymbols>true</AndroidManagedSymbols>
<AndroidUseSharedRuntime>false</AndroidUseSharedRuntime>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\Debug</OutputPath>
<DefineConstants>DEBUG;</DefineConstants>
<DebugType>portable</DebugType>
<PlatformTarget>x86</PlatformTarget>
<GenerateSerializationAssemblies>Off</GenerateSerializationAssemblies>
<TreatWarningsAsErrors>false</TreatWarningsAsErrors>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
<IntermediateOutputPath></IntermediateOutputPath>
<ConsolePause>true</ConsolePause>
<ExternalConsole>false</ExternalConsole>
<Commandlineparameters></Commandlineparameters>
<RunWithWarnings>true</RunWithWarnings>
<AndroidManagedSymbols>false</AndroidManagedSymbols>
<MandroidExtraArgs></MandroidExtraArgs>
<AndroidCreatePackagePerAbi>false</AndroidCreatePackagePerAbi>
<BundleAssemblies></BundleAssemblies>
<AndroidEnableProfiledAot>false</AndroidEnableProfiledAot>
<EnableLLVM>false</EnableLLVM>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\Release</OutputPath>
<Optimize>true</Optimize>
<DebugType>pdbonly</DebugType>
<PlatformTarget>x86</PlatformTarget>
<GenerateSerializationAssemblies>Off</GenerateSerializationAssemblies>
<ExternalConsole>false</ExternalConsole>
<AotAssemblies></AotAssemblies>
<AndroidEnableProfiledAot>false</AndroidEnableProfiledAot>
<EnableLLVM>false</EnableLLVM>
<EmbedAssembliesIntoApk></EmbedAssembliesIntoApk>
</PropertyGroup>
</Project>
Please check below screenshot
Below is compiler options for android
How can I fix this ?
Upvotes: 1
Views: 404
Reputation: 47967
Adding the project type guids and the android manifest to the first property group seems to fix the problem. The main toolbar in Visual Studio for Mac shows the run arrow icon instead of the hammer icon when this is done:
<ProjectTypeGuids>{EFBA0AD7-5A72-4C68-AF49-83D382785DCF};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<AndroidManifest>Properties\AndroidManifest.xml</AndroidManifest>
The missing AndroidManifest seems to be the main culprit. Although I had to add the project type guids too - otherwise it seemed to prevent Visual Studio for Mac from allowing the Android project to be set as a startup project.
Upvotes: 1