本文介绍了使用Google云端硬盘在OS X上的Android Studio中导致gradle build的图标文件失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

对于大学课程,我需要将Google云端硬盘文件夹用作我的项目位置。问题在于Google云端硬盘会将我隐藏的OS X 出现。



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

生成文件夹下的文件已生成,不应编辑。



错误:文件名必须以.xml结尾。



我的 res / layout 文件夹包含一个图标文件,这显然不会以结尾。 XML 。我删除了该文件,但仍然收到相同的错误。



有没有办法解决此问题,以便在Mac上的Google云端硬盘文件夹中构建我的应用程序?或者它不可行?



以下是上下文中的错误:

  / Users / meda / GoogleDrive / Gloriane-CS115 / AndroidStudioProjects / MyFirstApp / app / build / intermediates / exploded-aar / com.android.support / appcompat-v7 / 23.4.0 / res / drawable / Icon 
错误:错误:文件名必须以.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
错误:错误:文件名必须以.xml结尾
:app:generateDebugResources UP-TO- DATE
:app:preReleaseBuild UP-TO-DATE
错误:错误:文件名必须以.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
错误:错误:文件名必须以.xml或.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
错误:错误:文件名必须以.xml或.png $ b $结尾b /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/图标
错误:错误:文件名必须以.xml或.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
错误:错误:文件名必须以.xml或.png结尾


解决方案

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

删除所有当前的 I con 文件


  1. 打开项目的父文件夹中的终端窗口。

  2. 要查找图标文件,请执行: find。 -name Icon \ *

  3. 如果您得到任何结果,请执行: find。 -name Icon \ * -delete

自动移除未来图标文件


  1. 打开父文件夹中的终端窗口到您的项目。
  2. >
  3. 复制并粘贴此咒语((改编自 ):
    crontab -l | grep -v Icon | crontab -



    假设



    所有这些都假定您有:

  4. 没有名称以 Ic开头的文件在你想要保留的项目层次结构中上。

  5. 不涉及图标的cron任务,您想保留。


  6. 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
    
    解决方案

    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.

    这篇关于使用Google云端硬盘在OS X上的Android Studio中导致gradle build的图标文件失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-23 11:26