Icon files causing gradle build failure in Android Studio on OS X using Google Drive

For a college course, I need to use the Google Drive folder as the location of my project. The problem is that Google Drive makes my hidden OS X Icon files .

When I try to run the application in Android Studio and it is created, the Icon file will open and I will receive the following messages:

Files under the build folder are generated and should not be edited.

Error: The file name must end in .xml.

My res/layout folder contains an Icon file, which (obviously) does not end in .xml . I deleted the file, but I still get the same error.

Is there a way around this problem to create my application in the Google Drive folder on a Mac or is this not possible?

Here are the errors in context:

 /Users/meda/GoogleDrive/Gloriane-CS115/AndroidStudioProjects/MyFirstApp/app/build/intermediates/exploded-aar/com.android.support/appcompat-v7/23.4.0/res/drawable/Icon Error:Error: The file name must end with .xml :app:preBuild UP-TO-DATE :app:generateDebugResValues UP-TO-DATE :app:prepareDebugDependencies :app:generateDebugBuildConfig UP-TO-DATE :app:compileDebugShaders UP-TO-DATE :app:mergeDebugAssets UP-TO-DATE Error:Error: The file name must end with .xml :app:generateDebugResources UP-TO-DATE :app:preReleaseBuild UP-TO-DATE Error:Error: The file name must end with .xml /Users/meda/GoogleDrive/Gloriane-CS115/AndroidStudioProjects/MyFirstApp/app/build/intermediates/exploded-aar/com.android.support/appcompat-v7/23.4.0/res/color-v23/Icon Error:Error: The file name must end with .xml or .png /Users/meda/GoogleDrive/Gloriane-CS115/AndroidStudioProjects/MyFirstApp/app/build/intermediates/exploded-aar/com.android.support/appcompat-v7/23.4.0/res/drawable-hdpi-v4/Icon Error:Error: The file name must end with .xml or .png /Users/meda/GoogleDrive/Gloriane-CS115/AndroidStudioProjects/MyFirstApp/app/build/intermediates/exploded-aar/com.android.support/appcompat-v7/23.4.0/res/drawable-ldrtl-hdpi-v17/Icon Error:Error: The file name must end with .xml or .png /Users/meda/GoogleDrive/Gloriane-CS115/AndroidStudioProjects/MyFirstApp/app/build/intermediates/exploded-aar/com.android.support/appcompat-v7/23.4.0/res/drawable-ldrtl-mdpi-v17/Icon Error:Error: The file name must end with .xml or .png 
+3
android android-studio android-gradle google-drive-sdk macos
source share
3 answers

These are the solutions that we developed based on Hoda's answer.

Getting rid of all current Icon files

  • Open a terminal window in the parent folder for your projects.
  • To find icon files, run: find . -name Icon\* find . -name Icon\*
  • If you get any results, run: find . -name Icon\* -delete find . -name Icon\* -delete

Automatically delete future Icon files

  • Open a terminal window in the parent folder for your projects.
  • Copy and paste this spell ((adapted from https://stackoverflow.com/questions/68945/... ), which will delete Icon files every minute: (crontab -l 2>/dev/null; echo "*/1 * * * * find . -name Icon\* -delete") | crontab -

To cancel, enter the following spell (adapted from https://askubuntu.com/a/719877/43296 ) in the terminal window (in any folder): crontab -l | grep -v Icon | crontab - crontab -l | grep -v Icon | crontab -

Assumptions

All of this assumes that you have:

  • There are no files whose names begin with Icon in the hierarchy of projects that you want to save.
  • There are no cron jobs with Icon that you want to save.
+3
source share

This is because you set the folder icon for something other than the default value. Here is an example when I changed only the drawables icon:

Finder window showing one folder with custom icon

Customizing a custom icon is what creates the Icon file. (It is usually hidden in Finder.)

To fix this, the easiest would be to reset reset to its default value. To do this, in Finder, right-click on the folder and select "Get Information". This will open the info window. Select the folder icon in the upper left corner by clicking on it, then in the top menu of the panel do Edit → Cut. Here is the image showing the info window with the icon selected:

Finder info window with folder icon selected

This should reset the icon and fix your problem.

Another approach is to clear all the icons under a specific folder. At the command prompt, change directories to a top-level folder. Then run find . -name Icon\* -delete find . -name Icon\* -delete . Note that this will delete any file starting with a job icon. To check which files will be deleted, you can first run find . -name Icon\* find . -name Icon\* to get a list.

Perhaps an unknown application updates the icons (see comments). The command line above can be used to clean up icons on a regular basis.

+1
source share

Try to exclude compilation of files or directory or folder. In your build.gradle application build.gradle try excluding these files. You can try checking these links 1 2 3

0
source share

All Articles