Problem description

開啟一個新的 Xamarin Mobile Poject → 點選 Build → 出現下列錯誤訊息:
Open a new Xamarin Mobile Poject → Click Build → Get error messages as below:

The "Javac" task failed unexpectedly.
System.IO.PathTooLongException: The specified path, file name, or both are too long. The fully qualified file name must be less than 260 characters, and the directory name must be less than 248 characters.


Solution

步驟 1. 右鍵點選專案 → 卸載專案
Step 1.  Right Click the project → Unload Project


步驟 2. 右鍵點選專案 → 編輯 .csproj
Step 2.  Right Click the project → Edit .csproj


步驟 3. 加入下列其中一程式區段在 .csproj
Step 3. Add one of sections below in .csproj

    True


    C:\MyFolder/MyProj




步驟 4. 右鍵點選專案 → 重新載入專案,完成
Step 4. Right Click the project → Reload Project. Then it works.


Reference

PathTooLongException Xamarin Droid Project - Stack Overflow