Eclipse and Android SDK issue "aapt.exe has stopped" - android

I'm having an issue on my Windows 7 64-bit machine with aapt.exe. It is throwing the following error:
aapt.exe has stopped working
Its not project related, Since i've tried multiple projects, it seems to happen with any workspace in Eclipse as well. New project or old project it just keeps failing when building and running my application.
I'm using the latest JDK-6 with the latest Android SDK 22.0.1, with Build Tools and Platform tools.
Deleting the entire SDK and Eclipse and unziping and resetting up doesnt seem to resolve it either.
Any ideas?

Remove id from style like here #+id then build again you get success...
<item name="android:id">#+id/calender</item>

it seems you were missing some entries in strings.xml
in my case I was deleting <string name="action_settings">Settings</string>
thinking it was not used by the project and placing it back solved the issue. You can search for same or similar type of tag in you project.

This can also happen if you have an incorrect option in an item. Example:
<item
android:id="#+id/menu_dashboard_add_group"
android:icon="#android:drawable/btn_plus"
android:title="Add group"
android:showAsAction="true">
Note the true that is invalid for android:showAsAction

Happens when you don't put #+id/ in menus/layout xml files.

Apparently it seems that the only thing that worked for me was writing back the resourse <string name="action_settings">Settings</string> after which the problem appeared. Actually I erased it in the first place because it was not used througout my open project...

For me, this happened when I included a ” or ' character.
I'd replaced the apostrophe with &apos;, but aapt still wanted the prefixing backslash.

Not sure but please try to use the Android SDK Build-Tools v18.1.1 instead of 19.0.1
It might be the case that you have error in your resource files, the v19 build-tools won't report the error but keep failing to compile the R.
Please read more detail in the 2nd comment of the question below. I also wrote the some steps I went through in the first reply. hope this will help solving your problem.
'aapt' error. Pre Compiler Build aborted

Donot forget + sign for id attributes in menu.xml files
<item android:id="#id/action_download_time"
vs
<item android:id="#+id/action_download_time"

Check if you have any string values with html codes such as non-breaking-space ( ) Remove them and clean the project. It should work.
Ram

For me it happend after creating a new activity by
your_package-Right-Click-> Create a new-> "Android Activity"->Fill fields->"Done"
I solved it by reverting to previous version of my app

It also happend for me IF ASSETS FOLDER exist any file without resolution
for examle:
if ASSETS FOLDER exist any file
file:///android_asset/html/qwwww
[result] BUG! “aapt.exe has stopped”
To solve it all files should have a resolution
file:///android_asset/html/qwwww.css

For me it was the buildToolsVersion '21.0.0' the old one buildToolsVersion '20.0.0' works for me but the newer one crashes the aapt.exe.

Related

Android App Compile Not Generating Package Resources

When attempting to compile my Xamarin.Android app I get the compile error:
Error 3 The file "obj\Debug\android\bin\packaged_resources" does not exist. MyApp.UI.Droid
This error occurred after I made some changes (added some new classes - cannot remember what it was). But I didn't change any project settings, nor go delete actual files in the obj folder.
What is the cause of this error and how can I fix this?
Some information that may be useful:
The project is a Cross-Platform PCL project - Core, Android, and iOS Projects
The project uses MVVM Cross
I encountered the same issue. Ensure that your resource files do not include any special characters
The actual error you may be encountering is:
Invalid file name: must contain only [a-z0-9_.]
Change your build output verbosity in visual studio to see better log output.
I´ve had the same issue.
Then i´ve reviewed my resource file names.
Solution:
One file was using "-" in it´s name. (invalid character)
Then i replaced for "_" (underline).
PS:
=> file name: must contain only [a-z0-9_.]
You will need to grub down by switching on Verbose output. What is stopping the generation of packaged_resources?
In VS2013 choose Tools --> Options --> Build and execute, choose verbosity Diagnostic.
In VS2015, the same option is in Tools --> Options --> Projects and Solutions --> Build and Run.
In my case, it was a hyphen character in the name of the action property of an Intent filter, but choosing verbose output will point you to the line that has the problem.
Follow the steps below to identify the problem:
1 - In Visual Studio: Tools> Options> Projects and solutions> Build and Run.
1.1 - In the dropdown: MSBuild project build output verbosity:> Diagnostic.
1.2 - Close the dialog box.
2 - View> Output (Ctrl + W, O).
3 - Run the build or rebuild.
In the output find the line:
C:\Program Files
(x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1665,3):
error MSB6006: "aapt.exe" exited with code 1.
What is just above this error is what caused the error.
i also found that removing the packages in Tools/Preview Channel and Android N AND ALSO Android SDK Build Tools rev 24, done a build and worked.. This is a complete new portable project/android/ios
Another possibility is you have an issue with the installed Android SDK build tools. For me, when I removed the package for Revision 24 it worked.
From Xamarin Forums:
First of all go and deinstall preview tools in your android sdk
manager. If you havent installed it but still get the same error then
go and deinstall Android SDK Build Tools Rev. 24.
The Problem we have here is that, if you have Appcombat, RecyclerView
or something like that in your project, the library rev of these
librarys are below rev 24. They are still on 23.2.1 but not on rev 24.
So if you installed Build-Tools Rev 24 and want to build your project
the build cant find the rev24 resource package of your librarys.
You can check it on your own Go in the SDK Manager and check "Obsolete" Then go to the folder Extras and there you can see
"Android Support Library (Obsolete) Rev 23.2.1. And then check if
there is Android Support Library Rev 24 in your Extras Folder. No? And
thats the Problem here. We got the Update for Build Tools to early and
have to wait for Library Update. Then we all can use Build Tools 24!
So only update to BuildTools Rev 24 when we got an update for support librarys and have the rev24 librarys.
Basically the problem is with special character of Resource FILE NAME.
In my case, I am keep getting error "The file "obj\Debug\android\bin\packaged_resources" does not exist.":
..\Resources\drawable\company-app-log.png having -(hyphen) between alpha characters is the root-cause of the issue.
Using Xamarin Studio here -
Sometimes this is caused by AXML errors.
Which if you turn on detailed / diagnostic in preferences you can
search the build output (or your packaging output) for the word ERROR.
For example, somebody checked in some AXML line(s) with -
android:Text="something"
and the uppercase T was causing this error -
Resources/layout/Somefile.axml(11): error APT0000: No resource identifier found for attribute 'Text' in package 'android'
Fixing the errors fixed the original message.
Firstly, i suggest you change "show out put from" Build to Xamarin to see the real error and its details as seen in my case
At first
And then
please make sure you installed your NDK properly. That was the issue with mine,
and please make sure the NDK directory is also set
hope this helps someone
I just lost 7 hours of my day.. You know what I did?
Project.Droid -> Resources -> RightClick on the Resource.Designer.cs -> Delete
I did fu****n' works ! ><
EDIT
Omg it did comes back... Why does Windows has all time so much of bugs... seriously..
Same annoying problem with me!
But I found a solution: read carefully this article:
https://gxconsultancy.wordpress.com/2016/04/04/to-use-xamarin-or-not-to-us-xamarin/
In short:
Make sure you have JDK 32bits version 8 at least - same for the JRE, included in the JDK installation kit from Oracle;
Set your project for using the Xamarin debugger (right-click your project, hit Properties / Android Options / Packaging / Debugger);
And now the most weird: delete the app/Resources/drawable folder; have a working Xamarin project and copy its "drawable" folders to the erratic project (usually there are several subfolders, like drawable-hdpi, drawable-mdpi and so fort).
Rebuild your Android project.
I had the problem so I deleted build-tools 24.0.0 and I used build-tools 23.0.3 and the problem solved. Try it!
make sure that your resources don't have any special character or start with number
Encountered same issue in VS 2015 and Xamarin 7.2.0.7. In my case, the issue happened just suddenly, and turned out the issue caused by wrong element name in axml, traced using Tiago's answers above.
So I didn't find the line Tiago mentioned with aapt.exe, but I then I tried to search for keyword failed in output. Then I found one telling me about margin. In android, margin is set using android:layout_margin. I played with element and forgot and put android:margin instead, thus also why it happened so sudden after so many successful run. Fixed it and the build succeeded.
In my case the error was caused because I set the version number in the manifest to 1.0. Apparently the version number must be an integer.
Had the same problem. My error was in the manifest: I had Version Code (Version number) set at "1.0.0" and it wasn't allowed. It only takes integers so I had to revert to "1".
I mixed up Version Code and Version Name.
For me this error was caused by having an invalid attribute value in a layout xml. I had
android:id="button"
changing it to
android:id="#+id/button"
fixed the error.
Not sure if this is a late answer, but this specific error message occurs for one of the two reasons:
(Most probably the case): In your layout file, you may have mentioned a resource (drawable/image) incorrectly. For example, the image was in the mipmap folder path but you have pointed it wrongly to the drawable folder path.
Per many comments, there could be a hyphen or special character in one your resources' names or it starts with a number. However, please note, in this specific case, you will mostly see a aapt.exe has stopped or appt.exe has exited with error code 1 error. I am not sure if you will get obj\Debug\android\bin\packaged_resources not found error. My experience says that point 1 above is the case.
Got this error in Visual Studio 2017 Xamarin android project on Windows.
After lot of experiments with resource's files I found, that filename length and extension of image file in the drawable folder affect the result of compillation!
drawable/abcde.png - compilled ok
drawable/abcdef.png - error, "obj\Debug\android\bin\packaged_resources" does not exist
If rename image to file without .png extension, compilled without errors.
Spended a lot of time and was confused :-/
I had the same problem. To solve I had to remove all nuget packages from droid project, and reinstalled xamarin.forms again (has to be same version used in other projects).
had the same issue. This was because i had an .png file that had a "-" character in it's name. Just enusure any of your resources don't have the "-" hyphen character

Android Studio: “Execution failed for task ':app:mergeDebugResources'” if project is created on drive C:

I added Google Play services as a dependency in my current project.
If I save the project on the C: drive,
I get the following error while syncing up the project:
Error: Execution failed for task ':app:mergeDebugResources'.
> Error: Failed to run command:
C:\Program Files (x86)\Android\android-studio\sdk\build-tools\android-4.4.2\aapt.exe s -i C:\Users\ashokp\Desktop\Studio\AndroidV2SDK_AndroidStudioFormat\Google Play
Services\SampleApplication\AndroidV2SDKSampleApp_GooglePlayServices\app\build\exploded-aar\com.google.android.gms\play-services\4.3.23\res\drawable-hdpi\common_signin_btn_text_focus_light.9.png -o
C:\Users\ashokp\Desktop\Studio\AndroidV2SDK_AndroidStudioFormat\Google Play
Services\SampleApplication\AndroidV2SDKSampleApp_GooglePlayServices\app\build\res\all\debug\drawable-hdpi\common_signin_btn_text_focus_light.9.png
Error Code:
42
This only happens if the project is saved on the C: drive.
If I save it to some other drive, it works perfectly.
Does anyone else face this issue?
What causes this?
How can I fix/circumvent this?
This is caused by the path length restriction.
I think it's 256 characters maximum.
Relocate your project and the build will succeed.
I had the same problem. Try to go to Build - Rebuild project. I didn't get that problem again and my app successfully started.
For developers who live in Iran, Just rebuild while offline. You're done! (it's related to sanctions!)
I have a similar problem with Error:Execution failed for task ':app:mergeDebugResources. And at last I found the reason is the pictures resource error which use the incorrect ".9.png".
add this in module's build.gradle.
android{
aaptOptions.cruncherEnabled = false
aaptOptions.useNewCruncher = false
}
In drawable assets there was an image format which was an unsupported image. When i removed the image every thing started working fine.
In my case
I Followed This answer
Changed the location of project.
Tried another android device [Build and success install]
Tried on my android device [Build and success install * Uninstall any previous version of same app on device]
Edit-
Again it happend
I had this error message and lot of others like
x-version is deprecated and use y-version instead and it'll be removed in 2019
and all of my project started giving same error messages suddenly.
Android studio was giving warnings about my antivirus program. I tried configuring it but didn't work.
Finally I uninstalled QuickHeal antivirus from my system and all is well now
I was facing this issue after i updated to Android-Studio 3.6 the only way that worked for me was downgrading project build.gradle setting by changing
from
dependencies {
classpath 'com.android.tools.build:gradle:3.6.0'
}
to
dependencies {
classpath 'com.android.tools.build:gradle:3.3.0'
}
In my case, I created a folder audio in res directory. That caused the problem! Deleting the folder fixed it. Hope it might help someone.
I encountered the same error.
In the end, the problem was that I used an image in res/drawable that I copied in there and saved it as .png although the original file was .jpg .
I deleted the file (there's a warning message if there are still usages for the item in your code, but you can ignore it) and pasted it in with the original .jpg ending.
After a cleanup and gradle syncronization the error disappeared.
In Android Studio 1.4 with buildToolsVersion '22.0.1' the approach of fvasquezc23 worked for me with a restart and cache invalidation.
So, after you change the location of your project folder – copy/paste the folder onto disk D: (or somewhere else with no big ‘folder in folder’ structure), just
go to “File” -> “Invalidate Caches/Restart” (below “Synchronize”)
select first option “Invalidate and Restart”
Remove any capital letters or other not allowed symbols in resource file name.
Example: activity_parkingList --> activity_parking_list
Update your gradle build tools in project level gradle , and it will show you the exact resource that is causing the error.
Dont make name with capital letters . Always use lowercase for naming . This will work fine .
like companyLogo.png will raise error but company_logo.png will work fine.
If you are using ionic
in config.xml update widget tag with "xmlns:android="http://schemas.android.com/apk/res/android"
<widget id="io.ionic.starter" version="0.0.1" xmlns="http://www.w3.org/ns/widgets" xmlns:android="http://schemas.android.com/apk/res/android" xmlns:cdv="http://cordova.apache.org/ns/1.0">
<widget/>
Adding the right repository in Project build.gradle solved the issue.
In my case Google Maven Repository was needed and was added as below in the build.gradle
repositories {
google()
}
refer to this link for declaring repositories:
https://docs.gradle.org/current/userguide/declaring_repositories.html
If you are working on PC of a company that uses a proxy you must turn on your VPN
when we add some new thing in out project, in that case some times resources might get duplicate that time it will give the error while run the app, in my case also get same issue I had face, while I had added the kotlin activity in java project, in it gives me error
Execution failed for task ':app:mergeDebugResources'.
...\themes.xml: Error: Duplicate resources
so in this case please check the local history and remove the duplicate resources from res folder, so simply revert that changes
I just found out that I had defined some color in colors.xml twice and after commenting one of them out, it solved the issue. and now i'm furious
I encountered this error and by process of elimination I discovered the problem to be a single apostrophe (') in a string resource. (Specifically, a string array item.) Replacing the apostrophe with the ' entity didn't work either. Escaping it with \' however, did work and my project built. I discovered the proper escape code through Android Studio's string resource editor. The build error message was completely unhelpful.
In my case, the problem was caused by having a button with an angle bracket inside android:text field:
<Button
...
android:text="<-"
/>
Changing it to android:text="back" fixed everything.
While having "<-" as a hardcoded text on a button isn't the best practice, it's a shame people have to spend so much time on finding solutions to these kind of issues without getting any informative hints from gradle on what is wrong.
I encountered this issue while working on a Flutter Application. I solved it by going to Tools > Flutter > Flutter Clean.
I my case, I had duplicated properties in the xml file. The 'android:layout_height' was in my layout tag and also in one of his child.
Check if all the files in the values folder are correct. In my case it was the strings.xml where I forgot to escape single quotes.
In my case this error was due to character in string.xml file.
from
<string name="machine_coords">MACHINE\nCOORD'S</string>
to
<string name="machine_coords">MACHINE\nCOORD"'"S</string>
In my case the problem was with the recent change in color XML i failed to insert '#' into the XML file. Please check ur recent changes that can be a cause for concern for this error.
This caused the problem for me: I put an ' character on my "strings.xml" file and it crashed everything.
After deleting that ' character it works...
You have " ' " symbol in your strings or arrays somewhere ... erase it !!!
I have LET'S DOI IT , after erasing " ' " and LET'S was LETS , problem disapered
I had rebased on master branch that had a new module addition.
and i had "offline mode" ON for gradle. turned it on and rebuilt the project.
it worked for me.
happy coding.
Cleaning the project worked for me, Build > clean project.

AAPT failing with error code -1073741819

Building the project throws the following error from AAPT. I've rebuilt the project, but it is still failing. I can't find any references anywhere to what this error code actually means. I'm using Java 6, and Android tools r19 in IntelliJ with ActionBarSherlock v4.1.0.
I/O error: Command
"C:\android-sdk-windows\platform-tools\aapt.exe package -m --auto-add-overlay --extra-packages com.actionbarsherlock -J C:\Users\Ollie\.IntelliJIdea11\system\compiler\project6.b9f5599b\.generated\aapt\Project.9617c193\production -M C:/Users/Ollie/Documents/Dropbox/Tech/project6/Source/project6/AndroidManifest.xml -S C:/Users/Ollie/Documents/Dropbox/Tech/project6/Source/project6/res -S C:/Users/Ollie/Documents/Dropbox/Tech/project6/Source/actionbarsherlock/res -I C:\android-sdk-windows\platforms\android-14\android.jar"
execution failed with exit code -1073741819
This build failure started happening after I added a dependency from my project to the ActionBarSherlock library project. If I remove that dependency, the project builds fine. If I add it back, it fails again.
I had this problem under windows, I fixed it by removing a #+id in a style item definition in the styles.xml. I spoke to someone else who didn't know exactly why but had found using +id in style files to often cause problems.
Update Oct. 27, 2014 -
the problem is fixed with Android SDK Build-tools rel. 21.0.2, sigh of relief... Guess I'll leave the rest of this post as it was, in case someone with v. 21.0.1 runs into this problem, or if the bug returns in future releases of the tools. Maybe it'll save someone bunging head against a tool-bug wall, reviewing all other posts and their code for a whole day.
Original post from Oct. 18, 2014
A new twist on this old issue... Today, Oct. 18, 2014, after upgrading to just released Android SDK v. 21 on my Windows 7 computer, using aapt.exe from android-sdk\build-tools\21.01\ directory crashes each time with the same exit code -1073741819. Tried all the answers suggested in this thread before my post to no avail. Then just copied the old version of aapt.exe from 20.0.0 (also tried from 19.1.0 tools directory), and in each case it worked fine. No issues (just had to clean-rebuild the project with each version of aapt.exe tested).
Is aapt.exe for Windows, in Android SDK built tools version 21.0.1 broken? Does anyone else see this problem?
Greg
For anyone else experiencing this issue in Android Studio, this is how I solved it:
I copied the aapt.exe command that shows in the output window. For example:
C:\android-sdk-windows\platform-tools\aapt.exe package -m --auto-add-overlay --extra-packages com.actionbarsherlock -J C:\Users\Ollie\.IntelliJIdea11\system\compiler\project6.b9f5599b\.generated\aapt\Project.9617c193\production -M C:/Users/Ollie/Documents/Dropbox/Tech/project6/Source/project6/AndroidManifest.xml -S C:/Users/Ollie/Documents/Dropbox/Tech/project6/Source/project6/res -S C:/Users/Ollie/Documents/Dropbox/Tech/project6/Source/actionbarsherlock/res -I C:\android-sdk-windows\platforms\android-14\android.jar
At the end I appended the -v to the end of that command and ran it in a command prompt window. That switch turns on verbose logging. Eventually the command will fail, but the very last file that it attempts to package is the culprit. I suggest focusing your efforts on that file.
General solution to this problem lies in XML code. There is something in the XML code which is being pointed , but not present. In my case, a unreachable string causes this error.
<item android:title="#string/action_settings">
Due to some code merging, this string code deleted, and compiler is unable to find it.I changed it & whoop.. error is gone.
In most of the languages, 1073741819 error is usually thrown whenever there is problem accessing resources
Make sure all your #+id/... (in main.xml and others) are also registered in strings.xml.
The problem I had was that
<item android:id="#+id/menu_help" android:title="#string/menu_help"/> in my main.xml file was not defined in my strings.xml file.
Take a look at here.
It is related to Android Develop's second class, of adding action buttons.
It is simply that the drawable "ic_action_search" is not present. Well, it was the case for me.
The class links to Action bar icon pack where you can find your missing PNGs and add to your project.
Hope it helps,
SJ
I think aapt ErrorCode -1073741819 means Android resources are conflict or illegal.
Whenever I meet this error on android projects of others' or my own, I usually find required attributes in layout/xxx.xml are missing, or id, name attributes are conflicts in different layout/xxx.xml
I had the same problem in Eclipse.
Eclipse now and then shows up those kind of errors, a simple refresh in my project fixed that error for me.
Had the same problem.There was a reference inside an layout xml file pointing to an object that wasn't in the source code anymore.You probably should check your main layout files first.
I just faced this issue again. Previous time I was not able to found the reason of the error so I had to clear everything and carefully add files and resources one by one. But now I found another reason for this error. I used method provided here by Software.Developer but in my case the culprit was not the last line but penultimate line. It was a menu xml file and the problem was at the first line in this file. It was empty and the xml declaration
xml version="1.0" encoding="utf-8"
was placed at the second line. IntelliJ IDEA static analyzer doesn't highlight this error until you open the file and compiler just crash at the compilation. So make sure all of your xml files (layouts, styles, menus) have proper xml declarations placed at the first line of the file.
I fixed this with cleaning the project before compiling it again.
The error code I got is -1073741502 which is slightly different, but I think it's just the id that generated from previous build of aapt.
In my case problem was in my menu.xml. Look at this one:
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
>
<item android:id="#+id/action_help"
android:title="#string/help"
android:orderInCategory="100"
app:showAsAction="never"
/>
</menu>
Renaming namespace for app:showAsAction from app to android solved this problem.
Here goes the right way
<item android:id="#+id/action_help"
android:title="#string/help"
android:orderInCategory="100"
android:showAsAction="never"
/>
One more resource problem - add formatting="false" to your strings which contain %s formatting characters.
See more at Android XML Percent Symbol
In my case (Android Studio on Windows 8.1) aapt would sometimes get stuck and every launch from command line would crash (but not when double-clicked in Explorer). When I terminated all cmd.exe and conhost.exe processes in Task Manager clean & build went just fine.
this error will be generated when your xml has some problems
but eclipse will not show real problem when Project>Build Automatically is checked
First thing you must do is to uncheck that option, Build All, and see problems window.
for me, I deleted a string from resources, but not its usage, so it takes 2 working days from me to find out what the problem is
Generally this error is observed due to some missing parameter or some syntax error in xml file.
You can refer the Messages view for gradle build.
There it states, which file is having error.
In my case, in one of the layout xml, there was some extra character.
Try removing the build tool with versions earlier than 19 from the android build tool folder, then install build tool 19 from the sdk manager, copy the lib folder and aapt.exe to platform-build folder.

aapt.exe crashes when I try to export my Android application from Eclipse

Since I updated two days ago my Android SDK to version API 14 I'm getting troubles using Eclipse Helios on my Windows 7 x64 laptop.
When I try to export a project everything is ok until I get to press the "finish" button: then a popup appears saying "aapt.exe has stopped working" and I can't get my signed apk; the project doesn't return errors and compiles as usual.
I googled to find a solution but nothing of the solutions i found worked:
I cleaned the project (Project>Clean)
I disabled the automatic build (Project>Build Automatically)
I deleted all the imported libraries (Right click on the project>Properties>Java Build Path)
I updated all the related software (Help>Check for updates)
I put logcat mode on verbose
I deleted my .9.png drawables and readded to my project
These are all the solutions I found related to aapt.exe issues. Do you have any other suggestion?
PS: I'm also getting a layout issue with all my .9.png files that are not displayed correctly, but I don't know if it's related.
I found a solution in Window>Preferences>Android>Build by setting "Build output" on Normal and then Project>Clean>Clean All.
I don't know if this is the definitive solution but it made me able to export my apk with the proper .9.png drawable layout.
Hope it helps.
I faced the same problem when I tried to add id as <resources> as mentioned here.
<resources>
<item type="id" name="button_ok" />
<item type="id" name="dialog_exit" />
</resources>
When I deleted this, the build was successful.
I had this same problem defining a menu item like this:
<item
android:id="#+id/menu_help"
android:showAsAction="never|withText"
android:title="#string/action_label_help"
android:icon="#drawable/ic_menu_help"
/>
I was just missing the icon file ic_menu_help, but instead of giving me a nice message that the image file was missing, it crashes aapt.

Android Packaging Problem: resources.ap_ does not exist

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...
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.
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.
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.
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.
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.
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
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!
It's very meaningless but changing build mode from verbose to silent did the trick! Nothing else (cleaning project, re-opening , re-installing) did.
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
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.
Try in
windows-> peferences -> android -> Build -> Build Output
Silent
http://code.google.com/p/android/issues/detail?id=20395
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.
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 :)
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).

Categories

Resources