tuyen-vuduc / mapbox-maui

Mapbox library for MAUI
Other
39 stars 7 forks source link

error APT2144: invalid file path '.\src\qs\MapboxMauiQs\obj\Debug\net8.0-android\lp\188.stamp'. #10

Closed tuyen-vuduc closed 4 months ago

tuyen-vuduc commented 5 months ago

image

Similar issues:

tuyen-vuduc commented 5 months ago

The sample app for .NET Android is running well without issues.

sergsel commented 4 months ago

Any progress so far? I have the same issue during build using windows.

tuyen-vuduc commented 4 months ago

Workaround applied to branch v11.0.0. Please check it out.

tuyen-vuduc commented 4 months ago

Considered closed for now.

sklyarovaleksey commented 3 months ago

Hello this works in vension 11.3 but doesn't work on version 11.5 (net8.0-android34.0)

Project Settings `

<PackageReference Include="Xamarin.AndroidX.Fragment.Ktx" Version="1.7.0.2" />
<PackageReference Include="Xamarin.Kotlin.StdLib.Jdk8" Version="2.0.0" />
<PackageReference Include="Square.OkHttp3" Version="4.12.0.4" />
<PackageReference Include="Xamarin.Kotlin.StdLib" Version="2.0.0" />
<PackageReference Include="Xamarin.AndroidX.Annotation" Version="1.8.0" />
<PackageReference Include="Xamarin.Android.Google.BillingClient" Version="6.2.1" />
<PackageReference Include="Square.OkIO" Version="3.9.0" />

`

Error 2>C:\Program Files\dotnet\packs\Microsoft.Android.Sdk.Windows\34.0.113\tools\Xamarin.Android.Aapt2.targets(123,3): error APT2144: invalid file path 'XXX\obj\Debug\net8.0-android34.0\lp\214.stamp'. 2>C:\Program Files\dotnet\packs\Microsoft.Android.Sdk.Windows\34.0.113\tools\Xamarin.Android.Aapt2.targets(123,3): error APT2144: 2>C:\Program Files\dotnet\packs\Microsoft.Android.Sdk.Windows\34.0.113\tools\Xamarin.Android.Aapt2.targets(123,3): error APT2144: invalid file path 'XXX\obj\Debug\net8.0-android34.0\lp\209.stamp'. 2>C:\Program Files\dotnet\packs\Microsoft.Android.Sdk.Windows\34.0.113\tools\Xamarin.Android.Aapt2.targets(123,3): error APT2144: 2>C:\Program Files\dotnet\packs\Microsoft.Android.Sdk.Windows\34.0.113\tools\Xamarin.Android.Aapt2.targets(123,3): error APT2144: invalid file path 'XXX\obj\Debug\net8.0-android34.0\lp\217.stamp'. 2>C:\Program Files\dotnet\packs\Microsoft.Android.Sdk.Windows\34.0.113\tools\Xamarin.Android.Aapt2.targets(123,3): error APT2144: 2>C:\Program Files\dotnet\packs\Microsoft.Android.Sdk.Windows\34.0.113\tools\Xamarin.Android.Aapt2.targets(123,3): error APT2144: invalid file path 'XXX\obj\Debug\net8.0-android34.0\lp\212.stamp'. 2>C:\Program Files\dotnet\packs\Microsoft.Android.Sdk.Windows\34.0.113\tools\Xamarin.Android.Aapt2.targets(123,3): error APT2144: 2>C:\Program Files\dotnet\packs\Microsoft.Android.Sdk.Windows\34.0.113\tools\Xamarin.Android.Aapt2.targets(123,3): error APT2144: invalid file path 'XXX\obj\Debug\net8.0-android34.0\lp\218.stamp'. 2>C:\Program Files\dotnet\packs\Microsoft.Android.Sdk.Windows\34.0.113\tools\Xamarin.Android.Aapt2.targets(123,3): error APT2144: 2>C:\Program Files\dotnet\packs\Microsoft.Android.Sdk.Windows\34.0.113\tools\Xamarin.Android.Aapt2.targets(123,3): error APT2144: invalid file path 'XXX\obj\Debug\net8.0-android34.0\lp\207.stamp'. 2>C:\Program Files\dotnet\packs\Microsoft.Android.Sdk.Windows\34.0.113\tools\Xamarin.Android.Aapt2.targets(123,3): error APT2144: 2>C:\Program Files\dotnet\packs\Microsoft.Android.Sdk.Windows\34.0.113\tools\Xamarin.Android.Aapt2.targets(123,3): error APT2144: invalid file path 'XXX\obj\Debug\net8.0-android34.0\lp\205.stamp'. 2>C:\Program Files\dotnet\packs\Microsoft.Android.Sdk.Windows\34.0.113\tools\Xamarin.Android.Aapt2.targets(123,3): error APT2144: 2>C:\Program Files\dotnet\packs\Microsoft.Android.Sdk.Windows\34.0.113\tools\Xamarin.Android.Aapt2.targets(123,3): error APT2144: invalid file path 'XXX\obj\Debug\net8.0-android34.0\lp\223.stamp'. 2>C:\Program Files\dotnet\packs\Microsoft.Android.Sdk.Windows\34.0.113\tools\Xamarin.Android.Aapt2.targets(123,3): error APT2144: 2>C:\Program Files\dotnet\packs\Microsoft.Android.Sdk.Windows\34.0.113\tools\Xamarin.Android.Aapt2.targets(123,3): error APT2144: invalid file path 'XXXi\obj\Debug\net8.0-android34.0\lp\216.stamp'. 2>C:\Program Files\dotnet\packs\Microsoft.Android.Sdk.Windows\34.0.113\tools\Xamarin.Android.Aapt2.targets(123,3): error APT2144: 2>Done building project "XXX" -- FAILED.

sklyarovaleksey commented 3 months ago

In addition to the previous post. This issue occurred when you try to use dependences with different project. For instance when you use two project with dependences like in the example (libs and qs projects). And works good when you combine all in one project. image

tuyen-vuduc commented 3 months ago

Workaround: Add these lines to your lib CSPROJ file.

    <Target Name="_CleanAarOutputPath" AfterTargets="_CreateAar" BeforeTargets="_IncludeAarInNuGetPackage">
        <Delete Files="$(_AarOutputPath)" />
    </Target>
tuyen-vuduc commented 3 months ago

@sklyarovaleksey The workaround is not that correct to use the lib as a ProjectReference, it's for packing the nuget package only :D . It's used to mentioned in this issue.

The actual workaround for this situation is to link files directly to the main .NET MAUI app project.

You can check out file MapboxMauiQs.csproj to see how I apply it.

1/ For Android

<ItemGroup Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'android'">
   <Compile Include="..\..\libs\Mapbox.Maui\Platforms\Android\**\**\*.cs">
    <Link>Platforms\Android\Shared\%(RecursiveDir)%(Filename)%(Extension)</Link>
   </Compile>
</ItemGroup>

2/ For iOS

<ItemGroup Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'ios'">
    <Compile Include="..\..\libs\Mapbox.Maui\Platforms\iOS\**\**\*.cs">
        <Link>Platforms\iOS\Shared\%(RecursiveDir)%(Filename)%(Extension)</Link>
    </Compile>
</ItemGroup>

3/ For both

<Compile Include="..\..\libs\Mapbox.Maui\Models\**\**\*.cs">
      <Link>Shared\%(RecursiveDir)%(Filename)%(Extension)</Link>
</Compile>

If you have multiple .NET MAUI app projects, you may consider to use local Nuget package for the others. Only single project will be use this workaround.

tuyen-vuduc commented 3 months ago

https://github.com/dotnet/android/issues/8699

tuyen-vuduc commented 3 months ago

https://github.com/dotnet/android/issues/8504

leoslima13 commented 2 months ago

Hey @tuyen-vuduc I'm still getting this issue when I have a second .net MAUI project on the solution. My current structure is: P1 - .NET MAUI - with all nuget package references (including MapBox.Maui version 11.4.0-alpha01) P2 - .NET MAUI project - referencing P1

During the build process, only on ANDROID, I'm getting these error messages from P2 project: Xamarin.Android.Aapt2.targets(123, 3): [APT2144] invalid file path '/Users/leonardo/Downloads/dotnet-mapbox-quickstart-main/src/quickstart/SecondProject/obj/Debug/net8.0-android/lp/196.stamp'. Xamarin.Android.Aapt2.targets(123, 3): [APT2144] invalid file path '/Users/leonardo/Downloads/dotnet-mapbox-quickstart-main/src/quickstart/SecondProject/obj/Debug/net8.0-android/lp/198.stamp'. Xamarin.Android.Aapt2.targets(123, 3): [APT2144] invalid file path '/Users/leonardo/Downloads/dotnet-mapbox-quickstart-main/src/quickstart/SecondProject/obj/Debug/net8.0-android/lp/199.stamp'. Xamarin.Android.Aapt2.targets(123, 3): [APT2144] invalid file path '/Users/leonardo/Downloads/dotnet-mapbox-quickstart-main/src/quickstart/SecondProject/obj/Debug/net8.0-android/lp/200.stamp'. Xamarin.Android.Aapt2.targets(123, 3): [APT2144] invalid file path '/Users/leonardo/Downloads/dotnet-mapbox-quickstart-main/src/quickstart/SecondProject/obj/Debug/net8.0-android/lp/189.stamp'. Xamarin.Android.Aapt2.targets(123, 3): [APT2144] invalid file path '/Users/leonardo/Downloads/dotnet-mapbox-quickstart-main/src/quickstart/SecondProject/obj/Debug/net8.0-android/lp/187.stamp'. Xamarin.Android.Aapt2.targets(123, 3): [APT2144] invalid file path '/Users/leonardo/Downloads/dotnet-mapbox-quickstart-main/src/quickstart/SecondProject/obj/Debug/net8.0-android/lp/194.stamp'. Xamarin.Android.Aapt2.targets(123, 3): [APT2144] invalid file path '/Users/leonardo/Downloads/dotnet-mapbox-quickstart-main/src/quickstart/SecondProject/obj/Debug/net8.0-android/lp/205.stamp'. Xamarin.Android.Aapt2.targets(123, 3): [APT2144] invalid file path '/Users/leonardo/Downloads/dotnet-mapbox-quickstart-main/src/quickstart/SecondProject/obj/Debug/net8.0-android/lp/191.stamp'.

It is worth noting that if I remove the reference from the P2 project, it works normally. Do I need to do any extra configuration in the P2 project?

Here's my P2 csproj:

<ItemGroup>
      <PackageReference Include="Microsoft.Maui.Controls" Version="8.0.40"/>
      <PackageReference Include="Microsoft.Maui.Controls.Compatibility" Version="8.0.40"/>
      <PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="8.0.0"/>
</ItemGroup>

<ItemGroup>
  <ProjectReference Include="..\DotnetMaui.MapboxQs\DotnetMaui.MapboxQs.csproj" />
</ItemGroup>

Here's my P1 csproj:

<Project Sdk="Microsoft.NET.Sdk">
    <Import Condition="EXISTS('DotnetMaui.MapboxQs.props')" Project="DotnetMaui.MapboxQs.props" />
    <Import Condition="EXISTS('DotnetMaui.MapboxQs.targets')" Project="DotnetMaui.MapboxQs.targets" />
    <PropertyGroup>
        <TargetFrameworks>net8.0-android;net8.0-ios;</TargetFrameworks>
        <RootNamespace>DotnetMaui.MapboxQs</RootNamespace>
        <UseMaui>true</UseMaui>
        <SingleProject>true</SingleProject>
        <ImplicitUsings>enable</ImplicitUsings>
        <CreatePackage>false</CreatePackage>

        <SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'ios'">11.0</SupportedOSPlatformVersion>
        <SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'android'">21.0</SupportedOSPlatformVersion>
    </PropertyGroup>

    <PropertyGroup Condition="'$(TargetFramework)'=='net8.0-ios'">
      <ProvisioningType>manual</ProvisioningType>
      <CodesignKey>iPhone Developer</CodesignKey>
    </PropertyGroup>

    <ItemGroup>
        <PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="8.0.0" />
        <PackageReference Include="Microsoft.Maui.Controls" Version="8.0.40" />
        <PackageReference Include="Mapbox.Maui" Version="11.4.0-alpha01" />
    </ItemGroup>

    <ItemGroup>
      <Folder Include="Platforms\iOS\" />
    </ItemGroup>
</Project>
tuyen-vuduc commented 2 months ago

@leoslima13 Add these lines to your Android lib project.

    <Target Name="_CleanAarOutputPath" AfterTargets="_CreateAar" BeforeTargets="_IncludeAarInNuGetPackage">
        <Delete Files="$(_AarOutputPath)" />
    </Target>

image

leoslima13 commented 2 months ago

@tuyen-vuduc Actually I don't have any lib project, I have two .NET MAUI single projects. I tried what you sent on my two projects, but still not working. I'm sharing a link to my personal drive with the zip file of my solution (removing all my mapbox tokens) if you want try on your end. (https://drive.google.com/file/d/1u9XykbN_dlQOjKlpavF17ONE0RCU6aKq/view?usp=drive_link) Basically this project is the same as your sample, adding an extra project.

tuyen-vuduc commented 2 months ago

Plz slowly read and follow my instruction.

leoslima13 commented 2 months ago

I already followed the steps you said earlier, I sent the answer with the sample project because it didn't work

leoslima13 commented 2 months ago

Hey @tuyen-vuduc any thoughts on that? Even following your steps, I still getting the same error.

tuyen-vuduc commented 2 months ago

Hi @leoslima13 ,

Sorry, the actual steps were listed previously for sklyarovaleksey. Please take a look.

IMPORTANT: We cannot add project reference directly.