使用 Google Drive 在 OS X 上的 Android Studio 中导致 gradle 构建失败的图标文件

2024-01-16

对于大学课程,我需要使用 Google Drive 文件夹作为我的项目位置。问题是 Google Drive 使我隐藏了 OS XIcon files https://superuser.com/questions/298785/icon-file-on-os-x-desktop出现。

当我尝试在 Android Studio 中运行应用程序并构建它时,Icon文件打开,我收到以下消息:

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

Error: The file name must end in .xml.

My res/layout文件夹包含一个Icon文件,(显然)不以.xml。我删除了该文件,但仍然遇到同样的错误。

有没有办法解决这个问题,在 Mac 上的 Google Drive 文件夹中构建我的应用程序,或者这是不可能的?

以下是上下文中的错误:

/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

这些是我们根据 Hod 的回答开发的解决方案。

摆脱当前的所有Icon files

  1. 在项目的父文件夹中打开一个终端窗口。
  2. 要查找图标文件,请执行:find . -name Icon\*
  3. 如果得到任何结果,请执行:find . -name Icon\* -delete

自动删除未来Icon files

  1. 在项目的父文件夹中打开一个终端窗口。
  2. 复制并粘贴此咒语((改编自https://stackoverflow.com/a/9625233/631051 https://stackoverflow.com/a/9625233/631051),这将删除Icon每分钟文件:(crontab -l 2>/dev/null; echo "*/1 * * * * find . -name Icon\* -delete") | crontab -

要撤消,请输入以下咒语(改编自https://askubuntu.com/a/719877/43296 https://askubuntu.com/a/719877/43296)在终端窗口(在任何文件夹中):crontab -l | grep -v Icon | crontab -

假设

所有这一切都假设您拥有:

  • 没有名称开头的文件Icon在您想要保留的项目层次结构中。
  • 没有涉及 cron 作业Icon你想保留的。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

使用 Google Drive 在 OS X 上的 Android Studio 中导致 gradle 构建失败的图标文件 的相关文章

随机推荐