c# – Xamarin Android Archive error. Problem with Path file-ThrowExceptions

Exception or error:

I am trying to create an APK, but I am receiving this error

Cannont create the archive file because the archive directory cannot be created.
Could not find a part of the path ..\artifacts\bin\MonoDoublePulseBle-android\AnyCPU

I discovered when I click on Archive it creates a new folder with a lot of files (apk etc) at ..\artifacts\bin\MonoDoublePulseBle-android\Release\AnyCPU

If I copy this file in the first emplacement. it removes them when I click on Archive. and gives me this error

Xamarin Android Archive error.
Invalid Android Archive (no .APK files)

But if I click on archive and copy the file from the second folder in the first enough fast… It creates correctly the .APK. And this APK work… But it seem a weird way to made it.

I have try to clean, rebuild, remove boj and bin file, restart. Nothing changed.

I’m new on Xamarin.Form. If you need more relevant info ask it (I don’t know which one is important)

My Android .csproject

<?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>{94E7B6A9-6E4C-44F7-B570-4AD75EEE87C3}</ProjectGuid>
    <ProjectTypeGuids>{EFBA0AD7-5A72-4C68-AF49-83D382785DCF};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
    <OutputType>Library</OutputType>
    <AppDesignerFolder>Properties</AppDesignerFolder>
    <RootNamespace>MonoDoublePulseBle.android</RootNamespace>
    <AssemblyName>MonoDoublePulseBle-android</AssemblyName>
    <FileAlignment>512</FileAlignment>
    <AndroidApplication>true</AndroidApplication>
    <AndroidResgenFile>Resources\Resource.Designer.cs</AndroidResgenFile>
    <GenerateSerializationAssemblies>Off</GenerateSerializationAssemblies>
    <AndroidManifest>Properties\AndroidManifest.xml</AndroidManifest>
    <TargetFrameworkVersion>v10.0</TargetFrameworkVersion>
    <AndroidSupportedAbis>armeabi-v7a,x86</AndroidSupportedAbis>
    <OutputPath>..\..\artifacts\bin\$(AssemblyName)\$(Configuration)\$(Platform)</OutputPath>
    <AndroidStoreUncompressedFileExtensions />
    <AndroidUseManagedDesignTimeResourceGenerator>False</AndroidUseManagedDesignTimeResourceGenerator>
    <MandroidI18n />
    <JavaMaximumHeapSize />
    <JavaOptions />
    <NuGetPackageImportStamp>
    </NuGetPackageImportStamp>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
    <DebugSymbols>true</DebugSymbols>
    <DebugType>full</DebugType>
    <Optimize>false</Optimize>
    <DefineConstants>DEBUG;TRACE</DefineConstants>
    <ErrorReport>prompt</ErrorReport>
    <WarningLevel>4</WarningLevel>
    <AndroidUseSharedRuntime>true</AndroidUseSharedRuntime>
    <AndroidLinkMode>None</AndroidLinkMode>
    <AotAssemblies>false</AotAssemblies>
    <EnableLLVM>false</EnableLLVM>
    <BundleAssemblies>false</BundleAssemblies>
    <EmbedAssembliesIntoApk>false</EmbedAssembliesIntoApk>
    <AndroidPackageFormat>apk</AndroidPackageFormat>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
    <DebugType>pdbonly</DebugType>
    <Optimize>true</Optimize>
    <DefineConstants>
    </DefineConstants>
    <ErrorReport>prompt</ErrorReport>
    <WarningLevel>4</WarningLevel>
    <AndroidUseSharedRuntime>false</AndroidUseSharedRuntime>
    <AndroidLinkMode>SdkOnly</AndroidLinkMode>
    <EmbedAssembliesIntoApk>true</EmbedAssembliesIntoApk>
    <BundleAssemblies>false</BundleAssemblies>
    <AndroidCreatePackagePerAbi>true</AndroidCreatePackagePerAbi>
    <Debugger>Xamarin</Debugger>
    <AotAssemblies>false</AotAssemblies>
    <EnableLLVM>false</EnableLLVM>
    <AndroidEnableMultiDex>False</AndroidEnableMultiDex>
    <EnableProguard>False</EnableProguard>
    <DebugSymbols>True</DebugSymbols>
    <AndroidEnableProfiledAot>false</AndroidEnableProfiledAot>
    <AndroidPackageFormat>apk</AndroidPackageFormat>
    <MandroidI18n />
    <AndroidSupportedAbis>
    </AndroidSupportedAbis>
  </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="MyApplication.cs" />
    <Compile Include="Properties\AssemblyInfo.cs" />
    <Compile Include="Resources\Resource.Designer.cs" />
  </ItemGroup>
  <ItemGroup>
    <None Include="Properties\AndroidManifest.xml" />
  </ItemGroup>
  <ItemGroup>
    <AndroidResource Include="Resources\layout\Tabbar.axml" />
    <AndroidResource Include="Resources\layout\Toolbar.axml" />
    <AndroidResource Include="Resources\values\styles.xml" />
  </ItemGroup>
  <ItemGroup>
    <Folder Include="Assets\" />
    <Folder Include="Resources\drawable-xhdpi\" />
  </ItemGroup>
  <ItemGroup>
    <ProjectReference Include="..\ble.net.sampleapp\MonoDoublePulseBle.csproj">
      <Project>{9e4d7784-b138-4cd6-9b55-2ba70648ac93}</Project>
      <Name>MonoDoublePulseBle</Name>
    </ProjectReference>
  </ItemGroup>
  <ItemGroup>
    <AndroidResource Include="Resources\drawable-xxhdpi\icon.png" />
  </ItemGroup>
  <ItemGroup>
    <AndroidResource Include="Resources\drawable-hdpi\icon.png" />
  </ItemGroup>
  <ItemGroup>
    <AndroidResource Include="Resources\drawable\splash.xml" />
  </ItemGroup>
  <ItemGroup>
    <PackageReference Include="Acr.UserDialogs">
      <Version>7.0.35</Version>
    </PackageReference>
    <PackageReference Include="ble.net-android">
      <Version>1.2.1</Version>
    </PackageReference>
    <PackageReference Include="Microsoft.CodeAnalysis.FxCopAnalyzers">
      <Version>2.9.8</Version>
      <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
      <PrivateAssets>all</PrivateAssets>
    </PackageReference>
    <PackageReference Include="nexus.core">
      <Version>0.34.0</Version>
    </PackageReference>
    <PackageReference Include="Xamarin.Forms">
      <Version>4.4.0.991265</Version>
    </PackageReference>
  </ItemGroup>
  <ItemGroup>
    <AndroidResource Include="Resources\drawable\curve_empty.png" />
  </ItemGroup>
  <ItemGroup>
    <AndroidResource Include="Resources\drawable\double_pulse.png" />
  </ItemGroup>
  <ItemGroup>
    <AndroidResource Include="Resources\drawable\double_pulse_oppose.png" />
  </ItemGroup>
  <ItemGroup>
    <AndroidResource Include="Resources\drawable\inversion.png" />
  </ItemGroup>
  <ItemGroup>
    <AndroidResource Include="Resources\drawable\logo_laplace.png" />
  </ItemGroup>
  <ItemGroup>
    <AndroidResource Include="Resources\drawable\mono_pulse.png" />
  </ItemGroup>
  <ItemGroup>
    <AndroidResource Include="Resources\drawable\mono_pulse_oppose.png" />
  </ItemGroup>
  <ItemGroup>
    <AndroidResource Include="Resources\drawable\tab_about.png" />
  </ItemGroup>
  <ItemGroup>
    <AndroidResource Include="Resources\drawable\tab_feed.png" />
  </ItemGroup>
  <ItemGroup>
    <AndroidResource Include="Resources\drawable\transistor.png" />
  </ItemGroup>
  <ItemGroup>
    <AndroidResource Include="Resources\drawable\transistor_off.png" />
  </ItemGroup>
  <ItemGroup>
    <AndroidResource Include="Resources\drawable\transistor_on.png" />
  </ItemGroup>
  <Import Project="$(MSBuildExtensionsPath)\Xamarin\Android\Xamarin.Android.CSharp.targets" />
</Project>
How to solve:

Leave a Reply

Your email address will not be published. Required fields are marked *