Skip to content

Conversation

@jonpryor
Copy link
Contributor

@jonpryor jonpryor commented Jun 7, 2022

Context: dotnet/android-tools#169

Does It Build™?

@jonpryor
Copy link
Contributor Author

jonpryor commented Jun 8, 2022

The BuildApplicationWithSpacesInPath(True,"dx","proguard") unit test fails:

CREATEMULTIDEXMAINDEXCLASSLIST : error : Could not find or load main class com.android.multidex.MainDexListBuilder [/Users/runner/work/1/a/TestRelease/06-07_02.44.53/temp/BuildReleaseApp AndÜmläüts(Truedxproguard)/UnnamedProject.csproj]
  Caused by: java.lang.ClassNotFoundException: com.android.multidex.MainDexListBuilder (TaskId:178)
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.DX.targets(62,5): error : java.lang.ClassNotFoundException :  com.android.multidex.MainDexListBuilder [/Users/runner/work/1/a/TestRelease/06-07_02.44.53/temp/BuildReleaseApp AndÜmläüts(Truedxproguard)/UnnamedProject.csproj]
Done executing task "CreateMultiDexMainDexClassList" -- FAILED. (TaskId:178)

Which is: #6774 (comment)

This is caused by $(AndroidSdkBuildToolsVersion) changing from 30.0.3 -- which contains com.android.multidex.MainDexListBuilder -- to 32.0.0, which does not:

% jar tf ~/android-toolchain/sdk/build-tools/30.0.3/lib/dx.jar | grep com.android.multidex.MainDexListBuilder
com/android/multidex/MainDexListBuilder.class

Build-tools 32.0.0 does not contain dx.jar

Use of dx / dx.jar is already not supported by .NET 5+ apps; attempting to use it elicits an XA1023 error; see 22bc14b.

As .NET 6 is now GA, and Classic Xamarin.Android has been emitting an XA1023 warning regarding dx use since Visual Studio 16.9 (released March 2021, well over a year ago)…

We will remove support for dx.jar for the forthcoming Visual Studio 17.3 release, and turn the current XA1023 warning into an error.

This is a change that customers will need to do anyway in order to migrate to .NET 6, and it will allow us to use a newer build-tools version.

@jonpryor
Copy link
Contributor Author

jonpryor commented Jun 8, 2022

Because of: https://github.com/xamarin/xamarin-android/blob/6b43af37bc57b7eea2a213ee15de037e61784a1c/src/Xamarin.Android.Build.Tasks/Xamarin.Android.Common.targets#L511-L514

Dropping support for $(AndroidDexTool)=dx also appears to mean that we drop support for ProGuard.

@jonpryor jonpryor force-pushed the jonp-try-xat-169 branch 6 times, most recently from 2c6be0d to 24a4781 Compare June 9, 2022 20:12
@jonpryor
Copy link
Contributor Author

jonpryor commented Jun 9, 2022

The InstallAndroidDependenciesTest test confuses me: https://devdiv.visualstudio.com/DevDiv/_build/results?buildId=6264533&view=ms.vss-test-web.build-test-results-tab&runId=43341232&resultId=100035&paneView=attachments

https://github.com/xamarin/xamarin-android/blob/fdfc4c44ba65fcff9caf809bcf2d1f1a6837b1e3/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/AndroidDependenciesTests.cs#L19-L50

It confuses me because I don't understand how this works on main!

The failure in this PR:

Task "ResolveSdks" (TaskId:7)
  Task Parameter:JavaSdkPath=C:\hostedtoolcache\windows\Java_Temurin-Hotspot_jdk\11.0.15-10\x64 (TaskId:7)
  Task Parameter:AndroidSdkPath=C:\a\_work\1\a\TestRelease\06-09_13.24.30\temp\InstallAndroidDependenciesTest\android-sdk (TaskId:7)
  Task Parameter:MinimumSupportedJavaVersion=1.6.0 (TaskId:7)
  Task Parameter:CommandLineToolsVersion=7.0 (TaskId:7)
  Task Parameter:ReferenceAssemblyPaths=C:\Program Files\Microsoft Visual Studio\2022\Enterprise\Common7\IDE\ReferenceAssemblies\Microsoft\Framework\MonoAndroid\v1.0\ (TaskId:7)
  Task Parameter:LatestSupportedJavaVersion=11.0.99 (TaskId:7)
  ValidateAndroidSdkLocation: `C:\a\_work\1\a\TestRelease\06-09_13.24.30\temp\InstallAndroidDependenciesTest\android-sdk`, result=False (TaskId:7)
  ValidateAndroidSdkLocation: ``, result=False (TaskId:7)
  Looking for Android SDK... (TaskId:7)
  ValidateAndroidSdkLocation: `C:\Program Files (x86)\Android\android-sdk`, result=True (TaskId:7)
  ValidateJavaSdkLocation: `C:\hostedtoolcache\windows\Java_Temurin-Hotspot_jdk\11.0.15-10\x64`, result=True (TaskId:7)
  ValidateAndroidNdkLocation: ``, result=False (TaskId:7)
  Skipping NDK in 'C:\Program Files (x86)\Android\android-sdk\ndk\23.2.8568313': version 24.0.8215888 is out of the accepted range (major version must be between 16 and 23 (TaskId:7)
  Best NDK selected: v22.1.7171670 in C:\Program Files (x86)\Android\android-sdk\ndk\22.1.7171670 (TaskId:7)
  ValidateAndroidNdkLocation: `C:\Program Files (x86)\Android\android-sdk\ndk\22.1.7171670`, result=True (TaskId:7)
  ResolveSdks Outputs: (TaskId:7)
    AndroidSdkPath: C:\Program Files (x86)\Android\android-sdk (TaskId:7)
    AndroidNdkPath: C:\Program Files (x86)\Android\android-sdk\ndk\22.1.7171670 (TaskId:7)
    JavaSdkPath: C:\hostedtoolcache\windows\Java_Temurin-Hotspot_jdk\11.0.15-10\x64 (TaskId:7)
    MonoAndroidBinPath: C:\Program Files\Microsoft Visual Studio\2022\Enterprise\MSBuild\Xamarin\Android\ (TaskId:7)
    MonoAndroidToolsPath: C:\Program Files\Microsoft Visual Studio\2022\Enterprise\MSBuild\Xamarin\Android (TaskId:7)
    AndroidBinUtilsPath: C:\Program Files\Microsoft Visual Studio\2022\Enterprise\MSBuild\Xamarin\Android\binutils\bin\ (TaskId:7)
  Output Property: _AndroidToolsDirectory=C:\Program Files %28x86%29\Android\android-sdk\cmdline-tools\latest (TaskId:7)
  Output Property: AndroidNdkDirectory=C:\Program Files %28x86%29\Android\android-sdk\ndk\22.1.7171670 (TaskId:7)
  Output Property: _AndroidNdkDirectory=C:\Program Files %28x86%29\Android\android-sdk\ndk\22.1.7171670 (TaskId:7)
  Output Property: _AndroidSdkDirectory=C:\Program Files %28x86%29\Android\android-sdk (TaskId:7)
  Output Property: _JavaSdkDirectory=C:\hostedtoolcache\windows\Java_Temurin-Hotspot_jdk\11.0.15-10\x64 (TaskId:7)
  Output Property: MonoAndroidToolsDirectory=C:\Program Files\Microsoft Visual Studio\2022\Enterprise\MSBuild\Xamarin\Android (TaskId:7)
  Output Property: MonoAndroidBinDirectory=C:\Program Files\Microsoft Visual Studio\2022\Enterprise\MSBuild\Xamarin\Android\ (TaskId:7)
  Output Property: MonoAndroidLibDirectory=C:\Program Files\Microsoft Visual Studio\2022\Enterprise\MSBuild\Xamarin\Android\lib\host-\ (TaskId:7)
  Output Property: AndroidBinUtilsDirectory=C:\Program Files\Microsoft Visual Studio\2022\Enterprise\MSBuild\Xamarin\Android\binutils\bin\ (TaskId:7)
Done executing task "ResolveSdks". (TaskId:7)

Note that the input parameter AndroidSdkPath is C:\a\_work\1\a\TestRelease\06-09_13.24.30\temp\InstallAndroidDependenciesTest\android-sdk, while the output parameter _AndroidSdkDirectory is C:\Program Files %28x86%29\Android\android-sdk.

The test asserts that _AndroidSdkDirectory matches AndroidSdkPath, and in this case they don't match, thus the test fails.

The reason this confuses me is because the <ResolveSdks/> task uses AndroidSdkInfo:

AndroidSdkInfo, in turn, tries multiple directories: https://github.com/xamarin/xamarin-android-tools/blob/20f611202bef0fc7c1659366dd38865eb119dde5/src/Xamarin.Android.Tools.AndroidSdk/Sdks/AndroidSdkBase.cs#L68

It tries the androidSdkPath parameter, then it tries PreferedAndroidSdkPath, then try GetAllAvailableAndroidSdks(). On Unix this means:

  1. Try androidSdkPath parameter, which will fail (it doesn't have an SDK install!)
  2. Try reading $HOME/.config/xbuild/monodroid-config.xml, if present, via PreferredAndroidSdkPath
  3. Try "everything" in GetAllAvailableAndroidSdks(), which tries (2), then environment variables such as $ANDROID_HOME and $ANDROID_SDK_ROOT (which are cleared by the unit test), then probing $PATH, then…

Windows is the same but different: instead of monodroid-config.xml, it uses the Windows Registry.

Thus, my question: how does this work on main? How does it not always fail because of monodroid-config.xml/etc.?

"Even Better", when I try to use msbuild with Xamarin.Android 12.2.4, I observe the same behavior: $(_AndroidSdkDirectory) contains the value from monodroid-config.xml even when I override $(AndroidSdkDirectory), and the only way to not get this behavior is to delete monodroid-config.xml.

@dellis1972: what am I missing? And how does this PR impact InstallAndroidDependencies?

jonpryor added a commit to jonpryor/xamarin-android that referenced this pull request Jun 9, 2022
Context: dotnet#7073
Context: dotnet#7073 (comment)

How does `InstallAndroidDependenciesTest()` pass?!

Let's Find Out?
@jonpryor
Copy link
Contributor Author

jonpryor commented Jun 9, 2022

I wondered 🤔 :

how does this work on main? How does it not always fail because of monodroid-config.xml/etc.?

Enter PR #7081, which updates InstallAndroidDependenciesTest() to contain:

var _configPath = Path.Combine (Environment.GetFolderPath (Environment.SpecialFolder.ApplicationData), "xbuild", "monodroid-config.xml");
bool haveConfigPath = File.Exists (_configPath);
// …
throw new Exception ($"# jonp: deliberate test failure! File.Exist(\"{_configPath}\")? {haveConfigPath}");

The result? https://devdiv.visualstudio.com/DevDiv/_build/results?buildId=6266673&view=ms.vss-test-web.build-test-results-tab&runId=43411452&resultId=100168&paneView=debug

System.Exception : # jonp: deliberate test failure! File.Exist("/Users/runner/.config/xbuild/monodroid-config.xml")? False

It works on main+macOS because monodroid-config.xml doesn't exist.

I'm not sure why it works on Windows; I would have to assume that it lacks the Registry entries which specify where the Android SDK is located.

TODO: update this PR to verify that it does have monodroid-config.xml, then figure out why it would have monodroid-config.xml.

jonpryor added a commit to jonpryor/xamarin-android that referenced this pull request Jun 9, 2022
Context: dotnet#7081
Context: dotnet#7073 (comment)

Trying to figure out why the `InstallAndroidDependenciesTest()` is
failing.  My *guess* is that `monodroid-config.xml` exists, causing
the `$(_AndroidSdkPath)` output property to use a *system-wide*
installation path, instead of the desired `$(AndoridSdkDirectory)`
input value.

PR dotnet#7081 tested behavior against main, and determined that
`monodroid-config.xml` doesn't exist, which may be why this test
passes on main.

Update dotnet#7073 to also assert the (non-?)existence of
`monodroid-config.xml`.  If it *does* exist, this would explain why
it's failing.

*If* it's failing because of `monodroid-config.xml`, the next question
becomes *why* it exists.  Update `BaseTest.TestSetup()` to assert
that it doesn't exist; when it does exist, tests will begin failing.
jonpryor added a commit to jonpryor/xamarin-android that referenced this pull request Jun 10, 2022
Context: dotnet#7081
Context: dotnet#7073 (comment)

Trying to figure out why the `InstallAndroidDependenciesTest()` is
failing.  My *guess* is that `monodroid-config.xml` exists, causing
the `$(_AndroidSdkPath)` output property to use a *system-wide*
installation path, instead of the desired `$(AndoridSdkDirectory)`
input value.

PR dotnet#7081 tested behavior against main, and determined that
`monodroid-config.xml` doesn't exist, which may be why this test
passes on main.

Update dotnet#7073 to also assert the (non-?)existence of
`monodroid-config.xml`.  If it *does* exist, this would explain why
it's failing.

*If* it's failing because of `monodroid-config.xml`, the next question
becomes *why* it exists.  Update `BaseTest.TestSetup()` to assert
that it doesn't exist; when it does exist, tests will begin failing.
@jonpryor
Copy link
Contributor Author

Followup on my earlier comment, I should have looked at the build log of the success build: https://devdiv.visualstudio.com/DevDiv/_build/results?buildId=6266673&view=ms.vss-test-web.build-test-results-tab&runId=43411452&resultId=100168&paneView=attachments

Task "ResolveSdks"
  Task Parameter:AndroidSdkPath=C:\a\_work\2\a\TestRelease\06-09_22.47.10\temp\InstallAndroidDependenciesTest\android-sdk
  Task Parameter:CommandLineToolsVersion=5.0
  Task Parameter:
      ReferenceAssemblyPaths=
          C:\a\_work\2\s\xamarin-android\bin\Release\dotnet\packs\Microsoft.Android.Sdk.Windows\33.0.0-ci.pr.gh7081.49\data\net7.0-android32\
          C:\a\_work\2\s\xamarin-android\bin\Release\dotnet\packs\Microsoft.Android.Sdk.Windows\33.0.0-ci.pr.gh7081.49\data\net7.0-android33\
  Task Parameter:LatestSupportedJavaVersion=11.0.99
  Task Parameter:MinimumSupportedJavaVersion=11.0
  Task Parameter:JavaSdkPath=C:\hostedtoolcache\windows\Java_Temurin-Hotspot_jdk\11.0.15-10\x64
  ValidateAndroidSdkLocation: `C:\a\_work\2\a\TestRelease\06-09_22.47.10\temp\InstallAndroidDependenciesTest\android-sdk`, result=True
  ValidateJavaSdkLocation: `C:\hostedtoolcache\windows\Java_Temurin-Hotspot_jdk\11.0.15-10\x64`, result=True
  ValidateAndroidNdkLocation: ``, result=False
  ValidateAndroidNdkLocation: ``, result=False
  Looking for Android NDK...
  ValidateAndroidNdkLocation: `C:\Android\android-sdk`, result=False
  ValidateAndroidNdkLocation: `C:\Android\android-sdk`, result=False
  Looking for Android SDK...
  Skipping NDK in 'C:\Program Files (x86)\Android\android-sdk\ndk\23.2.8568313': version 24.0.8215888 is out of the accepted range (major version must be between 16 and 23
  Best NDK selected: v22.1.7171670 in C:\Program Files (x86)\Android\android-sdk\ndk\22.1.7171670
  ValidateAndroidNdkLocation: `C:\Program Files (x86)\Android\android-sdk\ndk\22.1.7171670`, result=True
  ResolveSdks Outputs:
    AndroidSdkPath: C:\a\_work\2\a\TestRelease\06-09_22.47.10\temp\InstallAndroidDependenciesTest\android-sdk
    AndroidNdkPath: C:\Program Files (x86)\Android\android-sdk\ndk\22.1.7171670
    JavaSdkPath: C:\hostedtoolcache\windows\Java_Temurin-Hotspot_jdk\11.0.15-10\x64
    MonoAndroidBinPath: C:\a\_work\2\s\xamarin-android\bin\Release\dotnet\packs\Microsoft.Android.Sdk.Windows\33.0.0-ci.pr.gh7081.49\tools\
    MonoAndroidToolsPath: C:\a\_work\2\s\xamarin-android\bin\Release\dotnet\packs\Microsoft.Android.Sdk.Windows\33.0.0-ci.pr.gh7081.49\tools
    AndroidBinUtilsPath: C:\a\_work\2\s\xamarin-android\bin\Release\dotnet\packs\Microsoft.Android.Sdk.Windows\33.0.0-ci.pr.gh7081.49\tools\binutils\bin\
  Output Property: _AndroidToolsDirectory=C:\a\_work\2\a\TestRelease\06-09_22.47.10\temp\InstallAndroidDependenciesTest\android-sdk\cmdline-tools\5.0
  Output Property: AndroidNdkDirectory=C:\Program Files %28x86%29\Android\android-sdk\ndk\22.1.7171670
  Output Property: _AndroidNdkDirectory=C:\Program Files %28x86%29\Android\android-sdk\ndk\22.1.7171670
  Output Property: _AndroidSdkDirectory=C:\a\_work\2\a\TestRelease\06-09_22.47.10\temp\InstallAndroidDependenciesTest\android-sdk
  Output Property: _JavaSdkDirectory=C:\hostedtoolcache\windows\Java_Temurin-Hotspot_jdk\11.0.15-10\x64
  Output Property: MonoAndroidToolsDirectory=C:\a\_work\2\s\xamarin-android\bin\Release\dotnet\packs\Microsoft.Android.Sdk.Windows\33.0.0-ci.pr.gh7081.49\tools
  Output Property: MonoAndroidBinDirectory=C:\a\_work\2\s\xamarin-android\bin\Release\dotnet\packs\Microsoft.Android.Sdk.Windows\33.0.0-ci.pr.gh7081.49\tools\
  Output Property: MonoAndroidLibDirectory=C:\a\_work\2\s\xamarin-android\bin\Release\dotnet\packs\Microsoft.Android.Sdk.Windows\33.0.0-ci.pr.gh7081.49\tools\lib\host-\
  Output Property: AndroidBinUtilsDirectory=C:\a\_work\2\s\xamarin-android\bin\Release\dotnet\packs\Microsoft.Android.Sdk.Windows\33.0.0-ci.pr.gh7081.49\tools\binutils\bin\
Done executing task "ResolveSdks".

Of note is:

  ValidateAndroidSdkLocation: `C:\a\_work\2\a\TestRelease\06-09_22.47.10\temp\InstallAndroidDependenciesTest\android-sdk`, result=True

Meaning it never gets around to looking for monodroid-config.xml anyway -- even if it did exist -- because the "temporary" android-sdk directory is valid.

Compare to this PR:

  ValidateAndroidSdkLocation: `C:\a\_work\1\a\TestRelease\06-09_13.24.30\temp\InstallAndroidDependenciesTest\android-sdk`, result=False

Why doesn't …\temp\InstallAndroidDependenciesTest\android-sdk validate here?

This is the validation logic: https://github.com/xamarin/xamarin-android-tools/blob/20f611202bef0fc7c1659366dd38865eb119dde5/src/Xamarin.Android.Tools.AndroidSdk/Sdks/AndroidSdkBase.cs#L258-L263

public bool ValidateAndroidSdkLocation ([NotNullWhen (true)] string? loc)
{
	bool result = !string.IsNullOrEmpty (loc) && ProcessUtils.FindExecutablesInDirectory (Path.Combine (loc, "platform-tools"), Adb).Any ();
	Logger (TraceLevel.Verbose, $"{nameof (ValidateAndroidSdkLocation)}: `{loc}`, result={result}");
	return result;
}

meaning it wants a …\android-sdk to exist, and it wants an …\android-sdk\platform-tools\adb* file to exist.

How would platform-tools\adb exist? The unit test creates an empty directory: https://github.com/xamarin/xamarin-android/blob/fdfc4c44ba65fcff9caf809bcf2d1f1a6837b1e3/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/AndroidDependenciesTests.cs#L28-L30

Would something else be creating the platform-tools child directory?

@dellis1972
Copy link
Contributor

@jonpryor

This is very weird. It might be that some logic in xamarin-androidt-tools changed since we last bumped. Given we provide an empty directory for the sdk for the test, it suggests that we didn't used to validate it. But now we are.... 🤷

@jonpryor
Copy link
Contributor Author

@dellis1972: the only change is a change to Xamarin.Android.Tools.Versions.props: dotnet/android-tools@20f6112...0ef8714

I'm having trouble wrapping my head around how a property value change would cause ValidateAndroidNdkLocation() to now break. :-/

@jonpryor
Copy link
Contributor Author

Followup to:

TODO: update this PR to verify that it does have monodroid-config.xml, then figure out why it would have monodroid-config.xml.

From the build log: https://devdiv.visualstudio.com/DevDiv/_build/results?buildId=6268031&view=logs&j=28e101f7-a5d4-5072-d882-1de9b1157eea&t=013f663a-211c-5fb0-6deb-0fdb51486b69

 [TESTLOG] `/Users/runner/.config/xbuild/monodroid-config.xml` exists? False

meaning that monodroid-config.xml is a red herring (here, but not on my local machine): it doesn't exist, and thus can't be providing the $(_AndroidSdkPath) output property value.

@jonpryor
Copy link
Contributor Author

I'm starting to think its the cmdline-tools bump (?!).

"Good" run (with extra newlines):

Task "ResolveSdks"
  Task Parameter:CommandLineToolsVersion=5.0 
  Task Parameter:ReferenceAssemblyPaths=/Library/Frameworks/Mono.framework/External/xbuild-frameworks/MonoAndroid/v1.0/
  Task Parameter:AndroidSdkPath=/Users/runner/work/1/a/TestRelease/06-09_22.00.22/temp/InstallAndroidDependenciesTest/android-sdk 
  Task Parameter:JavaSdkPath=/Users/runner/hostedtoolcache/Java_Temurin-Hotspot_jdk/11.0.15-10/x64/Contents/Home/
  Task Parameter:LatestSupportedJavaVersion=11.0.99 
  Task Parameter:MinimumSupportedJavaVersion=1.6.0 
  ValidateAndroidSdkLocation: `/Users/runner/work/1/a/TestRelease/06-09_22.00.22/temp/InstallAndroidDependenciesTest/android-sdk`, result=True 
  ValidateJavaSdkLocation: `/Users/runner/hostedtoolcache/Java_Temurin-Hotspot_jdk/11.0.15-10/x64/Contents/Home/`, result=True 
  ValidateAndroidNdkLocation: ``, result=False 
  ValidateAndroidNdkLocation: ``, result=False 
  ValidateAndroidNdkLocation: `/Users/runner/Library/Android/sdk/ndk-bundle`, result=True 
  ResolveSdks Outputs:
    AndroidSdkPath: /Users/runner/work/1/a/TestRelease/06-09_22.00.22/temp/InstallAndroidDependenciesTest/android-sdk 
    AndroidNdkPath: /Users/runner/Library/Android/sdk/ndk-bundle 
    JavaSdkPath: /Users/runner/hostedtoolcache/Java_Temurin-Hotspot_jdk/11.0.15-10/x64/Contents/Home/
    MonoAndroidBinPath: /Library/Frameworks/Xamarin.Android.framework/Libraries/xbuild/Xamarin/Android/Darwin/
    MonoAndroidToolsPath: /Library/Frameworks/Xamarin.Android.framework/Libraries/xbuild/Xamarin/Android 
    AndroidBinUtilsPath: /Library/Frameworks/Xamarin.Android.framework/Libraries/xbuild/Xamarin/Android/Darwin/binutils/bin/
  Output Property: _AndroidToolsDirectory=/Users/runner/work/1/a/TestRelease/06-09_22.00.22/temp/InstallAndroidDependenciesTest/android-sdk/cmdline-tools/5.0 
  Output Property: AndroidNdkDirectory=/Users/runner/Library/Android/sdk/ndk-bundle 
  Output Property: _AndroidNdkDirectory=/Users/runner/Library/Android/sdk/ndk-bundle 
  Output Property: _AndroidSdkDirectory=/Users/runner/work/1/a/TestRelease/06-09_22.00.22/temp/InstallAndroidDependenciesTest/android-sdk 
  Output Property: _JavaSdkDirectory=/Users/runner/hostedtoolcache/Java_Temurin-Hotspot_jdk/11.0.15-10/x64/Contents/Home/
  Output Property: MonoAndroidToolsDirectory=/Library/Frameworks/Xamarin.Android.framework/Libraries/xbuild/Xamarin/Android 
  Output Property: MonoAndroidBinDirectory=/Library/Frameworks/Xamarin.Android.framework/Libraries/xbuild/Xamarin/Android/Darwin/
  Output Property: MonoAndroidLibDirectory=/Library/Frameworks/Xamarin.Android.framework/Libraries/xbuild/Xamarin/Android/lib/host-Darwin/
  Output Property: AndroidBinUtilsDirectory=/Library/Frameworks/Xamarin.Android.framework/Libraries/xbuild/Xamarin/Android/Darwin/binutils/bin/
Done executing task "ResolveSdks". 

"Bad" run:

Task "ResolveSdks"
  Task Parameter:CommandLineToolsVersion=7.0
  Task Parameter:ReferenceAssemblyPaths=/Library/Frameworks/Mono.framework/External/xbuild-frameworks/MonoAndroid/v1.0/
  Task Parameter:AndroidSdkPath=/Users/runner/work/1/a/TestRelease/06-10_11.08.22/temp/InstallAndroidDependenciesTest/android-sdk
  Task Parameter:JavaSdkPath=/Users/runner/hostedtoolcache/Java_Temurin-Hotspot_jdk/11.0.15-10/x64/Contents/Home/
  Task Parameter:LatestSupportedJavaVersion=11.0.99
  Task Parameter:MinimumSupportedJavaVersion=1.6.0
  ValidateAndroidSdkLocation: `/Users/runner/work/1/a/TestRelease/06-10_11.08.22/temp/InstallAndroidDependenciesTest/android-sdk`, result=False
  ValidateAndroidSdkLocation: ``, result=False
  ValidateAndroidSdkLocation: `/Users/runner/Library/Android/sdk`, result=True
  ValidateJavaSdkLocation: `/Users/runner/hostedtoolcache/Java_Temurin-Hotspot_jdk/11.0.15-10/x64/Contents/Home/`, result=True
  ValidateAndroidNdkLocation: ``, result=False
  Skipping NDK in '/Users/runner/Library/Android/sdk/ndk/24.0.8215888': version 24.0.8215888 is out of the accepted range (major version must be between 16 and 23
  Best NDK selected: v23.2.8568313 in /Users/runner/Library/Android/sdk/ndk/23.2.8568313
  ValidateAndroidNdkLocation: `/Users/runner/Library/Android/sdk/ndk/23.2.8568313`, result=True
  ResolveSdks Outputs:
    AndroidSdkPath: /Users/runner/Library/Android/sdk
    AndroidNdkPath: /Users/runner/Library/Android/sdk/ndk/23.2.8568313
    JavaSdkPath: /Users/runner/hostedtoolcache/Java_Temurin-Hotspot_jdk/11.0.15-10/x64/Contents/Home/
    MonoAndroidBinPath: /Library/Frameworks/Xamarin.Android.framework/Libraries/xbuild/Xamarin/Android/Darwin/
    MonoAndroidToolsPath: /Library/Frameworks/Xamarin.Android.framework/Libraries/xbuild/Xamarin/Android
    AndroidBinUtilsPath: /Library/Frameworks/Xamarin.Android.framework/Libraries/xbuild/Xamarin/Android/Darwin/binutils/bin/
  Output Property: _AndroidToolsDirectory=/Users/runner/Library/Android/sdk/cmdline-tools/7.0
  Output Property: AndroidNdkDirectory=/Users/runner/Library/Android/sdk/ndk/23.2.8568313
  Output Property: _AndroidNdkDirectory=/Users/runner/Library/Android/sdk/ndk/23.2.8568313
  Output Property: _AndroidSdkDirectory=/Users/runner/Library/Android/sdk
  Output Property: _JavaSdkDirectory=/Users/runner/hostedtoolcache/Java_Temurin-Hotspot_jdk/11.0.15-10/x64/Contents/Home/
  Output Property: MonoAndroidToolsDirectory=/Library/Frameworks/Xamarin.Android.framework/Libraries/xbuild/Xamarin/Android
  Output Property: MonoAndroidBinDirectory=/Library/Frameworks/Xamarin.Android.framework/Libraries/xbuild/Xamarin/Android/Darwin/
  Output Property: MonoAndroidLibDirectory=/Library/Frameworks/Xamarin.Android.framework/Libraries/xbuild/Xamarin/Android/lib/host-Darwin/
  Output Property: AndroidBinUtilsDirectory=/Library/Frameworks/Xamarin.Android.framework/Libraries/xbuild/Xamarin/Android/Darwin/binutils/bin/
Done executing task "ResolveSdks".

The diff between the two (after removing "irrelevant" details such as unique directory names, Task IDs, etc.):

--- GOOD.txt	2022-06-10 09:06:36.000000000 -0400
+++ BAD.txt	2022-06-10 09:06:03.000000000 -0400
@@ -1,26 +1,29 @@
 Task "ResolveSdks"
-  Task Parameter:CommandLineToolsVersion=5.0
+  Task Parameter:CommandLineToolsVersion=7.0
   Task Parameter:ReferenceAssemblyPaths=/Library/Frameworks/Mono.framework/External/xbuild-frameworks/MonoAndroid/v1.0/
   Task Parameter:AndroidSdkPath=/Users/runner/work/1/a/TestRelease/DATE/temp/InstallAndroidDependenciesTest/android-sdk
   Task Parameter:JavaSdkPath=/Users/runner/hostedtoolcache/Java_Temurin-Hotspot_jdk/11.0.15-10/x64/Contents/Home/
   Task Parameter:LatestSupportedJavaVersion=11.0.99
   Task Parameter:MinimumSupportedJavaVersion=1.6.0
-  ValidateAndroidSdkLocation: `/Users/runner/work/1/a/TestRelease/DATE/temp/InstallAndroidDependenciesTest/android-sdk`, result=True
+  ValidateAndroidSdkLocation: `/Users/runner/work/1/a/TestRelease/DATE/temp/InstallAndroidDependenciesTest/android-sdk`, result=False
+  ValidateAndroidSdkLocation: ``, result=False
+  ValidateAndroidSdkLocation: `/Users/runner/Library/Android/sdk`, result=True
   ValidateJavaSdkLocation: `/Users/runner/hostedtoolcache/Java_Temurin-Hotspot_jdk/11.0.15-10/x64/Contents/Home/`, result=True
   ValidateAndroidNdkLocation: ``, result=False
-  ValidateAndroidNdkLocation: ``, result=False
-  ValidateAndroidNdkLocation: `/Users/runner/Library/Android/sdk/ndk-bundle`, result=True
+  Skipping NDK in '/Users/runner/Library/Android/sdk/ndk/24.0.8215888': version 24.0.8215888 is out of the accepted range (major version must be between 16 and 23
+  Best NDK selected: v23.2.8568313 in /Users/runner/Library/Android/sdk/ndk/23.2.8568313
+  ValidateAndroidNdkLocation: `/Users/runner/Library/Android/sdk/ndk/23.2.8568313`, result=True
   ResolveSdks Outputs:
-    AndroidSdkPath: /Users/runner/work/1/a/TestRelease/DATE/temp/InstallAndroidDependenciesTest/android-sdk
-    AndroidNdkPath: /Users/runner/Library/Android/sdk/ndk-bundle
+    AndroidSdkPath: /Users/runner/Library/Android/sdk
+    AndroidNdkPath: /Users/runner/Library/Android/sdk/ndk/23.2.8568313
     JavaSdkPath: /Users/runner/hostedtoolcache/Java_Temurin-Hotspot_jdk/11.0.15-10/x64/Contents/Home/
     MonoAndroidBinPath: /Library/Frameworks/Xamarin.Android.framework/Libraries/xbuild/Xamarin/Android/Darwin/
     MonoAndroidToolsPath: /Library/Frameworks/Xamarin.Android.framework/Libraries/xbuild/Xamarin/Android
     AndroidBinUtilsPath: /Library/Frameworks/Xamarin.Android.framework/Libraries/xbuild/Xamarin/Android/Darwin/binutils/bin/
-  Output Property: _AndroidToolsDirectory=/Users/runner/work/1/a/TestRelease/DATE/temp/InstallAndroidDependenciesTest/android-sdk/cmdline-tools/5.0
-  Output Property: AndroidNdkDirectory=/Users/runner/Library/Android/sdk/ndk-bundle
-  Output Property: _AndroidNdkDirectory=/Users/runner/Library/Android/sdk/ndk-bundle
-  Output Property: _AndroidSdkDirectory=/Users/runner/work/1/a/TestRelease/DATE/temp/InstallAndroidDependenciesTest/android-sdk
+  Output Property: _AndroidToolsDirectory=/Users/runner/Library/Android/sdk/cmdline-tools/7.0
+  Output Property: AndroidNdkDirectory=/Users/runner/Library/Android/sdk/ndk/23.2.8568313
+  Output Property: _AndroidNdkDirectory=/Users/runner/Library/Android/sdk/ndk/23.2.8568313
+  Output Property: _AndroidSdkDirectory=/Users/runner/Library/Android/sdk
   Output Property: _JavaSdkDirectory=/Users/runner/hostedtoolcache/Java_Temurin-Hotspot_jdk/11.0.15-10/x64/Contents/Home/
   Output Property: MonoAndroidToolsDirectory=/Library/Frameworks/Xamarin.Android.framework/Libraries/xbuild/Xamarin/Android
   Output Property: MonoAndroidBinDirectory=/Library/Frameworks/Xamarin.Android.framework/Libraries/xbuild/Xamarin/Android/Darwin/

jonpryor added a commit to dotnet/android-tools that referenced this pull request Jun 10, 2022
Context: dotnet/android#7073 (comment)

I *suspect* that bumping `$(AndroidCommandLineToolsVersion)`=7.0
is causing the `InstallAndroidDependenciesTest()` unit test to fail,
though I don't understand why.

Reset `$(AndroidCommandLineToolsVersion)`=5.0, and see if that fixes
things.
jonpryor added a commit to jonpryor/xamarin-android that referenced this pull request Jun 10, 2022
Context: dotnet#7073 (comment)

I suspect that `$(AndroidCommandLineToolsVersion)`=7.0 is causing the
`InstallAndroidDependenciesTest()` unit test to fail.

Bump to a xamarin-android-tools commit which resets
`$(AndroidCommandLineToolsVersion)`=5.0.  Does that help?
@jonpryor
Copy link
Contributor Author

Followup from:

I'm starting to think its the cmdline-tools bump (?!).

lol, no: https://devdiv.visualstudio.com/DevDiv/_build/results?buildId=6269764&view=ms.vss-test-web.build-test-results-tab&runId=43484882&resultId=100035&paneView=attachments

Task "ResolveSdks"
  Task Parameter:JavaSdkPath=C:\hostedtoolcache\windows\Java_Temurin-Hotspot_jdk\11.0.15-10\x64
  Task Parameter:AndroidSdkPath=C:\a\_work\1\a\TestRelease\06-10_14.36.42\temp\InstallAndroidDependenciesTest\android-sdk
  Task Parameter:MinimumSupportedJavaVersion=1.6.0
  Task Parameter:CommandLineToolsVersion=5.0
  Task Parameter:ReferenceAssemblyPaths=C:\Program Files\Microsoft Visual Studio\2022\Enterprise\Common7\IDE\ReferenceAssemblies\Microsoft\Framework\MonoAndroid\v1.0\
  Task Parameter:LatestSupportedJavaVersion=11.0.99
  ValidateAndroidSdkLocation: `C:\a\_work\1\a\TestRelease\06-10_14.36.42\temp\InstallAndroidDependenciesTest\android-sdk`, result=False
  ValidateAndroidSdkLocation: ``, result=False
  Looking for Android SDK...
  ValidateAndroidSdkLocation: `C:\Program Files (x86)\Android\android-sdk`, result=True
  ValidateJavaSdkLocation: `C:\hostedtoolcache\windows\Java_Temurin-Hotspot_jdk\11.0.15-10\x64`, result=True
  ValidateAndroidNdkLocation: ``, result=False
  Skipping NDK in 'C:\Program Files (x86)\Android\android-sdk\ndk\23.2.8568313': version 24.0.8215888 is out of the accepted range (major version must be between 16 and 23
  Best NDK selected: v22.1.7171670 in C:\Program Files (x86)\Android\android-sdk\ndk\22.1.7171670
  ValidateAndroidNdkLocation: `C:\Program Files (x86)\Android\android-sdk\ndk\22.1.7171670`, result=True
  ResolveSdks Outputs:
    AndroidSdkPath: C:\Program Files (x86)\Android\android-sdk
    AndroidNdkPath: C:\Program Files (x86)\Android\android-sdk\ndk\22.1.7171670
    JavaSdkPath: C:\hostedtoolcache\windows\Java_Temurin-Hotspot_jdk\11.0.15-10\x64
    MonoAndroidBinPath: C:\Program Files\Microsoft Visual Studio\2022\Enterprise\MSBuild\Xamarin\Android\
    MonoAndroidToolsPath: C:\Program Files\Microsoft Visual Studio\2022\Enterprise\MSBuild\Xamarin\Android
    AndroidBinUtilsPath: C:\Program Files\Microsoft Visual Studio\2022\Enterprise\MSBuild\Xamarin\Android\binutils\bin\
  Output Property: _AndroidToolsDirectory=C:\Program Files %28x86%29\Android\android-sdk\cmdline-tools\5.0
  Output Property: AndroidNdkDirectory=C:\Program Files %28x86%29\Android\android-sdk\ndk\22.1.7171670
  Output Property: _AndroidNdkDirectory=C:\Program Files %28x86%29\Android\android-sdk\ndk\22.1.7171670
  Output Property: _AndroidSdkDirectory=C:\Program Files %28x86%29\Android\android-sdk
  Output Property: _JavaSdkDirectory=C:\hostedtoolcache\windows\Java_Temurin-Hotspot_jdk\11.0.15-10\x64
  Output Property: MonoAndroidToolsDirectory=C:\Program Files\Microsoft Visual Studio\2022\Enterprise\MSBuild\Xamarin\Android
  Output Property: MonoAndroidBinDirectory=C:\Program Files\Microsoft Visual Studio\2022\Enterprise\MSBuild\Xamarin\Android\
  Output Property: MonoAndroidLibDirectory=C:\Program Files\Microsoft Visual Studio\2022\Enterprise\MSBuild\Xamarin\Android\lib\host-\
  Output Property: AndroidBinUtilsDirectory=C:\Program Files\Microsoft Visual Studio\2022\Enterprise\MSBuild\Xamarin\Android\binutils\bin\
Done executing task "ResolveSdks".

CommandLineToolsVersion=5.0 (meaning the reversion was successful), yet it still fails:

  ValidateAndroidSdkLocation: `C:\a\_work\1\a\TestRelease\06-10_14.36.42\temp\InstallAndroidDependenciesTest\android-sdk`, result=False

How does it work, and why does it fail?

jonpryor added a commit to dotnet/android-tools that referenced this pull request Jun 10, 2022
Context: dotnet/android#7073
Context: https://github.com/xamarin/xamarin-android/blob/fdfc4c44ba65fcff9caf809bcf2d1f1a6837b1e3/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/AndroidDependenciesTests.cs#L19-L50

Trying to figure out how xamarin-android's
`AndroidDependenciesTests.InstallAndroidDependenciesTest()` *passes*;
it creates an empty "SDK" directory, then builds with the
`InstallAndroidDependencies` target, and on main this works,
*even though* it implies that it's creating an `AndroidSdkInfo`
instance with an *empty* SDK directory:

	if (Directory.Exists (sdkPath))
		Directory.Delete (sdkPath, true);
	Directory.CreateDirectory (sdkPath);
	// `sdkPath` is not otherwise populated

Yet it *passes* `ValidateAndroidSdkLocation()`:

	  ValidateAndroidSdkLocation: `/Users/runner/work/1/a/TestRelease/06-09_22.00.22/temp/InstallAndroidDependenciesTest/android-sdk`, result=True

I do not understand *how* this can be the case, as
`ValidateAndroidSdkLocation()` wants a `platform-tools/adb` program,
*which should not exist*, yet it validates

I am thus very confused.

Expand the log messages provided by `AndroidSdkBase` & co. so that
we also log "where" the `loc` parameter is coming from, via a new
`locator` parameter (similar to the `locator` parameter in `JdkInfo`),
and update the "file check" logic so that we log the path of the
detected files.

This way, hopefully, I can verify that it *is* finding an `adb`,
and *where that file is located*.
@jonpryor
Copy link
Contributor Author

In the continuing front of wait, what?:

How does it work, and why does it fail?

Behold!

The result of which is…

Test log: https://devdiv.visualstudio.com/DevDiv/_build/results?buildId=6270405&view=logs&j=0c842711-95d4-557a-1ed2-7d41f084dcd8&t=fec3f8b3-86d0-50bb-f604-0b1ef7bd29c7

[TESTLOG] InstallAndroidDependenciesTest: empty sdkPath size? 18
[TESTLOG] InstallAndroidDependenciesTest: before build sdkPath size? 18

Which contains a typo (doh!), as it's traversing /tmp, not sdkPath. Double doh!

At least we have the Build log: https://devdiv.visualstudio.com/DevDiv/_build/results?buildId=6270405&view=ms.vss-test-web.build-test-results-tab&runId=43504898&resultId=100035&paneView=attachments

  ValidateAndroidSdkLocation: for locator=constructor param, path=`/Users/runner/work/1/a/TestRelease/06-10_18.20.50/temp/InstallAndroidDependenciesTest/android-sdk`, found adb `/Users/runner/work/1/a/TestRelease/06-10_18.20.50/temp/InstallAndroidDependenciesTest/android-sdk/platform-tools/adb` (TaskId:6)
  ValidateAndroidSdkLocation: for locator=constructor param, path=`/Users/runner/work/1/a/TestRelease/06-10_18.20.50/temp/InstallAndroidDependenciesTest/android-sdk`, result=True (TaskId:6)
  ValidateJavaSdkLocation: for locator=constructor param, path=`/Users/runner/hostedtoolcache/Java_Temurin-Hotspot_jdk/11.0.15-10/x64/Contents/Home/`, found jarsigner `/Users/runner/hostedtoolcache/Java_Temurin-Hotspot_jdk/11.0.15-10/x64/Contents/Home/bin/jarsigner` (TaskId:6)
  ValidateJavaSdkLocation: locator=constructor param, path=`/Users/runner/hostedtoolcache/Java_Temurin-Hotspot_jdk/11.0.15-10/x64/Contents/Home/`, result=True (TaskId:6)
  ValidateAndroidNdkLocation: for locator=constructor param, path=``, result=False (TaskId:6)
  ValidateAndroidNdkLocation: for locator=preferred path, path=``, result=False (TaskId:6)
  ValidateAndroidNdkLocation: for locator=all paths, path=`/Users/runner/Library/Android/sdk/ndk-bundle`, result=True (TaskId:6)

The constructor parameter path contains platform-tools/adb!

@jonpryor
Copy link
Contributor Author

Previously mentioned:

Which contains a typo (doh!), as it's traversing /tmp, not sdkPath. Double doh!

After fixing that, things seem more reasonable: https://devdiv.visualstudio.com/DevDiv/_build/results?buildId=6270985&view=logs&j=0c842711-95d4-557a-1ed2-7d41f084dcd8&t=fec3f8b3-86d0-50bb-f604-0b1ef7bd29c7

TESTLOG] Test InstallAndroidDependenciesTest Starting
[TESTLOG] InstallAndroidDependenciesTest: empty sdkPath size? 
[TESTLOG] InstallAndroidDependenciesTest: before build sdkPath size? 
msbuild /Users/runner/work/1/a/TestRelease/06-10_20.12.29/temp/InstallAndroidDependenciesTest/UnnamedProject.csproj /t:InstallAndroidDependencies /noconsolelogger "/flp1:LogFile=/Users/runner/work/1/a/TestRelease/06-10_20.12.29/temp/InstallAndroidDependenciesTest/build.log;Encoding=UTF-8;Verbosity=diagnostic" -nodeReuse:false @"/Users/runner/work/1/a/TestRelease/06-10_20.12.29/temp/InstallAndroidDependenciesTest/project.rsp"
Found Time Elapsed 00:01:27.1500000
[TESTLOG] InstallAndroidDependenciesTest: after build sdkPath size? /Users/runner/work/1/a/TestRelease/06-10_20.12.29/temp/InstallAndroidDependenciesTest/android-sdk/platforms,  …

i.e. the empty directory is empty (yay), and then isn't empty after running the InstallAndroidDependencies target.

So something else is going on, so I updated <ResolveSdks/>:

commit 0e29341d256edd3d2c855cbc5cb09104910e8570
Author: Jonathan Pryor <[email protected]>
Date:   Fri Jun 10 13:08:37 2022 -0400

    MOAR LOGGING
    
    How does `ValidateAndroidSdkLocation()` accept a (what should be)
    empty directory?

diff --git a/src/Xamarin.Android.Build.Tasks/Tasks/ResolveSdksTask.cs b/src/Xamarin.Android.Build.Tasks/Tasks/ResolveSdksTask.cs
index a93bdb235..f59997431 100644
--- a/src/Xamarin.Android.Build.Tasks/Tasks/ResolveSdksTask.cs
+++ b/src/Xamarin.Android.Build.Tasks/Tasks/ResolveSdksTask.cs
@@ -96,6 +96,13 @@ namespace Xamarin.Android.Tasks
 
 			JavaSdkPath         = MonoAndroidHelper.GetJdkInfo (this.CreateTaskLogger (), JavaSdkPath, minVersion, maxVersion)?.HomePath;
 
+			if (Directory.Exists (AndroidSdkPath)) {
+				Log.LogDebugMessage ($"# jonp: AndroidSdkPath={AndroidSdkPath}; contents");
+				foreach (var p in Directory.EnumerateFileSystemEntries (AndroidSdkPath, "*", SearchOption.AllDirectories)) {
+					Log.LogDebugMessage ("#   jonp: {p}");
+				}
+			}
+
 			MonoAndroidHelper.RefreshSupportedVersions (ReferenceAssemblyPaths);
 
 			try {

and the build log contains: https://devdiv.visualstudio.com/DevDiv/_build/results?buildId=6270985&view=ms.vss-test-web.build-test-results-tab&runId=43530374&resultId=100035&paneView=attachments

Task "ResolveSdks" (TaskId:6)
  Task Parameter:CommandLineToolsVersion=5.0 (TaskId:6)
  Task Parameter:ReferenceAssemblyPaths=/Library/Frameworks/Mono.framework/External/xbuild-frameworks/MonoAndroid/v1.0/ (TaskId:6)
  Task Parameter:AndroidSdkPath=/Users/runner/work/1/a/TestRelease/06-10_20.12.29/temp/InstallAndroidDependenciesTest/android-sdk (TaskId:6)
  Task Parameter:JavaSdkPath=/Users/runner/hostedtoolcache/Java_Temurin-Hotspot_jdk/11.0.15-10/x64/Contents/Home/ (TaskId:6)
  Task Parameter:LatestSupportedJavaVersion=11.0.99 (TaskId:6)
  Task Parameter:MinimumSupportedJavaVersion=1.6.0 (TaskId:6)
  # jonp: AndroidSdkPath=/Users/runner/work/1/a/TestRelease/06-10_20.12.29/temp/InstallAndroidDependenciesTest/android-sdk; contents (TaskId:6)
  #   jonp: {p} (TaskId:6)
…

(Yet another typo; I forgot to use $"…").

There are lots of those # jonp: {p} messages, meaning that by the time <ResolveSdks/> runs, /Users/runner/work/1/a/TestRelease/06-10_20.12.29/temp/InstallAndroidDependenciesTest/android-sdk has contents.

Why/How?

And now I think we get to the crux of the problem: we're not preserving all of the build logs.

process.log contains: https://devdiv.visualstudio.com/DevDiv/_build/results?buildId=6270985&view=ms.vss-test-web.build-test-results-tab&runId=43530374&resultId=100035&paneView=attachments

msbuild /Users/runner/work/1/a/TestRelease/06-10_20.12.29/temp/InstallAndroidDependenciesTest/UnnamedProject.csproj /t:InstallAndroidDependencies /noconsolelogger "/flp1:LogFile=/Users/runner/work/1/a/TestRelease/06-10_20.12.29/temp/InstallAndroidDependenciesTest/build.log;Encoding=UTF-8;Verbosity=diagnostic" -nodeReuse:false @"/Users/runner/work/1/a/TestRelease/06-10_20.12.29/temp/InstallAndroidDependenciesTest/project.rsp"
Microsoft (R) Build Engine version 16.10.1 for Mono
Copyright (C) Microsoft Corporation. All rights reserved.

/Library/Frameworks/Mono.framework/Versions/6.12.0/lib/mono/msbuild/15.0/bin/MSBuild.dll /noconsolelogger -nodeReuse:false /bl:/Users/runner/work/1/a/TestRelease/06-10_20.12.29/temp/InstallAndroidDependenciesTest/msbuild.binlog /flp1:LogFile=/Users/runner/work/1/a/TestRelease/06-10_20.12.29/temp/InstallAndroidDependenciesTest/build.log;Encoding=UTF-8;Verbosity=diagnostic /p:_DisableParallelAot=true /p:BuildingInsideVisualStudio=True /p:BuildingOutOfProcess=true /p:AndroidSdkDirectory=/Users/runner/work/1/a/TestRelease/06-10_20.12.29/temp/InstallAndroidDependenciesTest/android-sdk /p:JavaSdkDirectory=/Users/runner/hostedtoolcache/Java_Temurin-Hotspot_jdk/11.0.15-10/x64/Contents/Home/ /p:AcceptAndroidSDKLicenses=true /p:AndroidManifestType=GoogleV2 /t:InstallAndroidDependencies /Users/runner/work/1/a/TestRelease/06-10_20.12.29/temp/InstallAndroidDependenciesTest/UnnamedProject.csproj
ExitCode: 0
msbuild /Users/runner/work/1/a/TestRelease/06-10_20.12.29/temp/InstallAndroidDependenciesTest/UnnamedProject.csproj /t:Build,SignAndroidPackage /noconsolelogger "/flp1:LogFile=/Users/runner/work/1/a/TestRelease/06-10_20.12.29/temp/InstallAndroidDependenciesTest/build.log;Encoding=UTF-8;Verbosity=diagnostic" -nodeReuse:false @"/Users/runner/work/1/a/TestRelease/06-10_20.12.29/temp/InstallAndroidDependenciesTest/project.rsp"
Microsoft (R) Build Engine version 16.10.1 for Mono
Copyright (C) Microsoft Corporation. All rights reserved.

/Library/Frameworks/Mono.framework/Versions/6.12.0/lib/mono/msbuild/15.0/bin/MSBuild.dll /noconsolelogger -nodeReuse:false /bl:/Users/runner/work/1/a/TestRelease/06-10_20.12.29/temp/InstallAndroidDependenciesTest/msbuild.binlog /flp1:LogFile=/Users/runner/work/1/a/TestRelease/06-10_20.12.29/temp/InstallAndroidDependenciesTest/build.log;Encoding=UTF-8;Verbosity=diagnostic /p:_DisableParallelAot=true /p:BuildingInsideVisualStudio=True /p:BuildingOutOfProcess=true /p:AndroidSdkDirectory=/Users/runner/work/1/a/TestRelease/06-10_20.12.29/temp/InstallAndroidDependenciesTest/android-sdk /p:JavaSdkDirectory=/Users/runner/hostedtoolcache/Java_Temurin-Hotspot_jdk/11.0.15-10/x64/Contents/Home/ /t:Build,SignAndroidPackage /Users/runner/work/1/a/TestRelease/06-10_20.12.29/temp/InstallAndroidDependenciesTest/UnnamedProject.csproj
ExitCode: 0

A careful reading shows two msbuild invocations, each of which writes to build.log.

Meaning the only build.log file I have access to is from the second invocation, while what I need access to is from the first invocation, the /t:InstallAndroidDependencies invocation!

Oof.

jonpryor added a commit to jonpryor/xamarin-android that referenced this pull request Jun 10, 2022
Context: dotnet#7073 (comment)

The story so far…  Why does `InstallAndroidDependenciesTest()` fail?
We still don't know.

However, we know that the unit test fails because the `Build` step
is using the wrong SDK directory, and it's using the wrong SDK
directory because the `InstallAndroidDependencies` target failed!

Worse, we don't know *why* it failed, because the log file for the
`InstallAndroidDependencies` target is *overwritten* by the
`Build` target on the next run!

Update `InstallAndroidDependenciesTest()` so that a different log
file is used for the `InstallAndroidDependencies` target.

Maybe then we can get some useful details?
jonpryor added a commit to jonpryor/xamarin-android that referenced this pull request Jun 11, 2022
Context: dotnet#7073 (comment)

I *think* `InstallAndroidDependenciesTest()` should pass now.
jonpryor added a commit to jonpryor/xamarin-android that referenced this pull request Jun 11, 2022
Context: dotnet#7073 (comment)

The story so far…  Why does `InstallAndroidDependenciesTest()` fail?
We still don't know.

However, we know that the unit test fails because the `Build` step
is using the wrong SDK directory, and it's using the wrong SDK
directory because the `InstallAndroidDependencies` target failed!

Worse, we don't know *why* it failed, because the log file for the
`InstallAndroidDependencies` target is *overwritten* by the
`Build` target on the next run!

Update `InstallAndroidDependenciesTest()` so that a different log
file is used for the `InstallAndroidDependencies` target.

Maybe then we can get some useful details?
jonpryor added a commit to jonpryor/xamarin-android that referenced this pull request Jun 11, 2022
Context: dotnet#7073 (comment)

I *think* `InstallAndroidDependenciesTest()` should pass now.
jonpryor added a commit to dotnet/android-tools that referenced this pull request Jun 13, 2022
…170)

Context: dotnet/android#7073
Context: https://github.com/xamarin/xamarin-android/blob/fdfc4c44ba65fcff9caf809bcf2d1f1a6837b1e3/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/AndroidDependenciesTests.cs#L19-L50

I was trying to figure out how xamarin-android's
`AndroidDependenciesTests.InstallAndroidDependenciesTest()` *passes*;
the test creates an empty "SDK" directory, then builds with the
`InstallAndroidDependencies` target, then builds the `Build` target,
then asserts that the used SDK directory matches the "temp" directory.

The cause of the confusion was twofold:

 1. Two targets were run, but they both wrote to the same log file,
    and thus any output from the `InstallAndroidDependencies` target
    was *lost*, which meant

 2. When reviewing the output of the `Build` target -- the *only*
    output for quite some time -- I started searching for "other
    possibilities" for why it would work, e.g. "it's not using the
    constructor parameter, but rather `monodroid-config.xml`",
    which needed to be separately investigated and discarded.

The investigation is done -- the problems were that the log file
needed to understand what was going wrong didn't exist, and that the
`platform-tools` 32.0.0 package didn't exist in the GoogleV2
manifest, and thus `platform-tools` wasn't installed, and thus `adb`
wasn't found, causing `ValidateAndroidSdkLocation()` to skip it --
but the additional contextual log information could be useful for
future investigations.

Expand the log messages provided by `AndroidSdkBase` & co. so that
we also log "where" the `loc` parameter is coming from, via a new
`locator` parameter (similar to the `locator` parameter in `JdkInfo`),
and update the "file check" logic so that we log the path of the
detected files.
@jonpryor
Copy link
Contributor Author

@jonpryor stated:

Set $(AndroidSdkPlatformToolsVersion) to 33.0.2 -- the current latest version in repository2-3.xml -- and it should work.

In fact, it did work; the InstallAndroidDependenciesTest() unit test is now passing. (Yay.)

Unfortunately, now ~everything dealing with the NDK on Windows is failing (?), via two separate "patterns".

Pattern 1: BuildApplicationWithMonoEnvironment() fails as readelf can't be found: https://devdiv.visualstudio.com/DevDiv/_build/results?buildId=6276249&view=ms.vss-test-web.build-test-results-tab&runId=43638036&resultId=100261&paneView=debug and https://devdiv.visualstudio.com/DevDiv/_build/results?buildId=6276249&view=ms.vss-test-web.build-test-results-tab&runId=43636890&resultId=100043&paneView=debug

System.ComponentModel.Win32Exception : An error occurred trying to start process
'C:\Android\android-sdk\ndk-bundle\toolchains\llvm\prebuilt\windows-x86_64\bin\readelf'
with working directory 'C:\a_work\1\s\xamarin-android\bin\TestRelease\net6.0'.
The system cannot find the file specified.
   at System.Diagnostics.Process.StartWithCreateProcess(ProcessStartInfo startInfo)
   at Xamarin.Android.Build.Tests.EnvironmentHelper.RunCommand(String executablePath, String arguments) in C:\a\_work\1\s\src\Xamarin.Android.Build.Tasks\Tests\Xamarin.Android.Build.Tests\Utilities\EnvironmentHelper.cs:line 550
   at Xamarin.Android.Build.Tests.EnvironmentHelper.AssertSharedLibraryHasRequiredSymbols(String dsoPath, String readElfPath) in C:\a\_work\1\s\src\Xamarin.Android.Build.Tasks\Tests\Xamarin.Android.Build.Tests\Utilities\EnvironmentHelper.cs:line 495
   at Xamarin.Android.Build.Tests.EnvironmentHelper.AssertValidEnvironmentSharedLibrary(String outputDirectoryRoot, String sdkDirectory, String ndkDirectory, String supportedAbis) in C:\a\_work\1\s\src\Xamarin.Android.Build.Tasks\Tests\Xamarin.Android.Build.Tests\Utilities\EnvironmentHelper.cs:line 489

-or-
System.ComponentModel.Win32Exception : The system cannot find the file specified
   at System.Diagnostics.Process.StartWithCreateProcess(ProcessStartInfo startInfo)
   at Xamarin.Android.Build.Tests.EnvironmentHelper.RunCommand(String executablePath, String arguments) in /Users/builder/azdo/_work/1/s/xamarin-android/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/Utilities/EnvironmentHelper.cs:line 551
   at Xamarin.Android.Build.Tests.EnvironmentHelper.AssertSharedLibraryHasRequiredSymbols(String dsoPath, String readElfPath) in /Users/builder/azdo/_work/1/s/xamarin-android/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/Utilities/EnvironmentHelper.cs:line 495
   at Xamarin.Android.Build.Tests.EnvironmentHelper.AssertValidEnvironmentSharedLibrary(String outputDirectoryRoot, String sdkDirectory, String ndkDirectory, String supportedAbis) in /Users/builder/azdo/_work/1/s/xamarin-android/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/Utilities/EnvironmentHelper.cs:line 489

Not sure why one has the path to readelf while the other doesn't, but the stack trace is nominally the same.

Pattern 2: BuildAotApplicationAndBundleAndÜmläüts() fails ascompiler toolchain can't be found when it's "symlinked" into a directory with spaces: https://devdiv.visualstudio.com/DevDiv/_build/results?buildId=6276249&view=ms.vss-test-web.build-test-results-tab&runId=43636830&resultId=100072&paneView=attachments

Task "MakeBundleNativeCodeExternal"
  Task Parameter:KeepTemp=False
  Task Parameter:
      Assemblies=
          …
  Task Parameter:BundleApiPath=C:\Program Files\Microsoft Visual Studio\2022\Enterprise\MSBuild\Xamarin\Android\\mkbundle-api.h
  Task Parameter:SupportedAbis=armeabi-v7a
  Task Parameter:TempOutputPath=obj\Release\
  Task Parameter:AndroidNdkDirectory=C:\a\_work\1\a\TestRelease\06-13_11.59.04\temp\SDK Ümläüts\ndk\
  Task Parameter:ToolPath=C:\Program Files\Microsoft Visual Studio\2022\Enterprise\MSBuild\Xamarin\Android\
  CC="C:\a\_work\1\a\TestRelease\06-13_11.59.04\temp\SDK Ümläüts\ndk\toolchains\llvm\prebuilt\windows-x86_64\bin\armv7a-linux-androideabi19-clang.CMD"
  AS="C:\Program Files\Microsoft Visual Studio\2022\Enterprise\MSBuild\Xamarin\Android\binutils\bin\arm-linux-androideabi-as.CMD"
  [mkbundle] C:\Program Files\Microsoft Visual Studio\2022\Enterprise\MSBuild\Xamarin\Android\mkbundle.exe --dos2unix=false --nomain --i18n none --bundled-header --mono-api-struct-path "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\MSBuild\Xamarin\Android\\mkbundle-api.h" --style linux -c -o obj\Release\bundles\armeabi-v7a\temp.c -oo obj\Release\bundles\armeabi-v7a\assemblies.o -z obj\Release\android\assets\shrunk\UnnamedProject.dll obj\Release\android\assets\shrunk\Java.Interop.dll obj\Release\android\assets\shrunk\Mono.Android.dll obj\Release\android\assets\shrunk\mscorlib.dll obj\Release\android\assets\shrunk\System.Core.dll obj\Release\android\assets\shrunk\System.dll
  [mkbundle stdout] Running: "C:\\Program Files\\Microsoft Visual Studio\\2022\\Enterprise\\MSBuild\\Xamarin\\Android\\binutils\\bin\\llvm-mc.exe" --arch=arm --triple=arm-linux-gnu --assemble --filetype=obj --mattr=+armv7-a -o=obj\Release\bundles\armeabi-v7a\assemblies.o temp.s
  [mkbundle stdout] Generated obj\Release\bundles\armeabi-v7a\temp.c
  [mkbundle stdout] 
  [mkbundle stderr] 
  [CC] "C:\a\_work\1\a\TestRelease\06-13_11.59.04\temp\SDK Ümläüts\ndk\toolchains\llvm\prebuilt\windows-x86_64\bin\armv7a-linux-androideabi19-clang.CMD" -c -D__ANDROID_API__=19 -DANDROID -o obj\Release\bundles\armeabi-v7a\temp.o -I "C:\a\_work\1\a\TestRelease\06-13_11.59.04\temp\SDK Ümläüts\ndk\toolchains\llvm\prebuilt\windows-x86_64\sysroot\usr\include\arm-linux-androideabi" -I "C:\a\_work\1\a\TestRelease\06-13_11.59.04\temp\SDK Ümläüts\ndk\toolchains\llvm\prebuilt\windows-x86_64\sysroot\usr\include" obj\Release\bundles\armeabi-v7a\temp.c
  [cc stderr] 'C:\a\_work\1\a\TestRelease\06-13_11.59.04\temp\SDK' is not recognized as an internal or external command,
  [cc stderr] operable program or batch file.
  [cc stderr] 
  [cc stdout] 
C:\Program Files\Microsoft Visual Studio\2022\Enterprise\MSBuild\Xamarin\Android\Xamarin.Android.Legacy.targets(731,5): error XA5103: NDK C compiler exited with an error. Exit code 0
Done executing task "MakeBundleNativeCodeExternal" -- FAILED. (TaskId:259)

I've seen this scenario with three different NDK versions specified in xamarin-android-tools, so I'm starting to suspect it's not related to $(AndroidNdkVersion).

I'm not sure what to look into, though.

jonpryor added a commit to jonpryor/xamarin-android that referenced this pull request Jun 13, 2022
Context: dotnet#7073 (comment)

Dump out the NDK dir structure, see if `readelf` exists.
jonpryor added a commit to jonpryor/xamarin-android that referenced this pull request Jun 13, 2022
Context: dotnet#7073 (comment)

The story so far…  Why does `InstallAndroidDependenciesTest()` fail?
We still don't know.

However, we know that the unit test fails because the `Build` step
is using the wrong SDK directory, and it's using the wrong SDK
directory because the `InstallAndroidDependencies` target failed!

Worse, we don't know *why* it failed, because the log file for the
`InstallAndroidDependencies` target is *overwritten* by the
`Build` target on the next run!

Update `InstallAndroidDependenciesTest()` so that a different log
file is used for the `InstallAndroidDependencies` target.

Maybe then we can get some useful details?
jonpryor added a commit to jonpryor/xamarin-android that referenced this pull request Jun 13, 2022
Context: dotnet#7073 (comment)

I *think* `InstallAndroidDependenciesTest()` should pass now.
jonpryor added a commit to jonpryor/xamarin-android that referenced this pull request Jun 13, 2022
Context: dotnet#7073 (comment)

Dump out the NDK dir structure, see if `readelf` exists.
jonpryor added a commit to jonpryor/xamarin-android that referenced this pull request Jun 14, 2022
Context: dotnet#7073 (comment)

The story so far…  Why does `InstallAndroidDependenciesTest()` fail?
We still don't know.

However, we know that the unit test fails because the `Build` step
is using the wrong SDK directory, and it's using the wrong SDK
directory because the `InstallAndroidDependencies` target failed!

Worse, we don't know *why* it failed, because the log file for the
`InstallAndroidDependencies` target is *overwritten* by the
`Build` target on the next run!

Update `InstallAndroidDependenciesTest()` so that a different log
file is used for the `InstallAndroidDependencies` target.

Maybe then we can get some useful details?
jonpryor added a commit to jonpryor/xamarin-android that referenced this pull request Jun 14, 2022
Context: dotnet#7073 (comment)

I *think* `InstallAndroidDependenciesTest()` should pass now.
jonpryor added a commit to jonpryor/xamarin-android that referenced this pull request Jun 14, 2022
Context: dotnet#7073 (comment)

Dump out the NDK dir structure, see if `readelf` exists.
jonpryor added a commit to dotnet/android-tools that referenced this pull request Jun 15, 2022
Context: dotnet/android#7073 (comment)

I *think* this will fix `InstallAndroidDependenciesTest()`.
Context: dotnet/android-tools#169

Context: https://dl-ssl.google.com/android/repository/repository2-3.xml
Context: 22bc14b

Turn XA1023 into an error.

Commit xamarin/xamarin-android-tools@TODO_HASH bumps
`$(AndroidSdkBuildToolsVersion)` to 32.0.0, which was the latest non-
preview `build-tools` package version on 2022-06-06.  The "problem"
is that [build-tools 31.0.0 *removed* `dx`][0], and thus Classic
Xamarin.Android has stuck with build-tools 30.0.0 as the default
version for years.

Commit 22bc14b introduced warning XA1023 (an *error* in .NET 5+),
as we saw no reason to support `dx` in .NET 5 when it was already
deprecated.

Warning XA1023 has been emitted in Classic Xamarin.Android since
Visual Studio 16.9 (released 2021-Mar); we feel there has been ample
time to migrate away from `dx` and to the replacement of `d8`.

Turn XA1023 into an *error* for Classic Xamarin.Android builds,
ensuring things are consistent between Classic Xamarin.Android and
.NET 6+.

Commit xamarin/xamarin-android-tools@TODO_HASH *also* bumps
`$(AndroidCommandLineToolsVersion)` to 7.0.  Update
`$(CommandLineToolsVersion)` in `Configuration.props` accordingly.

The `cmdline-tools` package v7.0 contains contains [`lint` 7.2][1],
which introduces a new `lint` check called `RedundantLabel`:

> Redundant label on activity in manifest

meaning that the `//actviity/@android:label` value is identical to
the `//application/@android:label` value, and thus isn't needed.

This causes a warning from `BuildTest.CheckLintErrorsAndWarnings()`:

	obj/Debug/android/AndroidManifest.xml(12,44): warning XA0102:
	Redundant label can be removed [RedundantLabel]

For now, update `BuildTest.CheckLintErrorsAndWarnings()` to ignore
`RedundantLabel` warnings.

TODO:

Remove support for `dx` and ProGuard.

[0]: https://android-developers.googleblog.com/2020/02/the-path-to-dx-deprecation.html
[1]: http://googlesamples.github.io/android-custom-lint-rules/usage/changes.md.html
jonpryor added 2 commits June 15, 2022 12:00
Need to make use of `mainDexClasses.rules` conditional, as it
does not exist in build-tools 33.0.0, resulting in:

    java.lang.RuntimeException: com.android.tools.r8.internal.f: Failed to read file: C:\Android\android-sdk\build-tools\33.0.0\mainDexClasses.rules
This reverts commit f86fedc.

Build-tools 33.0.0 causes unit test failures, e.g.

    Error: Cannot fit requested classes in a single dex file (# methods: 68000 > 65536)

This appears to be because build-tools 33.0.0 no longer contains
`mainDexClasses.rules`, so linking doesn't *do* as much.

Revert to build-tools 32.0.0.
Comment on lines 202 to 207
protected static void AssertDexToolSupported (string dexTool)
{
if (Builder.UseDotNet && dexTool == "dx") {
Assert.Ignore ("dx is not supported in .NET 5+");
if (dexTool == "dx") {
Assert.Ignore ("dx is not supported");
}
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could delete this method instead and test parameters for dx, but I can do that after this goes in.

@jonpryor jonpryor marked this pull request as ready for review June 15, 2022 21:20
@jonpryor jonpryor requested a review from dellis1972 as a code owner June 15, 2022 21:20
@jonpryor
Copy link
Contributor Author

jonpryor commented Jun 15, 2022

Bump to xamarin/xamarin-android-tools/main@9c641b3e

Context: https://github.com/xamarin/xamarin-android-tools/pull/169

Context: https://dl-ssl.google.com/android/repository/repository2-3.xml
Context: 22bc14b1a89352824d2a54f6e12a4dbeaa6fe679

Changes: https://github.com/xamarin/xamarin-android-tools/compare/ec346d07cf3ac7fc74d08eae4f19043b51485724...9c641b3e08e56db37467a64a2c5de2c7f7ddb3ef

  * xamarin/xamarin-android-tools@9c641b3 [Xamarin.Android.Tools.AndroidSdk] Update SDK component for API-32 (#169)

Commit xamarin/xamarin-android-tools@9c641b3 bumps
`$(AndroidSdkBuildToolsVersion)` to 32.0.0.  (We looked at bumping
to 33.0.0, but that broke various unit tests; we will investigate
supporting build-tools 33.0.0 later.)

The "problem" is that [build-tools 31.0.0 *removed* `dx`][0], and
thus Classic Xamarin.Android has stuck with build-tools 30.0.0 as the
default version for years.

Commit 22bc14b1 introduced warning XA1023 (an *error* in .NET 5+),
as we saw no reason to support `dx` in .NET 5 when it was already
deprecated.

Warning XA1023 has been emitted in Classic Xamarin.Android since
Visual Studio 16.9 (released 2021-Mar); we feel there has been ample
time to migrate away from `dx` and to the replacement of `d8`.

Turn XA1023 into an *error* for Classic Xamarin.Android builds,
ensuring things are consistent between Classic Xamarin.Android and
.NET 6+.

Commit xamarin/xamarin-android-tools@9c641b3 *also* bumps
`$(AndroidCommandLineToolsVersion)` to 7.0.  Update
`$(CommandLineToolsVersion)` in `Configuration.props` accordingly.

The `cmdline-tools` package v7.0 contains contains [`lint` 7.2][1],
which introduces a new `lint` check called `RedundantLabel`:

> Redundant label on activity in manifest

meaning that the `//actviity/@android:label` value is identical to
the `//application/@android:label` value, and thus isn't needed.

This causes a warning from `BuildTest.CheckLintErrorsAndWarnings()`:

	obj/Debug/android/AndroidManifest.xml(12,44): warning XA0102:
	Redundant label can be removed [RedundantLabel]

For now, update `BuildTest.CheckLintErrorsAndWarnings()` to ignore
`RedundantLabel` warnings.

TODO:

Remove support for `dx` and ProGuard.

[0]: https://android-developers.googleblog.com/2020/02/the-path-to-dx-deprecation.html
[1]: http://googlesamples.github.io/android-custom-lint-rules/usage/changes.md.html

@jonpryor jonpryor merged commit 0181212 into dotnet:main Jun 16, 2022
jonathanpeppers pushed a commit that referenced this pull request Jun 30, 2022
Context: https://dl-ssl.google.com/android/repository/repository2-3.xml
Context: 22bc14b

Changes: dotnet/android-tools@ec346d0...9c641b3

  * dotnet/android-tools@9c641b3 [Xamarin.Android.Tools.AndroidSdk] Update SDK component for API-32 (#169)

Commit dotnet/android-tools@9c641b3 bumps
`$(AndroidSdkBuildToolsVersion)` to 32.0.0.  (We looked at bumping
to 33.0.0, but that broke various unit tests; we will investigate
supporting build-tools 33.0.0 later.)

The "problem" is that [build-tools 31.0.0 *removed* `dx`][0], and
thus Classic Xamarin.Android has stuck with build-tools 30.0.0 as the
default version for years.

Commit 22bc14b introduced warning XA1023 (an *error* in .NET 5+),
as we saw no reason to support `dx` in .NET 5 when it was already
deprecated.

Warning XA1023 has been emitted in Classic Xamarin.Android since
Visual Studio 16.9 (released 2021-Mar); we feel there has been ample
time to migrate away from `dx` and to the replacement of `d8`.

Turn XA1023 into an *error* for Classic Xamarin.Android builds,
ensuring things are consistent between Classic Xamarin.Android and
.NET 6+.

Commit dotnet/android-tools@9c641b3 *also* bumps
`$(AndroidCommandLineToolsVersion)` to 7.0.  Update
`$(CommandLineToolsVersion)` in `Configuration.props` accordingly.

The `cmdline-tools` package v7.0 contains contains [`lint` 7.2][1],
which introduces a new `lint` check called `RedundantLabel`:

> Redundant label on activity in manifest

meaning that the `//actviity/@android:label` value is identical to
the `//application/@android:label` value, and thus isn't needed.

This causes a warning from `BuildTest.CheckLintErrorsAndWarnings()`:

	obj/Debug/android/AndroidManifest.xml(12,44): warning XA0102:
	Redundant label can be removed [RedundantLabel]

For now, update `BuildTest.CheckLintErrorsAndWarnings()` to ignore
`RedundantLabel` warnings.

TODO:

Remove support for `dx` and ProGuard.

[0]: https://android-developers.googleblog.com/2020/02/the-path-to-dx-deprecation.html
[1]: http://googlesamples.github.io/android-custom-lint-rules/usage/changes.md.html
@github-actions github-actions bot locked and limited conversation to collaborators Jan 24, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants