Bug 36485 - Uninformative ""aapt.exe" exited with code 1." and "The file "obj\Debug\android\bin\packaged_resources" does not exist" errors if drawable resource filename contains invalid character
Summary: Uninformative ""aapt.exe" exited with code 1." and "The file "obj\Debug\andro...
Status: VERIFIED FIXED
Alias: None
Product: Android
Classification: Xamarin
Component: MSBuild ()
Version: 6.0.0
Hardware: PC Windows
: High normal
Target Milestone: 15.4
Assignee: dean.ellis
URL:
: 41051 ()
Depends on: 55232
Blocks:
  Show dependency tree
 
Reported: 2015-12-02 22:00 UTC by Mikayla Hutchinson [MSFT]
Modified: 2017-08-17 11:55 UTC (History)
4 users (show)

Tags:
Is this bug a regression?: No
Last known good build:


Attachments
Attached IDE logs (1.69 KB, application/x-zip-compressed)
2017-08-17 11:55 UTC, Aman Dharwal
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 Mikayla Hutchinson [MSFT] 2015-12-02 22:00:49 UTC
To repro:

Add a drawable resource with a  dash in its name. Build the app.

On Mac, I get

Tool exited with code: 1. Output: res/drawable/fff-s.jpg: Invalid file name: must contain only [a-z0-9_.]
res/drawable/foo-bar.jpg: Invalid file name: must contain only [a-z0-9_.]

On Windows, I get

"aapt.exe" exited with code 1.

This is not helpful, because it means I have to find and search the build output to find the actual error.
Comment 1 Atin 2016-01-13 12:49:24 UTC
I have checked this issue and able to reproduce the reported behavior given in the bug description. On windows I get the "aapt.exe" exited with code 1 error. I also get another error when I use dash in drawable resource i.e "Error MSB3375: The file "obj\Debug\android\bin\packaged_resources" does not exist. (MSB3375)".

Screencast: http://www.screencast.com/t/MkckBPcAct
Ide Logs: https://gist.github.com/saurabh360/7681f4febd56b1091d7d

Environment Info:

=== Xamarin Studio ===

Version 5.10.2 (build 49)
Installation UUID: c13e6eeb-f876-4a06-8631-6289a6546550
Runtime:
	Microsoft .NET 4.0.30319.42000
	GTK+ 2.24.23 (MS-Windows theme)
	GTK# 2.12.30

=== Xamarin.Profiler ===

Not Installed

=== Xamarin.Android ===

Version: 6.0.1.5 (Enterprise Edition)
Android SDK: C:\Users\Abhinav\AppData\Local\Android\android-sdk
	Supported Android versions:
		2.3    (API level 10)
		4.0.3  (API level 15)
		4.1    (API level 16)
		4.2    (API level 17)
		4.3    (API level 18)
		4.4    (API level 19)
		4.4.87 (API level 20)
		5.0    (API level 21)
		5.1    (API level 22)
		6.0    (API level 23)

SDK Tools Version: 24.4.1

SDK Platform Tools Version: 23.0.1

SDK Build Tools Version: 23.0.1


Java SDK: C:\Program Files\Java\jdk1.7.0_71
java version "1.7.0_71"
Java(TM) SE Runtime Environment (build 1.7.0_71-b14)
Java HotSpot(TM) Client VM (build 24.71-b01, mixed mode, sharing)

=== Xamarin Android Player ===

Version: 0.6.1
Location: C:\Program Files\Xamarin Android Player\DeviceManager.exe

=== Build Information ===

Release ID: 510020049
Git revision: deed4cd240ff3611c8742bbc62296e207f46173d
Build date: 2015-12-17 11:29:42-05
Xamarin addins: 8bd975e7b465f6fe812b64d736f3b7e8c1a79a3e
Build lane: monodevelop-windows-cycle6-c6sr1

=== Operating System ===

Windows 6.1.7601.65536
Comment 2 Brendan Zagaeski (Xamarin Team, assistant) 2017-06-21 22:25:20 UTC
## Confirmation status update: confirmed not yet fixed in the latest versions

(Note that this bug is slightly different from Bug 55232, which I verified as fixed in the latest versions as per Bug 55232, Comment 10.)


### 15.3 preview

> BAD:  XamarinVS 4.6.0.240 (60c3d0e), Xamarin.Android 7.4.0.2  (5a73b38) + Android SDK Build-tools 23.0.3 + VS 2015

### 15.2.3 Release

> BAD:  XamarinVS 4.5.0.486 (fec6f88), Xamarin.Android 7.3.1.2  (9dbc4c5) + Android SDK Build-tools 23.0.3 + VS 2015

### 15.1 Release

> BAD:  XamarinVS 4.4.0.34  (3f99c5a), Xamarin.Android 7.2.0.7  (b16fb82) + Android SDK Build-tools 23.0.3 + VS 2015

### Cycle 9 SR 0 Release, Cycle 9 Release, and Cycle 8 SR 2 Release

> BAD:  XamarinVS 4.3.0.795 (aece090), Xamarin.Android 7.1.0.43 (3a62f1e) + Android SDK Build-tools 23.0.3 + VS 2015
> BAD:  XamarinVS 4.3.0.784 (73f58d6), Xamarin.Android 7.1.0.41 (9578cdc) + Android SDK Build-tools 23.0.3 + VS 2015
> BAD:  XamarinVS 4.2.2.11  (00fa5cc), Xamarin.Android 7.0.2.42 (501e63c) + Android SDK Build-tools 23.0.3 + VS 2015
These versions are a _little_ better because they include an additional error message for aapt.exe, but they're still not ideal.
> "aapt.exe" exited with code 1.
> The file "obj\Debug\android\bin\packaged_resources" does not exist.



## BAD Results

The Error List shows a non-specific error message (as in similar Bug 55232).
> The file "obj\Debug\android\bin\packaged_resources" does not exist.



## Possible improvements

As discussed in Comment 0, the diagnostic build output shows that the `Aapt` task does output a more informative diagnostic message about "Invalid file name" that should be surfaced in the error message (as in similar Bug 55232).

> Executing package -f -m -M obj\Debug\android\manifest\AndroidManifest.xml -J "C:\Users\Windows User\AppData\Local\Temp\33xy1vrg.up0" --custom-package blankappandroid1.blankappandroid1 -F obj\Debug\android\bin\packaged_resources.bk -S obj\Debug\res -I C:\android-sdk\platforms\android-25\android.jar --auto-add-overlay (TaskId:214)
>   res\drawable\icon-one.png: Invalid file name: must contain only [a-z0-9_.] (TaskId:214)
> Done executing task "Aapt". (TaskId:214)



## Additional testing environment info (brief)

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.0)
US English locale, US Eastern time zone
Comment 4 Brendan Zagaeski (Xamarin Team, assistant) 2017-06-21 22:42:41 UTC
*** Bug 41051 has been marked as a duplicate of this bug. ***
Comment 6 Brendan Zagaeski (Xamarin Team, assistant) 2017-06-22 01:13:24 UTC
## Note to the Xamarin team

In case it might be helpful for working on the candidate fix, in recent Xamarin.Android versions you can also now hit this problem on Mac by building with `msbuild` (either in the IDE or on the command line).
Comment 7 dean.ellis 2017-07-26 17:07:17 UTC
Pr up https://github.com/xamarin/xamarin-android/pull/703
Comment 8 dean.ellis 2017-08-01 12:04:24 UTC
Fixed in tamarin-android/master/7dadd003
Comment 9 Aman Dharwal 2017-08-17 11:55:28 UTC
Created attachment 24267 [details]
Attached IDE logs

This issue doesn't exist anymore, hence the expected error message "Invalid file name: must contain only [a-z0-9_.]" is observed

Environment info : https://gist.github.com/SumantaWelekar/d9e20ba29d37be61bdcf69a373fadc4e

Screencast link  : https://www.screencast.com/t/JrUEs2WyE