Android 1.5 project in Eclipse and whenever I merely have an x

I have an Android 1.5 project in Eclipse and whenever I merely have an xml resource file open the build dies with an error. E.g. if I have theres\layout\main.xml open as the active document it won't build and throws the following error:

Error in an XML file: aborting build.
res\layout\main.xml:0: ERROR Resource entry main is already defined.

Then I have to delete main.out.xml and switch to any .java file in the project to get it to build.

Do I have something configured incorrectly or is this just an Eclipse or ADT bug?It drove me nuts for an hour before I figure out what the cause was.

share | improve this question

 
Well, I have this kind of problem, but simply Project / Clean did works for me.I removed main.out.xml from res/layout, then resaved an main.xml, then reopens project. After this magic, project builds properly. –  user560761 Jan 3 '11 at 1:57
 
I ran into the same issue.I delete first the xml files which were not parsed main.out.xml and strings.out.xml and then i go clean my project.When i re-run,everything was fine. Rgds, –  user626896 Feb 21 '11 at 16:03
 
I had the same issue, and it totally freaked me out..., the .xml.out files even caused more and more errors, anybody should mention that problem on developer.android.com thanks anyway!! –  Andy Nov 10 '11 at 10:04
feedback

5 Answers

up vote 42 down vote accepted

I ran into this as well.

If you have an xml file open and click the 'Run' button, then instead of running your Android project Eclipse will try to run a transform on the xml file. It then creates a new xml file with the output of the transform and adds it to your project. Then the project will fail to run at all because of the existence of the duplicate xml file.

So make sure you don't have any duplicate xml files in your project (look at the manifest file, as well as layout files). The way I work around this is to make sure the project tree has focus (or just select a tab with a java file) before clicking 'Run'.

There is likely a better way to handle this (via a config change perhaps), but I'm pretty new to Eclipse and that's the workaround I came up with :). Hope that helps.


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值