Skip to content

Xamarin Android Lint checks fail on Windows when ran against a very simple app #1374

@pjcollins

Description

@pjcollins

Lint checks are failing on Windows for a very simple application. These failures do not appear to be new to this specific environment, I am able to reproduce using d15-6 as well.

Steps to Reproduce

  1. msbuild /t:PackageForAndroid /p:AndroidLintEnabled=true HelloWorld\HelloWorld.csproj

https://github.com/xamarin/monodroid-samples/tree/master/HelloWorld

Expected Behavior

No warnings or errors are reported when building a simple app with lint checks enabled.

Actual Behavior

Multiple warnings and errors are reported when building a simple app with lint checks enabled.
I am warned that I have some unused resources (however to the best of my knowledge the single layout file and string resources are being used). There are also some new errors that manifest:

"C:\Users\peter\source\monodroid-samples\HelloWorld\HelloWorld.csproj" (PackageForAndroid target) (1) ->
(_LintChecks target) -> 
  C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(953,2): warning : Could not get version from 'C:\Program Files (x86)\Android\android-sdk\tools\bin\lint.bat' [C:\Users\peter\source\monodroid-samples\HelloWorld\HelloWorld.csproj]
  obj\Debug\obj\Debug\res\layout\main.xml(1): warning XA0102:  The resource R.layout.main appears to be unused [UnusedResources] [C:\Users\peter\source\monodroid-samples\HelloWorld\HelloWorld.csproj]
  obj\Debug\obj\Debug\res\values\strings.xml(1,75): warning XA0102:  The resource R.string.app_name appears to be unused [UnusedResources] [C:\Users\peter\source\monodroid-samples\HelloWorld\HelloWorld.csproj]
  obj\Debug\obj\Debug\res\values\strings.xml(1,19): warning XA0102:  The resource R.string.hello appears to be unused [UnusedResources] [C:\Users\peter\source\monodroid-samples\HelloWorld\HelloWorld.csproj]


"C:\Users\peter\source\monodroid-samples\HelloWorld\HelloWorld.csproj" (PackageForAndroid target) (1) ->
(_LintChecks target) -> 
  C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(953,2): error : Can't find API database; API check not performed [LintError] [C:\Users\peter\source\monodroid-samples\HelloWorld\HelloWorld.csproj]
  obj\Debug\android\AndroidManifest.xml(7,150): error XA0103:  Avoid hardcoding the debug mode; leaving it out allows debug and release builds to automatically assign one [HardcodedDebugMode] [C:\Users\peter\source\monodroid-samples\HelloWorld\HelloWorld.csproj]

    4 Warning(s)
    2 Error(s)

I have noticed that running lint.bat --version fails to produce version output as well, perhaps something is wrong with tool version?

Version Information

d15-7 - Xamarin.Android SDK 8.3.0.1
Android SDK Tools 26.1.1
Android SDK Platform-Tools 27.0.1
Android SDK Build Tools 27.0.3

Log File

Diagnostic build output:
https://gist.github.com/pjcollins/85ceb9880b55746a18f63fdd62d3cfa2

VS bug #608573

Metadata

Metadata

Assignees

No one assigned

    Labels

    Area: App+Library BuildIssues when building Library projects or Application projects.vs-syncFor internal use only; creates a VSTS "mirror" issue.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions