3

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

When I try running the app within Android Studio, and it gets built, an Icon file opens and I get 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 to work around this issue to build my app in a Google Drive folder on a Mac, or is it 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
Community
  • 1
  • 1
Gloriane
  • 217
  • 1
  • 3
  • 8

3 Answers3

4

These are the solutions we developed, based on Hod's answer.

Getting rid of all current Icon files

  1. Open a terminal window in the parent folder to your projects.
  2. To look for Icon files, execute: find . -name Icon\*
  3. If you get any results, execute: find . -name Icon\* -delete

Automatically removing future Icon files

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

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

Assumptions

All of this assumes that you have:

  • no files whose names start with Icon in your projects hierarchy that you want to keep.
  • no cron jobs involving Icon that you want to keep.
Community
  • 1
  • 1
Ellen Spertus
  • 6,576
  • 9
  • 50
  • 101
1

This is happening because you've set the icon for the folder to something besides the default. Here's an example where I've changed only the drawables icon:

Finder window showing one folder with custom icon

Setting a custom icon is what creates the Icon file. (It's normally hidden in Finder.)

To fix this, the easiest thing would be to reset the icon back to the default. To do that, in Finder, right click on the folder and select "Get Info". This will bring up the info window. Select the folder icon in the upper left by clicking on it, then in the top bar menu do Edit -> Cut. Here's an image to show the info window with the icon selected:

Finder info window with folder icon selected

That should reset the icon and fix your problem.

Another approach is to clean out all the icons under a specific folder. On the command line, change directories to the top level folder. Then run find . -name Icon\* -delete. Note this will delete any file starting with the work Icon. To test what files will be deleted, you can first run find . -name Icon\* by itself to get a list.

It may be that an unknown application is updating the icons (see comments). The command line listed above can be used to clean up the icons on a regular basis.

Hod
  • 2,236
  • 1
  • 14
  • 22
  • I reset the icon as you instructed, but for some reason it still isn't working. It still thinks there are Icon files in my project. – Gloriane Jan 21 '17 at 17:51
  • Doesn't help. It's an interaction with Google Drive. – Ellen Spertus Jan 21 '17 at 18:36
  • @espertus I don't think that's correct. I reproduced the exact same problem, removed the icons, and it builds fine. – Hod Jan 21 '17 at 21:17
  • Try running this in the top level folder of your project and see if it lists any files: `find . -name Icon\*` That should show you any left over ones. – Hod Jan 21 '17 at 21:31
  • Thanks. I'm relying on someone else to do my testing this weekend. I'll be able to myself on Monday. (I'm the mean professor.) – Ellen Spertus Jan 22 '17 at 02:54
  • 1
    I ran `find . -name Icon\* -delete` to delete all the Icon files, which worked. Do you want to add that to your answer? – Ellen Spertus Jan 23 '17 at 23:15
0

Try excluding the files or directory or folder from being compiled. In your app build.gradle file try to exclude those files. You can try the check these links 1 2 3

Community
  • 1
  • 1
Anurag Singh
  • 6,140
  • 2
  • 31
  • 47
  • That won't work. This is the exploded app compat aar directory. Not going to be able to build without including it. – Hod Jan 21 '17 at 21:19
  • You can exclude file names, not just directories from Gradle. I still think it might work if I could figure out the right syntax. – Ellen Spertus Jan 26 '17 at 16:37
  • You should paste the relevant passages from each link shared. Otherwise, if the links die in the future, users with similar questions will not have access to the information that could help them solve their problems. – Nathan Feb 07 '17 at 19:09
  • @Nathan Do you think that stackoverflow questions or answers link would die or can be unaccessible. Also share feature is only for the same. Suppose, you answer to a question on stackoverflow. What would you like the other user to do: Share your answer link or copy and paste your answer in his or her answer's decription. – Anurag Singh Feb 08 '17 at 06:45