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
Hi i am trying to use eclipse for android development and i am getting this error
<mypath>Android\sdk1\extras\android\support\v7\appcompat\res\values-v21\themes_base.xml:144: error: Error: No resource found that matches the given name: attr 'android:windowElevation'.
I have already installed the required thing as in the image
What else i have to do in the setup to run the code .Please help me in this
Make sure that you have a SDK platfrom 21 and try to add appcompact using this tutorial. Hope this will work. :)
https://www.youtube.com/watch?v=CG_HxvV44zM
After installation, in order to use a Support Library, you must modify your application's project's classpath dependencies within your development environment. You must perform this procedure for each Support Library you want to use.
More details here:
http://developer.android.com/tools/support-library/setup.html#add-library
I see you have the extras required as Android Support Repostory, Android Support Library, Google Play Services, etc
but you have to install the SDK platform for the API 21 too!.
And be sure to install the latest Android SDK Build-tools.
I have imported android support-v7 appcompat library From File >Import >Android >Existing Android Code Into Workspace >sdk >extra >android >support >v7 >appcompat. when I click finish I get " android supprt v 7 appcompat" in project explorer, it shows me an error.
in android-support-v7-appcompat\res\values\styles_base.xml -> I get the following error:
"error: Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.ActionButton'.
I have search this problem couldn't solve my problem.
I wanted to upload screen shoot unfortunately, I am not able to since it needs at least 10 reputation :(
any ideas please
It sounds as though you are not compiling with the Android 5.0 (API level 21) SDK.
You need to install API 21 via the SDK manager, then update your project settings to compile with API 21.
I developed something with Phonegap for iOS, but this is my first trial for Android.
I created my hello world application with CLI sth like this mentioned here:
$ /path/to/cordova-android/bin/create /path/to/my_new_cordova_project com.example.cordova_project_name CordovaProjectName
Even though I created this app in Eclipse Workspace, I needed to import it to Eclipse. I created two AVDs. One for API level 8, one for API level 16.
When I try to build, it gives me these three errors and a warning. What is wrong with my setup?
Description Resource Path Location Type
error: No resource identifier found for attribute 'hardwareAccelerated' in package 'android' AndroidManifest.xml /com.example.test.testprojectname line 20 Android AAPT Problem
error: No resource identifier found for attribute 'xlargeScreens' in package 'android' AndroidManifest.xml /com.example.test.testprojectname line 22 Android AAPT Problem
error: Error: String types not allowed (at 'configChanges' with value 'orientation|keyboardHidden|keyboard|screenSize|locale'). AndroidManifest.xml /com.example.test.testprojectname line 51 Android AAPT Problem
The import android.app.Activity is never used testprojectname.java /com.example.test.testprojectname/src/com/example/test line 22 Java Problem
Go to Project -> Properties -> Android and select a newer SDK (preferably the latest one), after that run Project -> Clean. That worked for me.
Check the minSdkVersion and targetSdkVersion attributes in your AndroidManifest.xml. It sounds like you're building the app for an older SDK version that didn't have the attributes that are producing the errors. Try to set both min and target to 11 and see what happens.
You should always be building for the latest SDK. It looks like your Eclipse setup is using an old version of Android (Android 2.2?). hardwareAccelerated and xlargeScreens is from Android 3.x. I recommend making sure your project uses the latest version fo the SDK in Eclipse. This has nothing to do with your Android Manifest, and is actually an eclipse setting.
By default android version is 2.1; you must right click on root folder of you project, select properties, then in android select new version; try to reload it and it wrok...
You should always be building for the latest SDK. It looks like your Eclipse setup is using an old version of Android (Android 2.2?). hardwareAccelerated and xlargeScreens is from Android 4.x. I recommend making sure your project uses the latest version of the SDK in Eclipse.
(or)
after creating your project Do the following steps
Right click your project -> properties --> change the Android target version as 4.x