I've installed and setup the latest version of Android Studio (0.3.6, nov 14 release) but upon trying to build my project (a bare-bones hello world project made with the Android Studio new project wizard) I get the following error:
E:\Backups\etc\TestProj2>gradlew --stacktrace build
:Test2:preBuild UP-TO-DATE
:Test2:preDefaultFlavorDebugBuild UP-TO-DATE
:Test2:prepareDefaultFlavorDebugDependencies
:Test2:compileDefaultFlavorDebugAidl
:Test2:compileDefaultFlavorDebugRenderscript
:Test2:generateDefaultFlavorDebugBuildConfig
:Test2:mergeDefaultFlavorDebugAssets
:Test2:mergeDefaultFlavorDebugResources
:Test2:processDefaultFlavorDebugManifest
:Test2:processDefaultFlavorDebugResources
:Test2:generateDefaultFlavorDebugSources
:Test2:compileDefaultFlavorDebug
:Test2:dexDefaultFlavorDebug
The filename, directory name, or volume label syntax is incorrect.
:Test2:dexDefaultFlavorDebug FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':Test2:dexDefaultFlavorDebug'.
> Could not call IncrementalTask.taskAction() on task ':Test2:dexDefaultFlavorDe
bug'
* Try:
Run with --info or --debug option to get more log output.
* Exception is:
org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':Test2:d
exDefaultFlavorDebug'.
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.ex
ecuteActions(ExecuteActionsTaskExecuter.java:69)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.ex
ecute(ExecuteActionsTaskExecuter.java:46)
at org.gradle.api.internal.tasks.execution.PostExecutionAnalysisTaskExec
uter.execute(PostExecutionAnalysisTaskExecuter.java:35)
at org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter.exec
ute(SkipUpToDateTaskExecuter.java:64)
at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execut
e(ValidatingTaskExecuter.java:58)
at org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecu
ter.execute(SkipEmptySourceFilesTaskExecuter.java:42)
at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter
.execute(SkipTaskWithNoActionsExecuter.java:52)
at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execut
e(SkipOnlyIfTaskExecuter.java:53)
at org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter
.execute(ExecuteAtMostOnceTaskExecuter.java:43)
at org.gradle.api.internal.AbstractTask.executeWithoutThrowingTaskFailur
e(AbstractTask.java:283)
at org.gradle.execution.taskgraph.AbstractTaskPlanExecutor$TaskExecutorW
orker.executeTask(AbstractTaskPlanExecutor.java:79)
at org.gradle.execution.taskgraph.AbstractTaskPlanExecutor$TaskExecutorW
orker.processTask(AbstractTaskPlanExecutor.java:63)
at org.gradle.execution.taskgraph.AbstractTaskPlanExecutor$TaskExecutorW
orker.run(AbstractTaskPlanExecutor.java:51)
at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$1.run(DefaultT
askPlanExecutor.java:33)
at org.gradle.internal.Factories$1.create(Factories.java:22)
at org.gradle.cache.internal.DefaultCacheAccess.longRunningOperation(Def
aultCacheAccess.java:214)
at org.gradle.cache.internal.DefaultCacheAccess.longRunningOperation(Def
aultCacheAccess.java:276)
at org.gradle.cache.internal.DefaultPersistentDirectoryStore.longRunning
Operation(DefaultPersistentDirectoryStore.java:142)
at org.gradle.api.internal.changedetection.state.DefaultTaskArtifactStat
eCacheAccess.longRunningOperation(DefaultTaskArtifactStateCacheAccess.java:78)
at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor.process(Defaul
tTaskPlanExecutor.java:31)
at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter.execute(Defau
ltTaskGraphExecuter.java:86)
at org.gradle.execution.SelectedTaskExecutionAction.execute(SelectedTask
ExecutionAction.java:29)
at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecute
r.java:61)
at org.gradle.execution.DefaultBuildExecuter.access$200(DefaultBuildExec
uter.java:23)
at org.gradle.execution.DefaultBuildExecuter$2.proceed(DefaultBuildExecu
ter.java:67)
at org.gradle.execution.DryRunBuildExecutionAction.execute(DryRunBuildEx
ecutionAction.java:32)
at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecute
r.java:61)
at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecute
r.java:54)
at org.gradle.initialization.DefaultGradleLauncher.doBuildStages(Default
GradleLauncher.java:166)
at org.gradle.initialization.DefaultGradleLauncher.doBuild(DefaultGradle
Launcher.java:113)
at org.gradle.initialization.DefaultGradleLauncher.run(DefaultGradleLaun
cher.java:81)
at org.gradle.launcher.exec.InProcessBuildActionExecuter$DefaultBuildCon
troller.run(InProcessBuildActionExecuter.java:64)
at org.gradle.launcher.cli.ExecuteBuildAction.run(ExecuteBuildAction.jav
a:33)
at org.gradle.launcher.cli.ExecuteBuildAction.run(ExecuteBuildAction.jav
a:24)
at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProce
ssBuildActionExecuter.java:35)
at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProce
ssBuildActionExecuter.java:26)
at org.gradle.launcher.cli.RunBuildAction.run(RunBuildAction.java:50)
at org.gradle.api.internal.Actions$RunnableActionAdapter.execute(Actions
.java:171)
at org.gradle.launcher.cli.CommandLineActionFactory$ParseAndBuildAction.
execute(CommandLineActionFactory.java:201)
at org.gradle.launcher.cli.CommandLineActionFactory$ParseAndBuildAction.
execute(CommandLineActionFactory.java:174)
at org.gradle.launcher.cli.CommandLineActionFactory$WithLogging.execute(
CommandLineActionFactory.java:170)
at org.gradle.launcher.cli.CommandLineActionFactory$WithLogging.execute(
CommandLineActionFactory.java:139)
at org.gradle.launcher.cli.ExceptionReportingAction.execute(ExceptionRep
ortingAction.java:33)
at org.gradle.launcher.cli.ExceptionReportingAction.execute(ExceptionRep
ortingAction.java:22)
at org.gradle.launcher.Main.doAction(Main.java:46)
at org.gradle.launcher.bootstrap.EntryPoint.run(EntryPoint.java:45)
at org.gradle.launcher.Main.main(Main.java:37)
at org.gradle.launcher.bootstrap.ProcessBootstrap.runNoExit(ProcessBoots
trap.java:50)
at org.gradle.launcher.bootstrap.ProcessBootstrap.run(ProcessBootstrap.j
ava:32)
at org.gradle.launcher.GradleMain.main(GradleMain.java:23)
at org.gradle.wrapper.BootstrapMainStarter.start(BootstrapMainStarter.ja
va:33)
at org.gradle.wrapper.WrapperExecutor.execute(WrapperExecutor.java:130)
at org.gradle.wrapper.GradleWrapperMain.main(GradleWrapperMain.java:48)
Caused by: org.gradle.api.GradleException: Could not call IncrementalTask.taskAc
tion() on task ':Test2:dexDefaultFlavorDebug'
at org.gradle.util.JavaMethod.invoke(JavaMethod.java:69)
at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskF
actory$StandardTaskAction.doExecute(AnnotationProcessingTaskFactory.java:219)
at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskF
actory$StandardTaskAction.execute(AnnotationProcessingTaskFactory.java:212)
at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskF
actory$StandardTaskAction.execute(AnnotationProcessingTaskFactory.java:201)
at org.gradle.api.internal.AbstractTask$TaskActionWrapper.execute(Abstra
ctTask.java:527)
at org.gradle.api.internal.AbstractTask$TaskActionWrapper.execute(Abstra
ctTask.java:510)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.ex
ecuteAction(ExecuteActionsTaskExecuter.java:80)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.ex
ecuteActions(ExecuteActionsTaskExecuter.java:61)
... 52 more
Caused by: com.android.ide.common.internal.LoggedErrorException: Failed to run c
ommand:
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
Error Code:
1
Output:
The filename, directory name, or volume label syntax is incorrect.
at com.android.ide.common.internal.CommandLineRunner.runCmdLine(CommandL
ineRunner.java:98)
at com.android.ide.common.internal.CommandLineRunner.runCmdLine(CommandL
ineRunner.java:69)
at com.android.builder.AndroidBuilder.convertByteCode(AndroidBuilder.jav
a:998)
at com.android.builder.AndroidBuilder$convertByteCode.call(Unknown Sourc
e)
at com.android.build.gradle.tasks.Dex.doFullTaskAction(Dex.groovy:55)
at com.android.build.gradle.internal.tasks.IncrementalTask.taskAction(In
crementalTask.groovy:96)
at org.gradle.util.JavaMethod.invoke(JavaMethod.java:62)
... 59 more
BUILD FAILED
Total time: 5.923 secs
Following that, I get this error:
Gradle: Execution failed for task ':Test2:dexDefaultFlavorDebug'.
> Could not call IncrementalTask.taskAction() on task ':Test2:dexDefaultFlavorDebug'
So, it looks like something is wrong with the "The filename, directory name, or volume label syntax" but what file? What directory?
I'm guessing it might be something about the separator characters, but I'm not sure and my grasp of gradle is quite weak.
(I have set the path variable, JAVA_HOME variable and JDK_HOME variable to point to my JDK 7_45 directory. I'm running Win 7.)
Edit: My Gradle file looks like this
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.6.+'
}
}
apply plugin: 'android'
repositories {
mavenCentral()
}
android {
compileSdkVersion 17
buildToolsVersion "19.0.0"
defaultConfig {
minSdkVersion 17
targetSdkVersion 17
}
buildTypes {
release {
runProguard true
proguardFile getDefaultProguardFile('proguard-android-optimize.txt')
}
}
productFlavors {
defaultFlavor {
proguardFile 'proguard-rules.txt'
}
}
}
dependencies {
}
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"
if not 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...
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With