Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

resolve xamarin android "path too long" without relocation

I have recently started getting the error ResolveLibraryProjectImports: PathTooLongException on my xamarin android project within xamarin.forms. When I look up online all solutions say to relocate the project. Is there any way to change the project properties or a way to remap that can help me avoid relocating the entire project?

Update:

Due the the bounty and since the question has come up below, here is why I am looking for an alternate solution to relocating:

Directory hierarchies are there for a reason. If not everyone would have the whole bunch of folders the root. They are designed to allow us to organize everything. Same is my case. I have organized all folders based cloud, codes, frameworks etc. Of all the frameworks I have worked with, I have never had relocate a project because of an internal requirement of the project. So, I do not see a reason I need to move a project out of all these folders (which also means out of cloud) and throw them in some location apart from the rest of the projects, just because the project asks for it.

like image 902
Neville Nazerane Avatar asked Nov 03 '17 05:11

Neville Nazerane


1 Answers

I faced the same Issue before, here is what I have found :

Windows has a Maximum Path Length Limitation. You could see it in Windows Naming Files, Paths, and Namespaces :

Maximum Path Length Limitation In the Windows API (with some exceptions discussed in the following paragraphs), the maximum length for a path is MAX_PATH, which is defined as 260 characters. A local path is structured in the following order: drive letter, colon, backslash, name components separated by backslashes, and a terminating null character. For example, the maximum path on drive D is "D:\some 256-character path string" where "" represents the invisible terminating null character for the current system codepage. (The characters < > are used here for visual clarity and cannot be part of a valid path string.) This is the reason why you have the issue.

You could shorten the directory path to your project to solve this problem, another solution is use the long path tool. But as PierceBoggan said :

the easiest way to avoid this issue is to move your source to the C:/ drive (or another location with fewer characters in the path).


Update :

The issue was fixed in Xamarin.Android 8.0.2.1, and this version is included in the Visual Studio 2017 version 15.4.2 release. You could read this document :

https://developer.xamarin.com/releases/android/xamarin.android_8/xamarin.android_8.0/#Issues_Fixed

like image 92
York Shen Avatar answered Sep 28 '22 03:09

York Shen