Reputation: 9703
When building for Android I keep having this error:
Severity Code Description Project File Line Suppression State Error Failed to create JavaTypeInfo for class: Android.Support.V4.View.Accessibility.AccessibilityManagerCompat/IAccessibilityStateChangeListenerImplementor due to System.IO.DirectoryNotFoundException: Could not find a part of the path 'C:\Users\Iain Smith\Documents\Developer\Work\Clients\Client1\Project1\Xamarin.Dev.Playground\Source\Client1.Playground.Android\obj\Debug\90\android\src\mono\android\support\v4\view\accessibility\AccessibilityManagerCompat_AccessibilityStateChangeListenerImplementor.java'. at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath) at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost) at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize) at Xamarin.Android.Tools.Files.CopyIfStreamChanged(Stream stream, String destination) at Xamarin.Android.Tasks.Generator.CreateJavaSources(TaskLoggingHelper log, IEnumerable`1 javaTypes, String outputPath, String applicationJavaClass, Boolean useSharedRuntime, Boolean generateOnCreateOverrides, Boolean hasExportReference) Client1.Playground.Android
What is causing it? How do I fix it? Doesn't seem to happen on the CI builds.
Upvotes: 3
Views: 5291
Reputation: 13176
Here's a few methods you can use to fix MAX_PATH
length issues:
Within a Xamarin.Android .csproj:
<UseShortFileNames>True</UseShortFileNames>
- Forces the build process to use shorter path names.
<IntermediateOutputPath>C:\Projects\MyApp</IntermediateOutputPath>
- Specifies a common intermediate output root to make a shorter path.
Changing the group policy:
Upvotes: 11
Reputation: 9703
This is due to the Max Path length on Windows, Changed my directory from:
C:\Users\Iain Smith\Documents\Developer\Work\Clients\Client1\Project1\Xamarin.Dev.Playground\Source\Client1.Playground.Android\
to:
C:\Developer\Work\Clients\Client1\Project1\Xamarin.Dev.Playground\Source\Client1.Playground.Android\
Upvotes: 1