繁体   English   中英

XML格式不正确

[英]XML not well formed

我正在尝试构建我的Android应用程序,它抛出错误:

Error:(1) Error parsing XML: not well-formed (invalid token)

我对Stack进行了一些研究,当人们混合使用xml和java时,他们有一个类似的问题。 在查看错误后,它将它丢弃为我正在使用的.png文件,这对我来说没有多大意义。

这是一个更多的错误显示:

Error:(1) Execution failed for task ':BeerPprtfolio:processDebugResources'.
> com.android.ide.common.internal.LoggedErrorException: Failed to run command:
    /Users/Mike/Documents/adt-bundle-mac-x86_64-20140321/sdk/build-tools/19.1.0/aapt package -f --no-crunch -I /Users/Mike/Documents/adt-bundle-mac-x86_64-20140321/sdk/platforms/android-21/android.jar -M /Users/Mike/Documents/beerPortfolio/beerportfoliov3/BeerPprtfolio/build/intermediates/manifests/full/debug/AndroidManifest.xml -S /Users/Mike/Documents/beerPortfolio/beerportfoliov3/BeerPprtfolio/build/intermediates/res/debug -A /Users/Mike/Documents/beerPortfolio/beerportfoliov3/BeerPprtfolio/build/intermediates/assets/debug -m -J /Users/Mike/Documents/beerPortfolio/beerportfoliov3/BeerPprtfolio/build/generated/source/r/debug -F /Users/Mike/Documents/beerPortfolio/beerportfoliov3/BeerPprtfolio/build/intermediates/res/resources-debug.ap_ --debug-mode --custom-package com.beerportfolio.beerportfoliopro -0 apk --output-text-symbols /Users/Mike/Documents/beerPortfolio/beerportfoliov3/BeerPprtfolio/build/intermediates/symbols/debug
  Error Code:
    1
  Output:
    /Users/Mike/Documents/beerPortfolio/beerportfoliov3/BeerPprtfolio/build/intermediates/res/debug/layout/ic_drawer.png:1: error: Error parsing XML: not well-formed (invalid token)

错误:解析XML时出错:格式错误(无效令牌)

因为在res/layout文件夹中添加了ic_drawer.png图像,但res/layout文件夹用于在xml中放置屏幕的布局。

ic_drawer.png文件移动到drawable文件夹中。

同样在代码和xml文件中,请确保不要将ic_drawer.png作为R.layout.ic_drawer获取,因为ic_drawer是图像所以使用R.drawable.ic_drawer获取代码或xml中的ic_drawer.png id

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM