Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
455 views
in Technique[技术] by (71.8m points)

android - Error: File path too long on windows, keep below 240 characters

So, I made some changes to my build.gradle(app) file and android studio gives me this error (open the image in new tab for better viewing): Error description from Logcat

My build.gradle(app) file (this is not the edited file, I deleted new lines of code and still no luck/solution.): Build.gradle

Everything was quite working well until I made some changes in the build.gradle(app) file, but then I deleted those new lines of codes and android studio is still keep giving me the error. The error relates to the compile 'com.google.android.gms:play-services:8.3.0'. I have tried deleting/renaming those png images inside the stated folder,but then when I rebuild the project, the png images are automatically downloaded. My build.gradle(project) file contains classpath 'com.android.tools.build:gradle:1.5.0'. I want to know what causes this error, and how to fix it? Many thanks.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

You could also try changing your build directory for your project since that is where most of the path issues will arise. In your root build.gradle file

allprojects {
    buildDir = "C:/tmp/${rootProject.name}/${project.name}"
    repositories {
       ...
    }
}

Android Studio will pick up on the change and still show your new build location in the Project view. It's a lot easier than moving your entire project.

EDIT

While Windows 10 Insider Preview now offers the ability for allowing for longer file path limits these limits currently are only actually accessible to apps which have specifically enabled support for longer file paths.

At the current time, it appears that these applications with the extended path enabled seem to be only apps that are installed via the Windows Store.

At the current time, Gradle does not and potentially cannot have this option enabled to utilize the enhanced NTFS file path length.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...