Xamarin in Visual Studio packaging failed | mono-s

2019-07-29 10:21发布

问题:

I'm getting the following error when trying to packaging my Xamarin Android application. The application works perfectly in debug mode on my mobile, now I'm just trying to generate the APK and I get this error message:

Archiving App Bundle 'PoolHeatingClient'...
Creating archive directory 'PoolHeatingClient'...
Creating directory 'C:\Users\entro\AppData\Local\Xamarin\Mono for Android\Archives\2016-10-29\PoolHeatingClient 10-29-16 4.21 PM.apkarchive'...
Deleting files '*.apk'...
Packaging 'PoolHeatingClient'...

The command ""C:\Program Files (x86)\MSBuild\Xamarin\Android\mono-symbolicate" store-symbols "bin\Release\PoolHeatingClient.PoolHeatingClient.apk.mSYM" "obj\Release\android/assets"" exited with code -1073740791.


Failed to create App archive 'PoolHeatingClient'.

I don't know where to start from... Thanks, Michele

Here is my .csproj file:

<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <PropertyGroup>
    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
    <ProductVersion>8.0.30703</ProductVersion>
    <SchemaVersion>2.0</SchemaVersion>
    <ProjectGuid>{43716C55-E6A1-4F1D-8E2E-947AD36C37E3}</ProjectGuid>
    <ProjectTypeGuids>{EFBA0AD7-5A72-4C68-AF49-83D382785DCF};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
    <OutputType>Library</OutputType>
    <AppDesignerFolder>Properties</AppDesignerFolder>
    <RootNamespace>PoolHeatingClient</RootNamespace>
    <AssemblyName>PoolHeatingClient</AssemblyName>
    <FileAlignment>512</FileAlignment>
    <AndroidApplication>true</AndroidApplication>
    <AndroidResgenFile>Resources\Resource.Designer.cs</AndroidResgenFile>
    <GenerateSerializationAssemblies>Off</GenerateSerializationAssemblies>
    <AndroidUseLatestPlatformSdk>True</AndroidUseLatestPlatformSdk>
    <TargetFrameworkVersion>v7.0</TargetFrameworkVersion>
    <AndroidManifest>Properties\AndroidManifest.xml</AndroidManifest>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
    <DebugSymbols>True</DebugSymbols>
    <DebugType>full</DebugType>
    <Optimize>false</Optimize>
    <OutputPath>bin\Debug\</OutputPath>
    <DefineConstants>DEBUG;TRACE</DefineConstants>
    <ErrorReport>prompt</ErrorReport>
    <WarningLevel>4</WarningLevel>
    <AndroidUseSharedRuntime>True</AndroidUseSharedRuntime>
    <AndroidLinkMode>Full</AndroidLinkMode>
    <EmbedAssembliesIntoApk>False</EmbedAssembliesIntoApk>
    <BundleAssemblies>False</BundleAssemblies>
    <AndroidCreatePackagePerAbi>False</AndroidCreatePackagePerAbi>
    <Debugger>Xamarin</Debugger>
    <AotAssemblies>False</AotAssemblies>
    <EnableLLVM>False</EnableLLVM>
    <AndroidEnableMultiDex>False</AndroidEnableMultiDex>
    <EnableProguard>False</EnableProguard>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
    <DebugType>pdbonly</DebugType>
    <DebugSymbols>False</DebugSymbols>
    <AndroidManagedSymbols>true</AndroidManagedSymbols>
    <Optimize>true</Optimize>
    <OutputPath>bin\Release\</OutputPath>
    <DefineConstants>TRACE</DefineConstants>
    <ErrorReport>prompt</ErrorReport>
    <WarningLevel>4</WarningLevel>
    <AndroidUseSharedRuntime>False</AndroidUseSharedRuntime>
    <AndroidLinkMode>Full</AndroidLinkMode>
    <EmbedAssembliesIntoApk>True</EmbedAssembliesIntoApk>
    <BundleAssemblies>False</BundleAssemblies>
    <AndroidCreatePackagePerAbi>False</AndroidCreatePackagePerAbi>
    <Debugger>Xamarin</Debugger>
    <AotAssemblies>False</AotAssemblies>
    <EnableLLVM>False</EnableLLVM>
    <AndroidEnableMultiDex>False</AndroidEnableMultiDex>
    <EnableProguard>False</EnableProguard>
  </PropertyGroup>
  <ItemGroup>
    <Reference Include="Mono.Android" />
    <Reference Include="mscorlib" />
    <Reference Include="System" />
    <Reference Include="System.Core" />
    <Reference Include="System.Xml.Linq" />
    <Reference Include="System.Xml" />
  </ItemGroup>
  <ItemGroup>
    <Compile Include="Class1.cs" />
    <Compile Include="MainActivity.cs" />
    <Compile Include="Resources\Resource.Designer.cs" />
    <Compile Include="Properties\AssemblyInfo.cs" />
  </ItemGroup>
  <ItemGroup>
    <None Include="GettingStarted.Xamarin" />
    <None Include="Resources\AboutResources.txt" />
    <None Include="Assets\AboutAssets.txt" />
  </ItemGroup>
  <ItemGroup>
    <AndroidResource Include="Resources\layout\Main.axml">
      <SubType>Designer</SubType>
    </AndroidResource>
  </ItemGroup>
  <ItemGroup>
    <AndroidResource Include="Resources\values\Strings.xml" />
  </ItemGroup>
  <ItemGroup>
    <None Include="Properties\AndroidManifest.xml">
      <SubType>Designer</SubType>
    </None>
  </ItemGroup>
  <ItemGroup>
    <AndroidResource Include="Resources\drawable\icon.png" />
  </ItemGroup>
  <ItemGroup>
    <Folder Include="Resources\drawable-hdpi\" />
    <Folder Include="Resources\drawable-ldpi\" />
    <Folder Include="Resources\drawable-mdpi\" />
    <Folder Include="Resources\drawable-xhdpi\" />
    <Folder Include="Resources\drawable-xxhdpi\" />
    <Folder Include="Resources\drawable-xxxhdpi\" />
  </ItemGroup>
  <Import Project="$(MSBuildExtensionsPath)\Xamarin\Android\Xamarin.Android.CSharp.targets" />
  <!-- To modify your build process, add your task inside one of the targets below and uncomment it. 
     Other similar extension points exist, see Microsoft.Common.targets.
        <Target Name="BeforeBuild">
        </Target>
        <Target Name="AfterBuild">
        </Target>
 -->
</Project>

回答1:

Sadly this is a bug in the current Stable build. There is a reported bug on this issue here:

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

However based on my observations, you can solve this issue by directly updating to the Beta channel via:

Tools -> Options -> Xamarin -> Other -> Switch to Beta -> Check for Updates

https://bugzilla.xamarin.com/show_bug.cgi?id=46164#c9

I've also added a workaround here:

https://bugzilla.xamarin.com/show_bug.cgi?id=46164#c14

Which you will need to add the following to your Release configuration in the current Stable build:

<AndroidManagedSymbols>False</AndroidManagedSymbols>



回答2:

I face the same problem and the latest beta (4.2.1.15) suggested in the comment solved this issue. To get the beta version. Go to Visual Studio > Tools > Options > Xamarin > Others > Change from Stable to Beta > Check Now