Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Aapt2] Aapt2 throws an error if a Resources/values/* file contains a dash #1780

Closed
pjcollins opened this issue Jun 5, 2018 · 1 comment · Fixed by #1789
Closed

[Aapt2] Aapt2 throws an error if a Resources/values/* file contains a dash #1780

pjcollins opened this issue Jun 5, 2018 · 1 comment · Fixed by #1789
Assignees
Labels
Area: App+Library Build Issues when building Library projects or Application projects. vs-sync For internal use only; creates a VSTS "mirror" issue.
Milestone

Comments

@pjcollins
Copy link
Member

pjcollins commented Jun 5, 2018

This is currently a breaking change as compared to the original aapt tool. It seems our aapt2 support rejects all files which contain a dash. I haven't yet tested this behavior from within Android Studio, however the upstream version of the project in question here still uses dashes in certain resource file names:
https://github.com/googlesamples/android-FingerprintDialog/tree/master/Application/src/main/res/values.

Steps to Reproduce

  1. Download and build the following project with Aapt2 resource processing enabled.

https://github.com/xamarin/monodroid-samples/tree/master/android-m/FingerprintDialog

Actual Behavior

Resources\values\base-strings.xml : error APT0000: Invalid file name: It must contain only [a-zA-Z0-9_.]. [C:\xms\monodroid-samples\android-m\FingerprintDialog\FingerprintDialog\FingerprintDialog.csproj]
Resources\values\template-dimens.xml : error APT0000: Invalid file name: It must contain only [a-zA-Z0-9_.]. [C:\xms\monodroid-samples\android-m\FingerprintDialog\FingerprintDialog\FingerprintDialog.csproj]
Resources\values\template-styles.xml : error APT0000: Invalid file name: It must contain only [a-zA-Z0-9_.]. [C:\xms\monodroid-samples\android-m\FingerprintDialog\FingerprintDialog\FingerprintDialog.csproj]
Resources\values-sw600dp\template-dimens.xml : error APT0000: Invalid file name: It must contain only [a-zA-Z0-9_.]. [C:\xms\monodroid-samples\android-m\FingerprintDialog\FingerprintDialog\FingerprintDialog.csproj]
Resources\values-sw600dp\template-styles.xml : error APT0000: Invalid file name: It must contain only [a-zA-Z0-9_.]. [C:\xms\monodroid-samples\android-m\FingerprintDialog\FingerprintDialog\FingerprintDialog.csproj]
Resources\values-v11\template-styles.xml : error APT0000: Invalid file name: It must contain only [a-zA-Z0-9_.]. [C:\xms\monodroid-samples\android-m\FingerprintDialog\FingerprintDialog\FingerprintDialog.csproj]
Resources\values-v21\base-colors.xml : error APT0000: Invalid file name: It must contain only [a-zA-Z0-9_.]. [C:\xms\monodroid-samples\android-m\FingerprintDialog\FingerprintDialog\FingerprintDialog.csproj]
Resources\values-v21\base-template-styles.xml : error APT0000: Invalid file name: It must contain only [a-zA-Z0-9_.]. [C:\xms\monodroid-samples\android-m\FingerprintDialog\FingerprintDialog\FingerprintDialog.csproj]
Done executing task "CheckForInvalidResourceFileNames" -- FAILED. (TaskId:83)

Version Information

XA version: 8.3.99.25 (monodroid/HEAD/620da263b)

Log File

http://xqa.blob.core.windows.net/gist/log-56f828c3e11b4542adead00a424bfd1f.txt

VS bug #629211

@dellis1972
Copy link
Contributor

Looks like we forgot to include a - in the regex... :)

dellis1972 added a commit to dellis1972/xamarin-android that referenced this issue Jun 7, 2018
…ames

Fixes dotnet#1780

We forgot to include `-` as a valid character for the Resource
filenames when implementing the `CheckForInvalidResourceFileNames`
Task. As a result many working samples, when using `aapt2`, failed
with.

	Resources\values\base-strings.xml : error APT0000: Invalid file name: It must contain only [a-zA-Z0-9_.]. [C:\xms\monodroid-samples\android-m\FingerprintDialog\FingerprintDialog\FingerprintDialog.csproj]

The fix is to allow `-` as a filename character.
@jonpryor jonpryor added this to the d15-8 milestone Jun 7, 2018
@jonpryor jonpryor added vs-sync For internal use only; creates a VSTS "mirror" issue. Area: App+Library Build Issues when building Library projects or Application projects. labels Jun 7, 2018
dellis1972 added a commit to dellis1972/xamarin-android that referenced this issue Jun 13, 2018
…ames

Fixes dotnet#1780

We forgot to include `-` as a valid character for the Resource
filenames when implementing the `CheckForInvalidResourceFileNames`
Task. As a result many working samples, when using `aapt2`, failed
with.

	Resources\values\base-strings.xml : error APT0000: Invalid file name: It must contain only [a-zA-Z0-9_.]. [C:\xms\monodroid-samples\android-m\FingerprintDialog\FingerprintDialog\FingerprintDialog.csproj]

The fix is to allow `-` as a filename character.
dellis1972 added a commit to dellis1972/xamarin-android that referenced this issue Jun 13, 2018
…ames

Fixes dotnet#1780

We forgot to include `-` as a valid character for the Resource
filenames when implementing the `CheckForInvalidResourceFileNames`
Task. As a result many working samples, when using `aapt2`, failed
with.

	APT0000: Invalid file name: It must contain only [a-zA-Z0-9_.].

The fix is to allow `-` as a filename character.
This is only done for `values` filenames, since they
are the only ones which support `-`. For all other
resource types `-` is invalid.
dellis1972 added a commit to dellis1972/xamarin-android that referenced this issue Jun 15, 2018
…ames

Fixes dotnet#1780

We forgot to include `-` as a valid character for the Resource
filenames when implementing the `CheckForInvalidResourceFileNames`
Task. As a result many working samples, when using `aapt2`, failed
with.

	APT0000: Invalid file name: It must contain only [a-zA-Z0-9_.].

The fix is to allow `-` as a filename character.
This is only done for `values-*` resources, since they
are the only ones which support `-`. For all other
resource types `-` is invalid.
jonpryor pushed a commit that referenced this issue Jun 15, 2018
…1789)

Fixes: #1780

If a project has an `@(AndroidResource)` with a filename that
contains a `-`, `aapt2` will not support it *unless* the filename is
in the `values` directory.

Unfortunately, the `<CheckForInvalidResourceFileNames/>` task didn't
special-case the `values*` directories, resulting in errors for files
which `aapt2` would otherwise support:

        Resources\values\base-strings.xml : error APT0000: Invalid file name: It must contain only [a-zA-Z0-9_.].

Update the `<CheckForInvalidResourceFileNames/>` task so that it
supports `-` within filename characters for files within the
`values*` directories.

For all other resource directories, `-` is still not permissable.
dellis1972 added a commit that referenced this issue Jun 18, 2018
…1789)

Fixes: #1780

If a project has an `@(AndroidResource)` with a filename that
contains a `-`, `aapt2` will not support it *unless* the filename is
in the `values` directory.

Unfortunately, the `<CheckForInvalidResourceFileNames/>` task didn't
special-case the `values*` directories, resulting in errors for files
which `aapt2` would otherwise support:

        Resources\values\base-strings.xml : error APT0000: Invalid file name: It must contain only [a-zA-Z0-9_.].

Update the `<CheckForInvalidResourceFileNames/>` task so that it
supports `-` within filename characters for files within the
`values*` directories.

For all other resource directories, `-` is still not permissable.
@ghost ghost locked as resolved and limited conversation to collaborators Jun 8, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Area: App+Library Build Issues when building Library projects or Application projects. vs-sync For internal use only; creates a VSTS "mirror" issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants