Bug 60445 - Aapt MSBuild Task treats no default translation warnings as MSBuild errors
Summary: Aapt MSBuild Task treats no default translation warnings as MSBuild errors
Status: VERIFIED FIXED
Alias: None
Product: Android
Classification: Xamarin
Component: MSBuild ()
Version: 8.1 (15.5)
Hardware: PC Windows
: --- major
Target Milestone: 15.6
Assignee: dean.ellis
URL:
Depends on:
Blocks:
 
Reported: 2017-10-30 21:29 UTC by Jon Douglas [MSFT]
Modified: 2018-01-19 16:50 UTC (History)
4 users (show)

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

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-10-30 21:29:03 UTC
## Description

The Aapt MSBuild Task seems to treat aapt "no default translation" warnings as MSBuild errors. These items should be logged as warnings and not promoted to errors as it confuses users that their application needs fixed when most of the warnings can be ignored or treated on a case-by-case basis.

Aapt Example:

C:\Users\dougl\AppData\Local\Android\sdk\build-tools\26.0.2\aapt p -f -m -M C:\Users\dougl\AppData\Local\Temp\naj3hroo.ll5\manifest\AndroidManifest.xml -J C:\Users\dougl\AppData\Local\Temp\naj3hroo.ll5 --custom-package app46.app46 -F C:\Users\dougl\AppData\Local\Temp\naj3hroo.ll5\resources.apk.bk -S obj\Debug\res -I C:\Users\dougl\AppData\Local\Android\sdk\platforms\android-26\android.jar --auto-add-overlay

Output:

warning: string 'app_name1' has no default translation.

Related Source:

https://github.com/xamarin/xamarin-android/blob/master/src/Xamarin.Android.Build.Tasks/Tasks/Aapt.cs#L360-L386

## Reproduction Project

1. File -> New -> Xamarin.Android Project
2. Create a new Resources folder called "values-fr"
3. Add any string such as:

<?xml version="1.0" encoding="utf-8"?>
<resources>
  <string name="test">Test</string>
</resources>

4. Build the project to run into the MSBuild error

MSBuild Error:

1>warning : error APT0000: string 'test' has no default translation.
1>Done executing task "Aapt" -- FAILED. (TaskId:129)

## Version Information

Xamarin - 4.7.10.22

Xamarin.Android 8.0.0.33
Visual Studio for Mac - 7.2
Comment 1 dean.ellis 2017-11-02 15:47:48 UTC
This is because our regex is matching the warning, we can fix that.
Comment 2 dean.ellis 2017-11-03 07:36:31 UTC
@peterc

can you gist the csproj of the failing project? I have tried to repo here and I can't. Do I know this is an issue as I have seen it before.
Comment 3 dean.ellis 2017-12-01 11:39:26 UTC
Should be fixed by xamarin-android/master/2135856e
Comment 5 uwantfries 2018-01-19 15:45:32 UTC
xamarin-android/master/2135856e

Any chance of a documented workaround or info on how to get the latest beta?

I cannot currently compile because of this.
Comment 6 Jon Douglas [MSFT] 2018-01-19 16:50:38 UTC
(In reply to uwantfries from comment #5)
> xamarin-android/master/2135856e
> 
> Any chance of a documented workaround or info on how to get the latest beta?
> 
> I cannot currently compile because of this.

This should be fixed in the current Visual Studio Preview channel. Feel free to follow these instructions to obtain it:

https://developer.xamarin.com/releases/android/xamarin.android_8/xamarin.android_8.2/#Installing