Gradle: The Filename, Directory Name, Or Volume Label Syntax Is Incorrect
Solution 1:
Finally solved it. I looked at the error message again and tried to run the last command before failure, e.g.:
C:\Android\android-studio2\sdk\build-tools\android-4.4\dx.bat --dex --ou
tput E:\Backups\etc\TestProj2\Test2\build\libs\Test2-defaultFlavor-debug.dex E:\
Backups\etc\TestProj2\Test2\build\classes\defaultFlavor\debug E:\Backups\etc\Tes
tProj2\Test2\build\dependency-cache\defaultFlavor\debug
This gave the "The filename, directory name, or volume label syntax is incorrect." So then I went to the build-tools folder and ran dx.bat with no cmd-line args:
C:\Android\android-studio2\sdk\build-tools\android-4.4\dx.bat
And still got the same error. So I took a look inside the file and found these lines:
rem Check we have a valid Java.exe in the path.set java_exe=
if exist "%~dp0..\tools\lib\find_java.bat"call"%~dp0..\tools\lib\find_java.bat"if exist "%~dp0..\..\tools\lib\find_java.bat"call"%~dp0..\..\tools\lib\find_java.bat"ifnot defined java_exe goto :EOF
So I tried running find_java.bat from the command line and it returned nothing.
So I replaced the above lines with the below one:
set java_exe=C:\Windows\System32\java.exe
And everything started working...
Solution 2:
Here is my solution:
I got this error while running my React Native app:
java.io.IOException: The filename, directory name, or volume label syntax is incorrect.
That means you've got an issue in Gradle. Then I went to the build-tools folder and ran dx.bat
with no cmd-line args
C:\Android\build-tools\30.0.1\dx.bat
(located in Sdk).
Open this file in notepad or any editor or IDE. Where you find this line of code below
rem Check we have a valid Java.exe in the path.
set java_exe=
if exist "%~dp0..\tools\lib\find_java.bat" call "%~dp0..\tools\lib\find_java.bat"
if exist "%~dp0..\..\tools\lib\find_java.bat" call "%~dp0..\..\tools\lib\find_java.bat"
if not defined java_exe goto :EOF
Replace this code with code below:
set java_exe= C:\Program Files\Java\jdk1.8.0_211\bin\java.exe
The location java.exe changed after the jre 8 update.
java.exe
is removed from c:\windows\system32
in jre 8.
I hope it's working now.
Post a Comment for "Gradle: The Filename, Directory Name, Or Volume Label Syntax Is Incorrect"