Unparsed aapt error(s)! - android

I'm working with Android in Eclipse and was trying to combine code from a template project I found into the skeleton project that Android creates when you start a new project. This is not an initial setup; have gotten several projects running and although I'm new to Android coding I have been working for several weeks without this problem so the environment is set up fine I think.
The error I'm seeing is -
Unparsed aapt error(s)! Check the console for output
At one point I cleared the console messages and now even after closing the project and Eclipse, then reopening I get no console messages and none of my source or resource files are flagged.
What is aapt and where should I look for the source of this error? Thanks in advance for your help.

I sorted this out. So for anyone else still on the learning curve with me, the solultion is as noted in my comment. In addition -
aapt = Android Asset Packaging Tool
From the Developers Guide -
"The Android Asset Packaging Tool (aapt) takes your application resource files, such as the AndroidManifest.xml file and the XML files for your Activities, and compiles them."
The solution for me was simply to delete the error on the 'Problem' window (right click | delete). Then, force a rebuild by rerunning the app. Any remaining problems will now show up and be logged so you can track them down.
Hope this is helpful to others.

This happened for me when I accidentally attempted to "run" an Android XML layout file. It created a file with the layout name and _out.xml appended. I needed to delete that file before I could perform any further builds.

This is what I did using Eclipse ADT, and that error disappeared:
Window > Preferences > Android > DDMS > Base local debugger port: 8600
I changed the value from 8600 to something else, example: 9999
Finally, I went to Project > Clean... > Clean all projects > OK
The error disappeared.

May occur when the project is created (New Android) and Fields: minimum required SDK, Target SDK, compile with and Theme are not filled in correctly.

Related

Eclipse - Several Errors After Altering Proguard and Manifest Files

I have an Android project for which I use the Eclipse IDE and I wanted to try an use the ProGuard tool to obfuscate/shrink my code. Unfortunately I couldn't get it to work with Eclipse throwing up a ProGuard error when I try to export my project.
To resolve this I altered the necessary project properties file to NOT use ProGuard but Eclipse just complained there were errors with the project which needed to be resolved. I tried cleaning the project, refreshing too but all to no avail. As I use a Mercurial for source control I reverted to my last good sources but now Eclipse throws up even more errors which I cannot get rid of:
org.eclipse.core.internal.resources.ResourceException: Resource is out
of sync with the file system: '/XXXXX/AndroidManifest.xml'.
loadAndParseRClass: failed to find manifest package for project
XXXXXXX
I've never been a great fan of Eclipse but how can I clean my project and get it back to a NON proguard state?
I resolved the problem. There's ANOTHER error log in Eclipse called 'Problems' which tells me my Debug certificate has expired on 25/12/2011. Handy how Eclipse labels this as a 'problem' and not an error and gives no indocation other that a red x that there's some sort of problem!
Anyway I resolved this by going here.
Make sure you Refresh your project so that the state of your Workspace/IDE agrees with your state on disk (Right click on the project and select "Refresh"). This will get rid of the first error you have.
And then just do a Team -> Revert on your projects and select the files that you have changed and want to revert to the checked-in version.

Your project contains error(s), please fix it before running it

I am developing a simple Android application. But when I run Eclipse, it shows the following error:
Your project contains error(s), please fix it before running it.
I can't find any error in my project or there is no error in my application.
There is a red cross under the application name but it is not under another file name.
Does anyone else have this issue?
That usually comes from errors in the build path.
If you're using eclipse, there is a view you can add that lists all the errors called "Problems":
Otherwise, you can try to clean the project, and that usually solves a few problems.
Finally, if you add or alter resources from outside your IDE, you'll want to reload the resources and clean.
EDIT (Comment by anonymous user)
This can also be caused by an out of date "Debug Certificate" fixed as follows:
IF ALL FAILS THEN THIS GOTTA BE THE SOLUTION:
Delete your debug certificate under ~/.android/debug.keystore (on Linux and Mac OS X); the directory is something like %USERPROFILE%/.androidon Windows.
The Eclipse plugin should then generate a new certificate when you next try to build a debug package. You may need to clean and then build to generate the certificate.
This is also another fix for the "setContentView(R.layout.main);" error that says it cannot find R.layout.main when it is actually generated. (R cannot be resolved to a variable).
This is also another fix for the error "Your project has errors..." and you cannot find any.
Clean and rebuild are still necessary after generating a new debug certificate.
First go to Window -> Show View -> Error Logs in menu. It will display error logs if you have any. Then try to clean the project and build it again.
Well, in my case some libraries were addressed twice in the:
Project >> Properties >> Java Build Path >> Libraries
I just had to remove the duplicate and it worked fine without any cleanings or refreshing.
I saw this with an existing project. I had made a few edits, but hadn't imported anything new. Restarting Eclipse didn't help.
Project->Clean did solve the problem.
I come across this error often when I import a new project in my workspace.
Reason: Some necessary files (Like R.Java) is not generated in its respective packages.
Cure: Clean and build projects, All the files that needs to be auto generated will be there on place after building the project.
Best Luck.
This is happened to me. After format of my system,
When i import project it shows same error
remove first debug.keystore file then goto -
Project -> Project properties -> select library -> remove -> add again libraries.
It's working for me......
Go to projects menu, click on clean menu item.
After that close the eclipse and reopen and try compiling..
It is software glitch you find some times.
it can also happen if you move required files. Simply check Problems View (menu window -> show view -> Problems) as told here
I had this exact same problem. One solution that would work would be to create a brand new project, but I don't think there's any need for that. For me the problem was that the debug certificate that gets auto-generated had expired. Deleting this file allowed Eclipse to rebuild that file, which solved the problem. You can't run an app with an invalid certificate, whether it be a debug or release certificate. Note that cleaning my project did not work. For more information, see:
"Debug certificate expired" error in Eclipse Android plugins
Recently I came across this error. I was really in a corner with no help, then I figured it out. This error can occur for the following reasons:
An error in the project code
Improper linking of external library files to the project
Most important: if your debug.keystore file is expired.
The first 2 cases are easily identifiable but the third one is like searching a black box in a dark room.
So in addition to Project -> Clean, remove your debug.keystore file also.
I am using Mac + Eclipse so to remove, I wrote the command rm ~/.android/.debug.keystore in a terminal.
Is there a way to ignore existing errors in project. Something similar what eclipse allows in case of java projects.
In my case the errors exist in jni directory. The errors are shown even though ndk-buid succeeds. So all i want to do is to ignore the errors reported by eclipse.
If the errors are indeed errors then i should get unresolved symbols during ndk-build.
I have ensured standard android includes are there in include path.
Also my project is of type android/c/c++.
I have two builders associated with the project
1. statndard android builder
2. custom ndk builder that ive explicitly created.
Simulate your self some error in class. Then save it and it would show more errors than you simulated. For me it was incorrect import and this helped.
I have had a similar problem.
Under "problems" tab I have found an error saying "Error generating final archive: Debug Certificate expired on 2/22/12 1:49 PM"
So my advice is to look in the problems tab to get some more info.
Bye
If none of the above solution work, you should check the READ ONLY property of the Project folder, if it is Read-Only, the compiler will not be able to overwrite the resources, R.java and other dex APK etc files and hence this will occur..
This happened to me and I fixed after a long struggle..
Happy Programming.
For some reason eclipse only showed a ! error on root and didn't specified what error it was.
Go in Windows -> Show Views -> Problems. You might find all previous errors there, delete them, do a clean build and build again. You'll see the exact errors.
Eclipse shows an error on android project but can find the error
I had this exact problem when trying to run the Doodlz app, from the book Android for Programmers, on Mac OS X with Eclipse Juno.
After downloading and unzipping the demos from the book, I forgot to change the permission of the files. They were read-only on my system so this was the first issue.
The second issue was solved by selecting a build target on Eclipse. This was fixed by going to: Project > Properties , and clicking the Android field on the left panel to be able to select one option as the Project Build Target, which in my case was:
Target Name Vendor Platform API Level
> Google APIs Google Inc. 4.0.3 15
Then cleaning and rebuilding the project showed no errors.
Finally, to run the app right-click the package (at the Package Explorer tab) and then select:
Run As > Android Application
Simply Deleted my debug certificate under ~/.android/debug.keystore and Project->Clean did solve the problem.
Delete the .android folder from your Documents&settings\User\ on XP and \User\ on Win7. Recreate the AVD again and create a new project.
What caused this problem for me was none of the above, but simply that I'd left the "debuggable" attribute to false in the manifest.xml file after doing a release. D'oh!
Of course neither the LogCat, Error log, Console, or Problems window alerted me to this..
I had the same error, when I copied a project to another computer.
I then checked all properties of the project on both machines, and the only thing that was different was the order of items in Java Build Path - tab Order and Export.
I moved the items Android X.X.X and Android Dependencies above the other 2 in the list (in my case, src and gen folders) and voila, it worked again!
I'm not really sure if the different order was actually the problem, but at least changing it (and saving the properties again) seemed to help...
I had the exact same problem after updating the SDK and ADT.
My issue was resolved by deleting the .android folder (hidden) under C:\Users\USERNAME\
This happened to me when I was experimenting with Maven.
Right click project -> Maven -> disable maven nature
corrected the problem for me.
Yes, this is a rather cryptic message. If you've got a faulty project (say one you've been working on in the past) then you'll get this message (and no messages in your current project's Problems / Error Log panes).
You may just want to run your current project. This may be perfectly fine. Just click on the down arrow to the right of the Run button to select your project.
Try changing your workspace. I am not sure this is the exact solution . I did face the same issue for sometime untill i changed my workspace.
In my case, it happens with ADT 22.
I choose not to create Activity.
After I remove the "appcompat_v7" as library project. I works.
I had similar problem where I couldn't run my project yet didn't see any problems in the code. In Error Log panel it said something like "Cannot add P/ to the list of segments P/ in as a parent".
Restarting Eclipse solved the problem.

resources.ap_ does not exist when compile my android project

Compile Error:
Error generating final archive: java.io.FileNotFoundException: ..\bin\resources.ap_ does not exist.
Compile other simple sample works.
Same source file and project works on my college's machine.
Any tips ? Why resources.ap_ doesn't get generated ?
Did you do a Project > Clean? If that doesn't work, try forcing Eclipse to build the project again. Restart Eclipse if that still doesn't work.
I created an empty text file under C:\Users\me\workspace\project\bin\resources.ap_
Then Cleaned/Rebuild... that seemed to fix it.
In my case was a 9 patch drawable that was modified with GIMP, then adb cannot "parse" it, recreated with the draw9patch then worked fine
I was getting both the error in this thread and the one in this post: Android Unknown Command 'crunch'.
Updating the Android SDK inside Eclipse fixed both errors for me.
If you delete the whole "gen" folder, then go to Project>Build All it seems to regenerate the folder and the R.java file
Finally i found the reason. The update aapt tool treat the format string without order as build error. e.g. "%s %d" should be "%1$s %2$d".
I got this along with an error when the "aapt.exe" update tool was run.
There's apparently a bug in this program when the console build output is set to "Verbose". Changing it to "Normal" fixed it for me.
See this link:
aapt.exe is throwing unhandled exception while building *.apk file for Android project in Eclipse
Try going to Window->Android SDK manager and update Tools and Android 4.0. This solved my issues.
If that doesnt work, try updating everything.
That totally worked for me!
Reference: Error generating final archive: java.io.FileNotFoundException: xxx\bin\resources.ap_ does not exist
Delete bin and gen directories from system. Then F5 in eclipse.
This helped me. Nothing else worked for me.
For me, it was turning off Instant Run.
Preferences -> Build, Execution, Deployment -> Instant Run -> uncheck "Enable Instant Run to hot..."
Also, I heared killing a goat and draw a pentagram on the office floor with its warm blood helps prevent these kind of problems.
i tried the Notepad Tutorial Exercise 2 and got the same error.
i used the wrong API-Level (3). i just switched to level 8 and now it's working fine.
This problem occurred for me after eclipse did some updates. I just went to a backup of my project and took the file that and placed it in the appropriate place in my current project and all worked.
Goto file->Properties and change the target to the correct version of android. For me it was 1.5 (from the tutorial on hack-a-day)
AndroidManifest.xml displayed within Eclipse was out of sync with what was on disk/being read by Android. shutdown restart eclipse and edit AndroidManifest.xml to be correct and clean and build.
Happens due to having two AndroidManifest.xml files and renaming them. Two useful if two apps from same code base. Linking projects with Android is problematic.
I had both values and values-en folders and it was picking the string from the values-en folder. I deleted the en folder and it was back to normal.
I tried
Clean
Delete gen
restart eclipse
Here are a few of the things I did that made this finally work for me.
1) I was using Admob ads, and I didn't have an attrs.xml file in my res/values folder
2) I deleted a line that says "import andriod.R" from my main activity, and all my resources connected again and this ultimately made the error go away.
3) The last thing I had wrong is I had a "lib" folder instead of a "libs" folder that held my Admob jar file.
Lastly, I cleaned the project after these changes.
So, hopefully this helps someone else having this same error if none of the above fix the problem.
I had the same problem and after digging around the different output Eclipse provides discovered that the issue had to do with a malformed 9-patch image.
I discovered the issue in the Problems output (Alt-Shift-Q then X).
I had the same error message and it was caused by having a backslash character in one of my string resource values (in the file: res/values/strings.xml).
I had to remove the offending character and clean the project before it would build.
1 - Try Project > Clean and rebuild project
2 - If clean does not solve this issue, check ALL log in your Console view in Eclipse.
The issue may not be reported at the end of the Console view. In my case, it was a drawable that does not respect the 9-patch format. This was reported somewhere in the Console view but not at the end !!!
Delete any 9 patch drawables created in gimp and refresh.
Delete bin and gen on filesystem.
Refresh (F5) project in Eclipse.
I faced the same issue. And I fixed it by removing newly added png file. It was not able to generate resources.ap file because of one of my png file in drawable.
I got this problem after the upgrade to Android SDK Tools 15. It was also related to the PNG image as some other replies indicate. After analyzing the Eclipse Console output I found out that the process aapt.exe is crashing while processing of one of the images. More precisely it was in the step labeled as "Including resources from package". To identify the file causing the problem I scanned the Console output, found 3 calls of aapt.exe and each of them I re-ran in the Windows Console. The third one ("aapt.exe package -v -S ...") crashed on one of my PNG files. After I replaced this file (in all supported resolutions) the problem has gone.
If you use SurfaceView and have recently changed the name of the package, you might want to check any XML tags that refer to the class.
first try
clean,build automatically from eclipse
and if not resolved then try uder solution
i found solution why R.class not made by eclipse after making again-2 clean,build etc.
problem is here in strings.xml:
Hello World, HelloAutoComplete!
HelloAutoComplete these are by default created by the eclipse when you create an projects
definitly you are changing the strings.xml for your own requirment sometimes you cleare the string.xmls these two lines from your codes.
it is making problem in AndroidManifest.xml file
so it cant communicating strings.xml
dont delete these two lines from strings.xml
android:icon="#drawable/icon" android:label="#string/app_name"
android:name=".HelloAutoComplete"
android:label="#string/app_name"
regards aarifmohammadkhan#gmail.com
if any one have nay problem in android
welcome for asking questions
Regards
aarifmkhan
You might need to remove extra files from your assets or res directory. One case I had was having both "A.jpg" and "A.JPG" files in the assets directory. It prevented the resources.ap_ file from being generated.
For Android studio, if you are using gradle 2.2.2 just disable shrinkResources into build.gradle file:
shrinkResources false
Try run your Eclipse as administrator.

How to resolve build path errors?

If I run my project this error will come build path problem how to solve this error.
error:
Description Resource Path Location
Type Project 'videothumb' is missing
required source folder: 'gen'
videothumb Build path Build Path
Problem
The project cannot be built until
build path errors are resolved
videothumb Unknown Java Problem
Can any one help me?
Try to clean project and if it still doesn't help close and then open project.
IF you are using eclipse then do as follows:
right click your project.
select build path-->configure build path.
update all the broken links in all 4 tabs.
Go to project-->clean [project will be found at top menu of eclipse.]
Clean your project.
Its done. For any further explanation comment on my answer.
Hope this helps.
Edit:
Here you go:
As you can see i'm at source tab of configure build path and i have only one folder here named ATalk/Src. likewise you can have number of folders.
Check for red cross mark on folder. if its there then your folder path is wrong means link is broken for that folder.
Same way you can check in Libraries tab. There you will find list of jars in your project. If any of them have red cross then its path is missing. So update all such red cross paths.
As you can see i dont have a red cross on my folder means it is at correct location.
Hope you get my point.
EDIT:
I just noticed that, according to your screenshot, the problem seems to be that the adb tool is not found. Now I might be wrong but I think that as of Android 2.3 (maybe even earlier) the adb tool is expected to be in [path-to-your-sdk]/platform-tools folder, not in the [path-to-your-sdk]/tools folder. The later path was used in earlier SDK's and your problem might be caused by such a simple thing that you have an outdated Android plugin in Eclipse.
OLD, IRRELEVANT ANSWER:
I've seen these kind of issues in Eclipse environments when I have some kind of error in my XML files. Malformed errors (that violate the rules of the XML structure) are often treated as "syntax errors" and are shown directly when you write them or when you try to build your application.
Other errors, however, like giving invalid references (giving a dimension where an integer is expected, for example) are not always highlighted with file name and failing line number (I'm not sure if this is bug in Eclipse's android plugin or even if it's a bug at all).
These kind of errors you'll have to hunt down manually and rebuild your project (as dcave555 sugested). This is really boring work if you have many XML files with many changes in
I think the path should look like this: /home/embdes/projects/android/android-sdk-linux_86
The problem is because of your Android build path settings. Try to check:
Window > Prefereces > Android > Build path
it should properly set to your Android SDK

Eclipse Android project

I have a problem I can't seem to get around. I've created a project in Eclipse (I recreated it from another project that I thought was corrupted). There are no visible errors in any of the files, including the .xml files. However, the project root [project name] itself has an error (red 'x') and so I can't run it.
On a side note, in the default properties file the line:
target=android-4 is underlined in red with the note that 'android' is not spelled correctly. I have not altered this file since it was generated.
Any clues? Target is 1.6, sdk 4. And I'm new at this :)
You may have already tried this unsuccessfully, but if not, you might want to try the Android Tools > Fix Project Properties action from the context menu of the project root.
Eclipse also thinks android-4 is misspelled in my default.properties, so I doubt that is the cause of your build problem.
Does the Problems view describe any issues? (Window->Show View->Problems)
You could also try cleaning the project in eclipse. Project->Clean..
if the error message you get is
The project cannot be built until the build path errors are resolved.
this might help:
Open the Project -> Properties
Select Java Build Path -> Libraries
Add any new library (to be deleted later) -> OK
Wait for the workspace to refresh or force a refresh
The error should go away
Remove the dummy library
You can stop the spelling error by adding that word to a user dictionary, but a spelling error wouldn't prevent a run.

Categories

Resources