Compiling error when assets folder containing subfolder

AnguishAnguish DEMember ✭✭

I got a compiling error "Cannot copy /Users/...../Subfolder/ to /Users/..../Droid/obj/Debug/assets/Subfolder/, as the source file doesn't exist", if I created a subfolder in assets folder.
How can I use subfolders in assets folder?

Answers

  • AnguishAnguish DEMember ✭✭

    Same error when I create a subfolder in Resources/raw/ (Resources/raw/test i.e.)

  • AnguishAnguish DEMember ✭✭

    AboutAssets.txt: Any raw assets you want to be deployed with your application can be placed in
    this directory (and child directories) and given a Build Action of "AndroidAsset".
    and child directories not really! >:(
    I like this forum, because you never get an answer here, or 2 years later... Sorry can't wait 2 years, it's not a fun project.
    I thought in xamarin forums are xamarin specialists, but I was wrong. :(

  • Adam.HockemeyerAdam.Hockemeyer USUniversity ✭✭

    @ben.lacey said:
    It might be a little late, but I've just run into this issue too, and found the fix.

    When you added the sub-directory, the project file had an item added that causes this error. Edit the project file and remove the line that references the sub-directory and the project will build.

    For example, after adding a sub-directory of fonts, I'll get the error:

    <ItemGroup> <AndroidAsset Include="Assets\Fonts\" /> <AndroidAsset Include="Assets\Fonts\Roboto-Light.ttf" /> <AndroidAsset Include="Assets\Fonts\Roboto-Regular.ttf" /> <AndroidAsset Include="Assets\Fonts\Roboto-Thin.ttf" /> </ItemGroup>

    To fix, remove the first AndroidAsset that refers to the sub-directory:

    <ItemGroup> <AndroidAsset Include="Assets\Fonts\Roboto-Light.ttf" /> <AndroidAsset Include="Assets\Fonts\Roboto-Regular.ttf" /> <AndroidAsset Include="Assets\Fonts\Roboto-Thin.ttf" /> </ItemGroup>

    This worked for me as well!

    Thanks.

  • eckoj433eckoj433 SEMember

    Same for me, and worked after removing the include line for the actual folder. Question is why? why does not xamarin studio handle this for us? why does it add an include for the folder if includs should not be added for folders?

  • Sam.3816Sam.3816 USMember ✭✭

    Yes I had this issue today and removing reference to folder fixed it.

  • AdamVenturellaAdamVenturella USMember ✭✭

    Thanks! this helped me as well!

  • AhmedElashkerAhmedElashker USMember ✭✭

    @ben.lacey said:
    It might be a little late, but I've just run into this issue too, and found the fix.

    When you added the sub-directory, the project file had an item added that causes this error. Edit the project file and remove the line that references the sub-directory and the project will build.

    For example, after adding a sub-directory of fonts, I'll get the error:

    <ItemGroup> <AndroidAsset Include="Assets\Fonts\" /> <AndroidAsset Include="Assets\Fonts\Roboto-Light.ttf" /> <AndroidAsset Include="Assets\Fonts\Roboto-Regular.ttf" /> <AndroidAsset Include="Assets\Fonts\Roboto-Thin.ttf" /> </ItemGroup>

    To fix, remove the first AndroidAsset that refers to the sub-directory:

    <ItemGroup> <AndroidAsset Include="Assets\Fonts\Roboto-Light.ttf" /> <AndroidAsset Include="Assets\Fonts\Roboto-Regular.ttf" /> <AndroidAsset Include="Assets\Fonts\Roboto-Thin.ttf" /> </ItemGroup>

    Great. Thanks very much.

    @eckoj433 said:
    Same for me, and worked after removing the include line for the actual folder. Question is why? why does not xamarin studio handle this for us? why does it add an include for the folder if includs should not be added for folders?

    I think because it's stupid. There is no other explanation.

  • AlanTonissonAlanTonisson AUMember ✭✭

    @ben.lacey said:
    It might be a little late, but I've just run into this issue too, and found the fix.

    When you added the sub-directory, the project file had an item added that causes this error. Edit the project file and remove the line that references the sub-directory and the project will build.

    For example, after adding a sub-directory of fonts, I'll get the error:

    <ItemGroup> <AndroidAsset Include="Assets\Fonts\" /> <AndroidAsset Include="Assets\Fonts\Roboto-Light.ttf" /> <AndroidAsset Include="Assets\Fonts\Roboto-Regular.ttf" /> <AndroidAsset Include="Assets\Fonts\Roboto-Thin.ttf" /> </ItemGroup>

    To fix, remove the first AndroidAsset that refers to the sub-directory:

    <ItemGroup> <AndroidAsset Include="Assets\Fonts\Roboto-Light.ttf" /> <AndroidAsset Include="Assets\Fonts\Roboto-Regular.ttf" /> <AndroidAsset Include="Assets\Fonts\Roboto-Thin.ttf" /> </ItemGroup>

    Thanks. Your answer saved me a lot of time.
    I can't believe this is still a problem in Visual Studio for Mac.

Sign In or Register to comment.