Bug 60173 - "The specified task executable “java.exe” could not be run. The filename or extension is too long". error when I try to build a Xamarin.Android project in VS17.
Summary: "The specified task executable “java.exe” could not be run. The filename or e...
Status: RESOLVED DUPLICATE of bug 59651
Alias: None
Product: Android
Classification: Xamarin
Component: General ()
Version: 8.1 (15.5)
Hardware: PC Windows
: --- critical
Target Milestone: ---
Assignee: Jonathan Pryor
URL:
Depends on:
Blocks:
 
Reported: 2017-10-13 08:50 UTC by Mbah Clinton
Modified: 2017-10-17 07:52 UTC (History)
6 users (show)

Tags:
Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
RESOLVED DUPLICATE of bug 59651

Description Mbah Clinton 2017-10-13 08:50:20 UTC
# Steps to reproduce
Update to VS 17 15.5.0 Preview 1
Try to build any Xamarin.Android project

# Expected behavior
Project builds successfully and runs.

# Actual behavior
"The specified task executable “java.exe” could not be run. The filename or extension is too long" error

# Supplemental info (logs, images, videos)
C:\Program Files (x86)\Microsoft Visual Studio\Preview\Enterprise\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(2092,3): warning MSB6002: The command-line for the "CompileToDalvik" task is too long. Command-lines longer than 32000 characters are likely to fail. Try reducing the length of the command-line by breaking down the call to "CompileToDalvik" into multiple calls with fewer parameters per call.

# Test environment (full version information
Microsoft Visual Studio Community 2017 Preview (2)
Version 15.5.0 Preview 1.0
VisualStudio.15.Preview/15.5.0-pre.1.0+27009.1
Microsoft .NET Framework
Version 4.7.02046

Installed Version: Community

Visual Basic 2017   00369-60000-00001-AA318
Microsoft Visual Basic 2017

Visual C# 2017   00369-60000-00001-AA318
Microsoft Visual C# 2017

CodeMaid   10.4.53
CodeMaid is an open source Visual Studio extension to cleanup and simplify our C#, C++, F#, VB, PHP, PowerShell, R, JSON, XAML, XML, ASP, HTML, CSS, LESS, SCSS, JavaScript and TypeScript coding.

Common Azure Tools   1.10
Provides common services for use by Azure Mobile Services and Microsoft Azure Tools.

GradleBindings.VisualStudio   1.0
Creates Xamarin Android Binding projects from a gradle file.

ILSpy.AddIn   1.0
Integration of the ILSpy Decompiler into Visual Studio.

Merq   1.1.17-rc (cba4571)
Command Bus, Event Stream and Async Manager for Visual Studio extensions.

Mono Debugging for Visual Studio   Mono.Debugging.VisualStudio
Support for debugging Mono processes with Visual Studio.

NuGet Package Manager   4.5.0
NuGet Package Manager in Visual Studio. For more information about NuGet, visit http://docs.nuget.org/.

OverviewTabPackage Extension   1.0
OverviewTabPackage Visual Studio Extension Detailed Info

Power Mode   1.0

SonarLint for Visual Studio   3.5.0.1803
SonarLint is an extension to your favorite IDE that provides on-the-fly feedback to developers on new bugs and quality issues injected into their code.

Visual Studio Code Debug Adapter Host Package   1.0
Interop layer for hosting Visual Studio Code debug adapters in Visual Studio

VisualStudio.Mac   1.0
Mac Extension for Visual Studio

Xamaridea.VisualStudioPlugin   1.0
VS + Xamarin + IDEA = Love

Xamarin   4.8.0.599 (378e765b4)
Visual Studio extension to enable development for Xamarin.iOS and Xamarin.Android.

Xamarin.Android SDK   8.1.0.19 (HEAD/2039d375e)
Xamarin.Android Reference Assemblies and MSBuild support.

Xamarin.iOS and Xamarin.Mac SDK   11.4.0.76 (12222fe)
Xamarin.iOS and Xamarin.Mac Reference Assemblies and MSBuild support.
Comment 1 Jon Douglas [MSFT] 2017-10-13 16:26:06 UTC
Thanks for the report!

To be more detailed, can you please provide the folder path location to where you are running this project? Creating a File->New->Xamarin.Android project which gets created in C:\Users\{USERNAME}\source\repos does not demonstrate this issue. I would suspect that your project is rather in a much larger path and thus why this issue is being thrown. Can you please clarify that for me? Thank you!
Comment 2 Jon Douglas [MSFT] 2017-10-13 17:18:23 UTC
Additionally, you may want to try out our experimental feature of shorter internal path names:

https://developer.xamarin.com/releases/android/xamarin.android_8/xamarin.android_8.0/#shorterinternalpathnames
Comment 3 Peter Collins 2017-10-13 20:52:53 UTC
Assuming this is a duplicate of #59651, which should be fixed in the next 15.5 preview.

*** This bug has been marked as a duplicate of bug 59651 ***
Comment 4 fragility2.0 2017-10-14 19:22:37 UTC
When might 15.5 Preview 2 come out?  I had to switch off of a shared project because I couldn't get ResX resources to resolve.  I then had to upgrade to .netstandard 2.0 because I got a lot of errors trying to use a pcl library.  I spent several days trying to get my .netstandard 2.0 library to work only to now have this problem.  Visual Studio 15.4 gives me an IllegalArgumentException during the Android build, so I guess I'm stuck.  I tried to switch on the shorter internal path names for Xamarin Android, that didn't work.  I tried shortening my Xamarin Android assembly name and even shortening the path where the solution lives down to a couple letters, nothing seems to alleviate the problem.  I really would like to get back to doing some actual work on my app.
Comment 5 jacktux 2017-10-17 07:52:34 UTC
In the Android project add
<UseShortFileNames>True</UseShortFileNames>

<PropertyGroup>
    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
....
  <UseShortFileNames>True</UseShortFileNames>
</PropertyGroup>


That worked for me