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):
My build.gradle(app) file (this is not the edited file, I deleted new lines of code and still no luck/solution.):
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.
Cause of problem : 'C:\users...\commom_google_signin_btn_text_dark_normal.9.png' icon path length is greater than 240 character which exceeds Maximum File Path Length Limitation of Windows OS.
Solution is : Move your project into top directory like 'C:\your_project' or reduce length of your project name.
Here is windows path limit chart
I agree with Vladimir Dimov answer. You must choose the short path for your project as it is mentioned that the file path should be below 240 characters on Windows. This link helps me out : http://www.feelzdroid.com/2016/01/android-studio-error-file-path-too-long-windows.html
As an addition on lodock's answer, you can use a hash on the project path if you have lots of projects with the same name:
I was facing the same issue , my project is in C drive and it is in deeper path location, What i did I just moved my project to other lower deep path location and it works, you just change the project location and project should not be in deep location hierarchy.
You Should Have To Keep Your Project Directory As Less Deep As Possible For Example:- D:/AndroidWorkSpace/ProjectName
Because Android Studio Support Only 240 Character length of Project Path
Thanks
Shortening project paths is really a bit of a hack, Ivan Neeson's response seems the way forward.
If you are lucky enough to be using Android Studio then you will see a useful error message about file length. If however you hit the same issue doing a command line ionic build all you will see if some kind of crunch error for a png file and it's not so obvious.
The real issue is Google Play Services having such extravagant filenames such as common_google_signin_btn_text_light_normal_background.9.png which is simply not Windows friendly. Dump that inside an Android build and the path explodes outside our control to platforms\android\build\intermediates\exploded-aar\com.google.android.gms\play-services-base\10.2.1\res\drawable-xhdpi-v4\common_google_signin_btn_text_light_normal_background.9.png