Bug 55232 - error MSB3375: The file "obj\Debug\android\bin\packaged_resources" does not exist.
Summary: error MSB3375: The file "obj\Debug\android\bin\packaged_resources" does not e...
Status: VERIFIED FIXED
Alias: None
Product: Android
Classification: Xamarin
Component: MSBuild ()
Version: 7.2 (15.1)
Hardware: PC Windows
: --- normal
Target Milestone: 15.2
Assignee: dean.ellis
URL:
Depends on:
Blocks: 36485
  Show dependency tree
 
Reported: 2017-04-15 01:36 UTC by Jon Douglas [MSFT]
Modified: 2017-10-11 14:51 UTC (History)
14 users (show)

Tags: 15.1R
Is this bug a regression?: Yes
Last known good build: Xamarin.Android 7.1.0.41 (9578cdc)


Attachments
msbuild detailed log (2.77 MB, text/plain)
2017-04-18 23:17 UTC, Henrik Gram
Details


Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
VERIFIED FIXED

Description Jon Douglas [MSFT] 2017-04-15 01:36:43 UTC
*Description:

When a user has an aapt error, Visual Studio defaults to an error message of:

error MSB3375: The file "obj\Debug\android\bin\packaged_resources" does not exist.

This error message populates the Error List of Visual Studio and does not help the developer figure out the issue. To find the actual error, a developer needs to go into the Build Output to see the "APT" error of why there is a failure.

EX:

2>  obj\Debug\android\manifest\AndroidManifest.xml(8): error APT0000: No resource found that matches the given name (at 'label' with value '@string/app_name'). (TaskId:298)
2>Done executing task "Aapt". (TaskId:298)
2>Task "Touch" (TaskId:299)
2>  Task Parameter:Files=obj\Debug\android\bin\packaged_resources (TaskId:299)
2>C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1794,3): error MSB3375: The file "obj\Debug\android\bin\packaged_resources" does not exist.

I would consider this a regression as APT error messages have typically been populated in the Error List.

*Reproduction:

1. File -> New Android Application

2. Change the `Label` of the MainActivity Attribute to a resource that doesn't exist such as: 

[Activity(Label = "@string/app_name", MainLauncher = true, Icon = "@drawable/icon" )]

3. Rebuild

4. Error Message should appear in Error List

*Expected Behavior:

APT errors should be listed in the Error List

*Actual Behavior:

"error MSB3375: The file "obj\Debug\android\bin\packaged_resources" does not exist." is listed in the Error List

*Version Information:

Microsoft Visual Studio Enterprise 2017 
Version 15.1 (26403.0) Release
VisualStudio.15.Release/15.1.0+26403.0
Microsoft .NET Framework
Version 4.6.01586

Installed Version: Enterprise

Xamarin   4.4.0.34 (3f99c5a)
Visual Studio extension to enable development for Xamarin.iOS and Xamarin.Android.

Xamarin.Android SDK   7.2.0.7 (b16fb82)
Xamarin.Android Reference Assemblies and MSBuild support.

Xamarin.iOS and Xamarin.Mac SDK   10.8.0.174 (7656cc6)
Xamarin.iOS and Xamarin.Mac Reference Assemblies and MSBuild support.
Comment 1 Tuyen Duc Vu 2017-04-16 04:04:32 UTC
I got the same issue on both debug and release mode.

Code: http://github.com/naxam/xam-mapbox-android
Branch: v5.0.2

=== Xamarin Studio Community ===

Version 6.3 (build 863)
Installation UUID: bd0bb861-d6c1-4778-ac44-c31ee64f501b
Runtime:
	Mono 4.8.1 (mono-4.8.0-branch/22a39d7) (64-bit)
	GTK+ 2.24.23 (Raleigh theme)

	Package version: 408010000

=== NuGet ===

Version: 3.5.0.0

=== Xamarin.Profiler ===

'/Applications/Xamarin Profiler.app' not found

=== Xamarin Inspector ===

Version: 1.2.1
Hash: 0ea0a12
Branch: d15-1
Build date: Thu, 06 Apr 2017 20:24:44 GMT

=== Apple Developer Tools ===

Xcode 8.3.1 (12170)
Build 8E1000a

=== Xamarin.iOS ===

Version: 10.8.0.175 (Xamarin Studio Community)
Hash: a04678c2
Branch: d15-1
Build date: 2017-03-28 14:05:38-0400

=== Xamarin.Mac ===

Version: 3.2.0.175 (Xamarin Studio Community)

=== Xamarin.Android ===

Version: 7.2.0.7 (Xamarin Studio Community)
Android SDK: /Users/tuyen/Library/Android/sdk
	Supported Android versions:
		5.1 (API level 22)
		6.0 (API level 23)
		7.0 (API level 24)
		7.1 (API level 25)

SDK Tools Version: 25.2.5
SDK Platform Tools Version: 25.0.3
SDK Build Tools Version: 25.0.2

Java SDK: /usr
java version "1.8.0_121"
Java(TM) SE Runtime Environment (build 1.8.0_121-b13)
Java HotSpot(TM) 64-Bit Server VM (build 25.121-b13, mixed mode)

Android Designer EPL code available here:
https://github.com/xamarin/AndroidDesigner.EPL

=== Build Information ===

Release ID: 603000863
Git revision: a2163670efe259c85cd8f335d95b175068fbbe2a
Build date: 2017-04-03 14:33:15-04
Xamarin addins: 2045d688ea1420e0381b473360ca62a763eb7d04
Build lane: monodevelop-lion-d15-1

=== Operating System ===

Mac OS X 10.12.4
Darwin Tuyens-Mac.local 16.5.0 Darwin Kernel Version 16.5.0
    Fri Mar  3 16:52:33 PST 2017
    root:xnu-3789.51.2~3/RELEASE_X86_64 x86_64
Comment 2 Tuyen Duc Vu 2017-04-16 04:48:03 UTC
I found my issue, it was because of manually removing packages from csproject file.

Remove every package then add again solves my issue.
Comment 3 Juan Marcelo Tondato 2017-04-18 19:22:41 UTC
Hi, it looks like a build error.
Can you please confirm you get the same error building from the command-line?
Moving the bug to Android for visibility from the right team.
Thanks for reporting!
Comment 4 Jon Douglas [MSFT] 2017-04-18 19:30:30 UTC
The same issue persists with using VS 2017 Msbuild:

C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin\MSBuild.exe

Full command:

"C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin\MSBuild.exe" "C:\Users\dougl\Documents\Visual Studio 2017\Projects\App4\App4\App4.csproj" /t:Rebuild /v:diag /nologo /noconlog /logger:StructuredLogger,"C:\Users\dougl\AppData\Local\MSBuildStructuredLogViewer\app-1.0.130\StructuredLogger.dll";"C:\Users\dougl\AppData\Local\Temp\MSBuildStructuredLog-22480.buildlog"

Error:

C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1794,3): error MSB3375: The file "obj\Debug\android\bin\packaged_resources" does not exist. [C:\Users\dougl\Documents\Visual Studio 2017\Projects\App4\App4\App4.csproj]
Comment 5 Henrik Gram 2017-04-18 23:17:35 UTC
Created attachment 21610 [details]
msbuild detailed log

Was asked to attach a detailed msbuild log resulting in this error.  This was the result of creating a new project using the xamarin forms master/detail template with nothing else changed.  I tried to make sure all nuget packages have been updated to the latest version and running VS2017 with all the latest updates, but I cannot get rid of the error and I cannot find anything in the log that explains why it fails.
Comment 7 John Miller [MSFT] 2017-04-19 15:53:59 UTC
## Steps followed to do a preliminary local confirmation

1. Launch VS 2017 15.1
2. File -> New Project -> Android -> Single View App
3. Build project to confirm success with no changes.
4. Replace the Label value in the Activity attribute with "@string/app_name"
5. Rebuild

## Actual Results

The file "obj\Debug\android\bin\packaged_resources" does not exist.	App9	C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets	1794
Comment 8 John Miller [MSFT] 2017-04-19 16:07:21 UTC
## Suspected to be a regression or a problem with a new feature?
Uncertain. It would be good to check whether it is a regression.


## Already took up time for many users?
Yes. Private comment #6 identifies some tally of affected users. 


## Makes development (a) difficult, impossible, or potentially hazardous, (b) moderately inconvenient, or (c) mildly inconvenient for users?
(b). The user can discover the actual cause of the real problem by examining the build output. However, if they don't have a higher (diagnostic?) output setting it may not be visible in the output log.
Comment 9 dean.ellis 2017-04-24 08:52:39 UTC
It is probably an error in the Aapt error parsing. We had a situation where the format of the errors aapt introduced changed in the latest android tooling. So our existing RegEx did not work. This was fixed in [1] with additional fixes in [2]. 

It looks like neither of these fixes are in the latest stable. But they should be in the latest alpha channel. 

John, did you want to try the latest Alpha channel to see if that fixes the issue?

Related bug is [3].



[1] https://github.com/xamarin/xamarin-android/commit/252fa10ee7c2080ad573b58ffb10e494584aefdf
[2] https://github.com/xamarin/xamarin-android/commit/049b2c8f7a79bb765c18241a85954a83d4093159
[3] https://bugzilla.xamarin.com/show_bug.cgi?id=53054
Comment 10 Brendan Zagaeski (Xamarin Team, assistant) 2017-05-04 03:49:33 UTC
## Steps followed to test 

I followed the steps as described under "*Reproduction:" in Comment 0.




## Regression, confirmation, and verification status: regression between Cycle 9 and 15.1, verified fixed in 15.2


### 15.2 Release

> GOOD: XamarinVS 4.5.0.440 (910625d), Xamarin.Android 7.3.0.13 (448f54f) + Android SDK Build-tools 25.0.2 + VS 2015
> GOOD: XamarinVS 4.5.0.439 (3e2e792), Xamarin.Android 7.3.0.13 (448f54f) + Android SDK Build-tools 25.0.2 + VS 2017

### 15.1 Release

> BAD:  XamarinVS 4.4.0.34  (3f99c5a), Xamarin.Android 7.2.0.7  (b16fb82) + Android SDK Build-tools 25.0.2 + VS 2017
> BAD:  XamarinVS 4.4.0.34  (3f99c5a), Xamarin.Android 7.2.0.7  (b16fb82) + Android SDK Build-tools 25.0.1 + VS 2017
> BAD:  XamarinVS 4.4.0.34  (3f99c5a), Xamarin.Android 7.2.0.7  (b16fb82) + Android SDK Build-tools 23.0.1 + VS 2017

### Cycle 9 Release

> GOOD: XamarinVS 4.3.0.784 (73f58d6), Xamarin.Android 7.1.0.41 (9578cdc) + Android SDK Build-tools 25.0.2 + VS 2017
> GOOD: XamarinVS 4.3.0.784 (73f58d6), Xamarin.Android 7.1.0.41 (9578cdc) + Android SDK Build-tools 25.0.2 + VS 2015



## BAD Results

The Error List shows the non-specific error message described in Comment 0:
> The file "obj\Debug\android\bin\packaged_resources" does not exist.



## GOOD Results

The Error List shows the correct specific error message from `aapt`:
> Error: No resource found that matches the given name (at 'label' with value '@string/my_string').



## Additional testing environment info (brief)

Microsoft Visual Studio Enterprise 2017 Preview
Version 15.2 (26430.1-Preview) Preview

Microsoft Visual Studio Enterprise 2017
Version 15.1 (26403.7) Release

Microsoft Visual Studio Enterprise 2017
Version 15.0.26228.10 D15RTWSVC

Microsoft Visual Studio Enterprise 2015
Version 14.0.25431.01 Update 3

Microsoft .NET Framework
Version 4.6.01586

Windows 10 (64-bit) Version 1607 (OS Build 14393.1066)
US English locale, US Eastern time zone
Comment 11 Blonski 2017-05-22 07:22:02 UTC
Preconditions:
-Visual Studio Enterprise 2017 v 15.2(26430.6)
-Xamarin for Visual Studio 4.5

Step to reproduce: After adding many(more than 15)  images to Android Resources/drawable-hdpi  folder while rebuild getting same bug.
Images ware copied via drag from windows explorer to Visual Studio 2017.
Images names someName_sm@3x.jpg
Comment 12 Blonski 2017-05-22 09:43:14 UTC
Files names ware xxx_16-9@3.jpg  sign "-" is making problems.
Comment 13 TheTao 2017-06-05 10:47:10 UTC
@Blonski second comment saved my life.... i just removed the sign "-" from the images name and viola... it compiled... Debugged and Released. BTW i'm using the latest edition of VS2017 and Xamarin for VS
Comment 14 James Toalu 2017-06-12 13:15:48 UTC
I had the same problem. After removing the dash "-" sign from the image file name, the problem is solved. Bad error message! It should not be: 
> The file "obj\Debug\android\bin\packaged_resources" does not exist.
Writing an error message like this causing the Developer to think about something else while the problem is the illegal file name.
Comment 15 TheTao 2017-06-12 17:22:46 UTC
IKR, The error message is confusing.... when i saw that error the first time my first thought was "Oh i didn't install my VS very well!!!" i did a reinstallation and also a fresh installation on another PC... It took me 3 days till i later saw @Blonski's comment. The debugger or compiler should be specific.
Comment 16 Fran 2017-06-12 21:33:10 UTC
Same problem here. I added a new image with dash "-" symbol in the image name, a did a clean solution, and when I build I get:
"The file "obj\Debug\android\bin\packaged_resources" does not exist."

Just removed the dash "-" from the image name and now it builds OK.
Comment 17 Brendan Zagaeski (Xamarin Team, assistant) 2017-06-21 22:31:26 UTC
Comment 11 through Comment 16 are in fact about a slightly different older issue recorded in Bug 36485.  I have refreshed Bug 36485 today to promote forward movement on that issue.
Comment 18 Damir Beylkhanov 2017-09-27 10:47:03 UTC
Sometimes the same problem is occured when your changes affect on the `AndroidManifest` and in result you get compilation errors if your changes are wrong
Comment 19 TRO Solo 2017-10-11 13:33:35 UTC
This issue is NOT FIXED!
It still occurs for each and every Android drawable where the file name contains invalid characters like dashes instead of underscores.

Files names within the Resources folder of the Android project should only contain characters matching the regular expression [a-z0-9_.]. The AAPT even points to the exact file when running: "res\drawable\an-invalid-image.png: Invalid file name: must contain only [a-z0-9_.]".

Why the heck are you guys unable to propagate this error message to the build output?!?
Comment 20 Jon Douglas [MSFT] 2017-10-11 14:51:55 UTC
(In reply to tro.soloplan from comment #19)
> This issue is NOT FIXED!
> It still occurs for each and every Android drawable where the file name
> contains invalid characters like dashes instead of underscores.
> 
> Files names within the Resources folder of the Android project should only
> contain characters matching the regular expression [a-z0-9_.]. The AAPT even
> points to the exact file when running: "res\drawable\an-invalid-image.png:
> Invalid file name: must contain only [a-z0-9_.]".
> 
> Why the heck are you guys unable to propagate this error message to the
> build output?!?

Can you please provide your version information? This bug has been fixed and verified. I also did a quick sanity test and can confirm proper error messages make the error list rather than the generic one as per this bug report. Please also include any reproduction steps as to how you are encountering this issue.

My test with a drawable included renaming a drawable to have invalid characters. I then expect to see an error message in the error list regarding the invalid file name which I see the following:

Invalid file name: must contain only [a-z0-9_.]

Tested on VS 2017 - 15.4 (Xamarin.Android 8.0.0.33)