3

I am facing this issue.i google it but find the solution moving the project to short path but i want to know why android cannot handle this.

Error: File path too long on Windows, keep below 240 characters : E:\ccavenue\Seamless\Integration Source Code\ccavenue-mobile(OTP-Auto Read Kit)\TestOTPAppNew\app\build\intermediates\exploded-aar\com.android.support\appcompat-v7\23.3.0\res\drawable-xxhdpi-v4\abc_textfield_search_activated_mtrl_alpha.9.png

Mohit Madaan
  • 469
  • 2
  • 11
  • 3
    The error message says it already: keep below 240 characters – mjn Jun 17 '16 at 11:31
  • gradle works with **relative paths** and compiles the long project-paths. android-studio-2.2 works with **absolute paths**. Is there a way to tell android-studio-2.2 to work with relative paths? – k3b Nov 03 '16 at 19:46
  • duplicate of http://stackoverflow.com/questions/33905687/error-file-path-too-long-on-windows-keep-below-240-characters – k3b Nov 03 '16 at 19:54

2 Answers2

2

A far more simpler way to resolve this issue rather than moving/ creating multiple copies of your application folder:

  1. Create a shortcut of your application folder "TestOTPAppNew"
  2. Move the shortcut to an outside shorter path like C:\Documents\TestOTPAppNew_Shortcut
  3. Put this entry in your main build.gradle

    allprojects {
    **buildDir = "C:\\Documents\\TestOTPAppNew_Shortcut\\${rootProject.name}/${project.name}"**
    repositories {
        jcenter()
    }}
    

Rebuild and you are all set!!

Vicky Kapadia
  • 6,025
  • 2
  • 24
  • 30
1

Your Error Says that In windows the file path length cannot be longer than 240 characters, so this error message simply means that you've reached the limit. For example:

C:\programs\folder1\folder2\folder3\folder4\folder5 etc..

Try to move it somewhere else, like

E:\Projects\Project1

and if even that is too long try just extracting it in E:\ directly.

Abhishek Patel
  • 4,280
  • 1
  • 24
  • 38