19

I am trying to fix a problem in Eclipse for like 3 hours and I haven't made any progress. Tomorrow is the customer coming to look at my app, and I have no time left. This is really frustrating!

This morning when I was coding and I wanted to run my app on my device Eclipse crashed all of a sudden. 'aapt.exe has stopped working'

After this Eclipse wasn't starting anymore. It froze at the splash image.

I looked on the internet and tried different solutions like going back to Java SE 6 update 20, changing .ini file etc. in the end reinstalling Eclipse did the job.

Shortly after that the 'aapt.exe has stopped working' returned. I found a solution by changing my projects target. 1.5, 1.6, 2.2 doesn't matter, as long as it's different than the one before.

Now I get the Error generating final archive: java.io.FileNotFoundException: C:\xxx\bin\resources.ap_ does not exist error.

I tried clean but that doesn't work. Deleting and automatically regenarting R.java also didn't work.

I ran the same code in Netbeans with the Android plugin and there it gives me the 'aapt.exe has stopped working' again :(

Please guys, how can I fix this?

Edit:

I think I may have found the reason. These are the error lines in the console:

org.xmlpull.v1.XmlPullParserException: Binary XML file line #3: <bitmap> requires a valid src attribute
at android.graphics.drawable.BitmapDrawable.inflate(BitmapDrawable.java:341)
at android.graphics.drawable.Drawable.createFromXmlInner(Drawable.java:779)
at android.graphics.drawable.Drawable.createFromXml(Drawable.java:720)
at com.android.layoutlib.bridge.ResourceHelper.getDrawable(ResourceHelper.java:150)
at com.android.layoutlib.bridge.BridgeTypedArray.getDrawable(BridgeTypedArray.java:668)
at android.view.View.<init>(View.java:1846)
at android.view.View.<init>(View.java:1795)
at android.view.ViewGroup.<init>(ViewGroup.java:282)    
at java.lang.reflect.Method.invoke(Unknown Source)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:619)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:574)
at org.eclipse.equinox.launcher.Main.run(Main.java:1407)
at org.eclipse.equinox.launcher.Main.main(Main.java:1383)
[2011-01-17 16:37:20 - gegevens.xml] Unable to resolve drawable "com.android.layoutlib.utils.ResourceValue@267e33de" in attribute "background"

The file it's talking about is 'bg.png'. It's a small png file which I repeat in a .xml file.

<?xml version="1.0" encoding="utf-8"?>
<bitmap xmlns:android="http://schemas.android.com/apk/res/android"
android:src="@drawable/bg" android:tileMode="repeat" />

This file has worked from the first time without any problems. I deleted it from the drawable folder, waited for an error message, and then added it back. The red x next to the foldername got away, but still nothing different...

Galip
  • 5,435
  • 10
  • 37
  • 47

14 Answers14

10

A shot in the dark, but if it's just the one PNG file could you delete it from the project and add it back? There must be something breaking the resources file.

Mike Yockey
  • 4,565
  • 22
  • 41
  • 4
    It was indeed the 9-patch png file which caused it. However, just deleting it and adding a working png file didn't solve it. I reverted to an old, working, version on our SVN and manually added the .png's one by one. I found the one that caused it and I'm using a different one now and it works. Really frustrating that Eclipse didn't gave me an error message and it acts so instable. Ruined my whole afternoon by reinstalling everything.. – Galip Jan 18 '11 at 08:39
  • Might be related, but from the little android experience I have, it looks like that generated R file can get bogged down if you write invalid code when the project is building that particular chunk. A clean usually works to fix the errors. – Heckman Jan 24 '12 at 16:10
  • I had a .png file whose name could not be a resource name. – 18446744073709551615 Apr 01 '15 at 14:30
9

I just encountered the same error after performing an SDK update withing Eclipse (Indigo). Normally I would either delete the errors and try to rebuild or clean with success, however this time it didn't fix the problem.

Finally I went to the android sdk folder and manually updated. Upon coming back into eclipse I got the error again, but without rebuilding or cleaning I was able to launch the application onto the device by pressing play for a second time.

EDIT:Apparently this problem is intermittent, as I am now once again unable to run on the device, or export the signed apk.

SOLVED: The problem stems from a corruption in the .metadata folder. I discovered this by re-installing Indigo, but when doing so I didn't remove the original workspace folder. The problem of course showed up again. I deleted the .metadata folder completely, which effectively resets all of your eclipse configuration settings. All deployments and signing work flawlessly now. Just had to setup the environment to my liking again, which takes a few minutes as opposed to the hours I spent troubleshooting this.

ninehundreds
  • 1,097
  • 2
  • 21
  • 43
  • I had the same exact issue in the past two days after I updated to ADT r14 and SDK Manager! I don't know how I can thank you! I tried to reinstall Eclipse, but I didn't think of the damned .metadata folder. +100 my friend. :D – frapontillo Oct 21 '11 at 10:52
  • 1
    +1 Awesome, it solved my problem, thanks a lot. Now that it's fixed I can carry on working on a Sunday night at 23:30 for my presentation tomorrow. If only I could find your post and hour before I left work on Friday... – DarthJDG Oct 30 '11 at 23:33
6

I just ran into this same problem after importing my project from another machine, but didn't have any errors in the console like the OP. I unchecked Project->Build Automatically and then did Project->Clean and this solved my problem. I was actually missing several files in the bin/ directory for my project and this fixed them all.

bhankins
  • 61
  • 1
3

I think this error can come up for a variety of reasons. The following solution is only known to be specific to the same error message appearing when using ADT 14 (released yesterday) with build output set to Verbose:

I ran into the same error using Eclipse 3.7 (Indigo) after upgrading to ADT 14 and SDK 14 on all projects including newly created ones. I found a workaround someone posted on the ADT bug tracker, which is basically to switch Eclipse Settings->Android->Build->Build Output from "Verbose" to "Normal". The post is here.

TomW
  • 56
  • 2
3

In my scenario, yesterday upon open Eclipse was trying to download updates and I cancelled it since I was using my cellphone hotspot. I tried the metadata folder delete solution mentioned here and didn't work for me. Going to Window->SDK Manager and updating everything seems to be my solution.

Aaron
  • 31
  • 1
1

I had the same issue in that I added some images into each resource directory and unfortunately named them .png. There were in fact jpegs and the eclipse plugin was flagging this (unbeknown to me in the console)

The issue I found was that if you clear the console then the logging info is lost and it doesn't log anything again!

Changing the extension from .png to .jpg fixed my issue

Richard Parkins
  • 147
  • 2
  • 11
  • Yes, changing the extension from .png to .jpg fixed my problem as well. The reason could have been that the original image on the internet was jpg, but I tried to save it on my machine as png. – IgorGanapolsky May 15 '11 at 18:16
1

Above solution didn't worked for me.

The way I did that is updating not only ADT but SDK as well. To do that just go to Android SDK Manager and just download updates.

IT WORKS!

1

It's very meaningless but changing build mode from verbose to silent did the trick! Nothing else (cleaning project, re-opening , re-installing) did.

Josh
  • 10,961
  • 11
  • 65
  • 108
barraqda
  • 11
  • 1
0

In some cases, this error will disappear after fixing upstream errors. In my case that was a version incompatibility in 'fullwebview.xml'.

There, 'layout_width'/height was set to a value not supported in my build target, 2.1. Changing the value to 'fill_parent' solved the issue.

christopherbalz
  • 722
  • 1
  • 8
  • 22
0

I encountered this same error but then I saw that my layout.xml was not catching an error for a TextView whose android:text="@string/my_unmapped_string string resource was not mapped in strings.xml. So when I viewed the graphical layout it was showing:

Couldn't resolve .....

When I mapped the resource properly and ran the project again, it worked fine and that bin\resources.ap_ does not exist error was gone :)

Anup Cowkur
  • 20,443
  • 6
  • 51
  • 84
0

In my case, it was the file add-icon.175x175-75.png (valid file name, but invalid resource name) copied into res/drawable by mistake. After removing this file, Eclipse did (in April 2015) a few successful builds with incorrect sources, and only then began to behave sensibly, showing me missing resources and malformed XML (I changed the layout).

18446744073709551615
  • 16,368
  • 4
  • 94
  • 127
0

Try running clean, but also uncheck build automatically and click "build project" under the "Project" menu. Once you build manually, you can re-check the "build automatically".

I would also shutdown eclispe, and then kill adb

> adb kill-server
Ryan Conrad
  • 6,870
  • 2
  • 36
  • 36
  • Unfortunately this didn't work either :( resources.ap_ still doesn't exist – Galip Jan 17 '11 at 15:27
  • That file should be built and maintained automatically by the egit plugin. Could one of your resources be corrupt causing the building of that file to fail? – Mike Yockey Jan 17 '11 at 15:37
  • I haven't added or deleted a resource file, so how would I know which one could cause it? – Galip Jan 17 '11 at 15:39
0

Sometimes this error happens when you create ninepatch with wrong black dots/lines. For example right and bottom lines must be solid with no dashes or empty regions.

Jonas Heidelberg
  • 4,984
  • 1
  • 27
  • 41
Roger Alien
  • 3,040
  • 1
  • 36
  • 46
0

Try in

windows-> peferences -> android -> Build -> Build Output

Silent

http://code.google.com/p/android/issues/detail?id=20395

Stecya
  • 22,896
  • 10
  • 72
  • 102
Germán Bouzas
  • 1,430
  • 1
  • 13
  • 18
  • 2
    Welcome to StackOverflow. First, answers that contain links to external sites without any other information are not good answers; if the external link is down or disappears for some reason, your answer becomes meaningless. You should explain the solution, and then add the link as an additional reference. Second, I looked at the link you posted, and don't see any relationship between it's content and this question other than that the linked article mentions `aapt.exe`. Can you edit your answer to clarify how that link answers the question asked? Thanks. :) – Ken White Dec 09 '11 at 20:06