Android Studio: Error The filename, directory name, or volume label syntax is incorrect

别等时光非礼了梦想. 提交于 2020-01-21 05:27:13

问题


I am using Windows 7 64bit and switched to the latest Android Studio and I am getting this error with:

Error:A problem occurred configuring project ':myproject'.
Could not normalize path for file 'C:\Users\me\Apps\Android\android\myproject\myproject:facebook-sdk\bolts-android-1.1.2.jar'.

Error The filename, directory name, or volume label syntax is incorrect

This occurred for versions
Android Studio: 1.0.1
Gradle: 2.2.1


回答1:


This issue will come if the syntax is mismatched. Please find below scenario,
I did one mistake in my build.gradle file

    compile files(':libs/lib_ivy_android')

and I modified later like below

    compile files(':libs/lib_ivy_android.jar')

then also I got same error I did some R&D about this then finally I modified like below then no error

    compile files('libs/lib_ivy_android.jar')

So this might be a solution for you.




回答2:


I had this same error, because I add same library in both .jar and also dependency

Like this

Comment one .... Happy coding :]




回答3:


@ScottBarta and @KenWhite solved this in the comments (the : is invalid in a filename)

The problem is that the directory name is invalid, as @Scott indicated. Windows does not allow colons (:) in a filename, as that is the drive separator. C: is valid, myproject:facebook-sdk is not, as myproject: is not a valid drive letter.

Other invalid letters are

< (less than)
> (greater than)
: (colon)
" (double quote)
/ (forward slash)
\ (backslash)
| (vertical bar or pipe)
? (question mark)
* (asterisk)

As the OP said, just remove it:

removed it and now it started working for me.



来源:https://stackoverflow.com/questions/27829542/android-studio-error-the-filename-directory-name-or-volume-label-syntax-is-in

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!