美文网首页
一个空格引发的编译错误

一个空格引发的编译错误

作者: Doctor_Xu | 来源:发表于2020-08-07 00:59 被阅读0次

    今天对APP进行了简单的修改,增加了几个资源图片,很想当然地认为增加几个图片而已,并不会引起什么问题,可是没有想到,因为一处极其极其微小的不注意的错误,竟然耗费了两个半小时定位和解决问题。

    如下是编译日志

    build/make/core/base_rules.mk:495: warning: overriding commands for target out/target/product/cezanne/system/etc/init/traceur.rc' build/make/core/base_rules.mk:495: warning: ignoring old commands for targetout/target/product/cezanne/system/etc/init/traceur.rc'
    build/make/core/base_rules.mk:495: warning: overriding commands for target out/target/product/cezanne/system/etc/init/incidentd.rc' build/make/core/base_rules.mk:495: warning: ignoring old commands for targetout/target/product/cezanne/system/etc/init/incidentd.rc'
    build/make/core/Makefile:28: warning: overriding commands for target out/target/product/cezanne/system/etc/permissions/android.software.live_wallpaper.xml' build/make/core/base_rules.mk:480: warning: ignoring old commands for targetout/target/product/cezanne/system/etc/permissions/android.software.live_wallpaper.xml'
    [W][2020-08-06T21:59:06+0800][31589] void cmdline::logParams(nsjconf_t *)():250 Process will be UID/EUID=0 in the global user namespace, and will have user root-level access to files
    [W][2020-08-06T21:59:06+0800][31589] void cmdline::logParams(nsjconf_t *)():260 Process will be GID/EGID=0 in the global user namespace, and will have group root-level access to files
    21:59:06 AllowBuildBrokenUsesNetwork: true
    21:59:06 BuildBrokenUsesNetwork: true
    FAILED: ninja: 'packages/apps/Mmi/app/src/main/res/.bmp', needed by 'out/target/common/obj/APPS/Mmi_intermediates/flat-res/packages/apps/Mmi/app/src/main/res_.bmp.flat', missing and no known rule to make it
    FAILED: [W][2020-08-06T21:59:06+0800][31599] void cmdline::logParams(nsjconf_t *)():250 Process will be UID/EUID=0 in the global user namespace, and will have user root-level access to files
    [W][2020-08-06T21:59:06+0800][31599] void cmdline::logParams(nsjconf_t *)():260 Process will be GID/EGID=0 in the global user namespace, and will have group root-level access to files
    21:59:08 ninja failed with: exit status 1
    从编译日志上看,确实是编译资源文件出现了异常,可是怎么也想不到为何会出现异常,回退代码至提交前,编译能够正常通过,自己猜测添加的代码也没有问题,可是就是编译不过。
    经过仔细对比代码,发现在代码中获取资源文件时,在资源文件后面 多添加了一个空格,而编辑代码是在文本编辑器中编辑的,并没有使用IDE进行编辑,这也为出现问题带来了隐患。
    packages/apps/Mmi/app/src/main/res_.bmp中res_.bmp已经明确地提示出来了,根据res去查找.bmp资源文件时,res后面有个空格,而实际的资源文件的命名里面,并没有空格,所以才会提示编译失败
    编译时需要.bmp文件,而实际的资源文件中并没有.bmp文件。

    相关文章

      网友评论

          本文标题:一个空格引发的编译错误

          本文链接:https://www.haomeiwen.com/subject/kzsxdktx.html