Repository navigation
[build] Build Xamarin.Android.NUnitLite.dll for API-10 - #2190
Merged
Merged
Conversation
Context: 24158d0 Fixes: dotnet#2189 What do we want? A reliable way to get `TestResults.xml` files off of the Android target device, so that we can get unit test results. A reliable way that works on a variety of Android API levels and their corresponding emulators. (What do we want? ***GREEN BUILDS***.) The problem with 24158d0 is twofold: 1. When building an app with a `$(TargetFrameworkVersion)` less than `v9.0` (`$(lastword $(API_LEVELS))`), there is a build warning: warning XA0105: The $(TargetFrameworkVersion) for 'Foo' (v9.0) is greater than the $(TargetFrameworkVersion) for your project (v5.0). You need to increase the $(TargetFrameworkVersion) for your project. 2. When *running*/using `Xamarin.Android.NUnitLite.dll` on an API-10 device/pre-API-21 device, there is a *runtime* error. (1) is ignorable, -ish. (2) is not: FATAL EXCEPTION: main Process: Xamarin.Android.Locale_Tests, PID: 12615 android.runtime.JavaProxyThrowable: System.TypeLoadException: Could not resolve type with token 010000d4 from typeref (expected class 'Android.OS.BaseBundle' in assembly 'Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=84e04ff9cfb79065') at Xamarin.Android.NUnitLite.AndroidRunner.GetSetupTestTarget (Android.Content.Intent intent) [0x00000] in /Users/builder/data/lanes/6102/d2851781/source/monodroid/external/xamarin-android/src/Xamarin.Android.NUnitLite/Gui/AndroidRunner.cs:345 at Xamarin.Android.NUnitLite.TestSuiteActivity.SetupTestTarget () [0x00008] in /Users/builder/data/lanes/6102/d2851781/source/monodroid/external/xamarin-android/src/Xamarin.Android.NUnitLite/Gui/Activities/TestSuiteActivity.cs:246 at Xamarin.Android.NUnitLite.TestSuiteActivity.UpdateData (Android.Runtime.JavaList`1[T] data, Android.Widget.ListView lv) [0x00006] in /Users/builder/data/lanes/6102/d2851781/source/monodroid/external/xamarin-android/src/Xamarin.Android.NUnitLite/Gui/Activities/TestSuiteActivity.cs:137 at Xamarin.Android.NUnitLite.TestSuiteActivity.OnCreate (Android.OS.Bundle bundle) [0x0003b] in /Users/builder/data/lanes/6102/d2851781/source/monodroid/external/xamarin-android/src/Xamarin.Android.NUnitLite/Gui/Activities/TestSuiteActivity.cs:49 at Xamarin.Android.LocaleTests.MainActivity.OnCreate (Android.OS.Bundle bundle) [0x0000d] in C:\Users\peter\source\monodroid\external\xamarin-android\tests\locales\Xamarin.Android.Locale-Tests\MainActivity.cs:19 Consequently, while 24158d0 gave *us* a green Jenkins job, the resulting assembly is not usable when run on Android devices < API-21. The fix? Partially revert 24158d0 so that `Xamarin.Android.NUnitLite.dll` is once again built against `$(firstword $(API_LEVELS))`, i.e. API-10, and instead update `Xamarin.Android.NUnitLite.dll` so that instead of using `Environment.DirectoryDocuments` -- which only exists in API-19+ -- we use `Environment.DirectoryDownloads` on pre-API-19 devices. Let's see if this works!
jonpryor
force-pushed
the
jonp-fix-2189
branch
from
September 18, 2018 01:14
4ea71a2 to
7438117
Compare
grendello
approved these changes
Sep 18, 2018
Contributor
Author
|
The build failure in the macOS PR Build is: This is because mono crashed: This crash is unrelated to changes in What's somewhat odd is that the build log mentions two errors, but I would expect the above crash to only count as one... |
jonpryor
added a commit
that referenced
this pull request
Oct 2, 2018
Fixes: #2189 Context: 8e4ed45 What do we want? A reliable way to get `TestResults.xml` files off of the Android target device, so that we can get unit test results. A reliable way that works on a variety of Android API levels and their corresponding emulators. (What do we want? ***GREEN BUILDS***.) The problem with 8e4ed45 is twofold: 1. When building an app with a `$(TargetFrameworkVersion)` less than `v9.0` (`$(lastword $(API_LEVELS))`), there is a build warning: warning XA0105: The $(TargetFrameworkVersion) for 'Foo' (v9.0) is greater than the $(TargetFrameworkVersion) for your project (v5.0). You need to increase the $(TargetFrameworkVersion) for your project. 2. When *running*/using `Xamarin.Android.NUnitLite.dll` on an API-10 device/pre-API-21 device, there is a *runtime* error. (1) is ignorable, -ish. (2) is not: FATAL EXCEPTION: main Process: Xamarin.Android.Locale_Tests, PID: 12615 android.runtime.JavaProxyThrowable: System.TypeLoadException: Could not resolve type with token 010000d4 from typeref (expected class 'Android.OS.BaseBundle' in assembly 'Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=84e04ff9cfb79065') at Xamarin.Android.NUnitLite.AndroidRunner.GetSetupTestTarget (Android.Content.Intent intent) [0x00000] in /Users/builder/data/lanes/6102/d2851781/source/monodroid/external/xamarin-android/src/Xamarin.Android.NUnitLite/Gui/AndroidRunner.cs:345 at Xamarin.Android.NUnitLite.TestSuiteActivity.SetupTestTarget () [0x00008] in /Users/builder/data/lanes/6102/d2851781/source/monodroid/external/xamarin-android/src/Xamarin.Android.NUnitLite/Gui/Activities/TestSuiteActivity.cs:246 at Xamarin.Android.NUnitLite.TestSuiteActivity.UpdateData (Android.Runtime.JavaList`1[T] data, Android.Widget.ListView lv) [0x00006] in /Users/builder/data/lanes/6102/d2851781/source/monodroid/external/xamarin-android/src/Xamarin.Android.NUnitLite/Gui/Activities/TestSuiteActivity.cs:137 at Xamarin.Android.NUnitLite.TestSuiteActivity.OnCreate (Android.OS.Bundle bundle) [0x0003b] in /Users/builder/data/lanes/6102/d2851781/source/monodroid/external/xamarin-android/src/Xamarin.Android.NUnitLite/Gui/Activities/TestSuiteActivity.cs:49 at Xamarin.Android.LocaleTests.MainActivity.OnCreate (Android.OS.Bundle bundle) [0x0000d] in C:\Users\peter\source\monodroid\external\xamarin-android\tests\locales\Xamarin.Android.Locale-Tests\MainActivity.cs:19 Consequently, while 8e4ed45 gave *us* a green Jenkins job, the resulting assembly is not usable when run on Android devices < API-21. The fix? Partially revert 8e4ed45 so that `Xamarin.Android.NUnitLite.dll` is once again built against `$(firstword $(API_LEVELS))`, i.e. API-10, and instead update `Xamarin.Android.NUnitLite.dll` so that instead of using `Environment.DirectoryDocuments` -- which only exists in API-19+ -- we use `Environment.DirectoryDownloads` on pre-API-19 devices.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Context: 24158d0
Fixes: #2189
What do we want? A reliable way to get
TestResults.xmlfiles off ofthe Android target device, so that we can get unit test results.
A reliable way that works on a variety of Android API levels and their
corresponding emulators.
(What do we want? GREEN BUILDS.)
The problem with 24158d0 is twofold:
When building an app with a
$(TargetFrameworkVersion)less thanv9.0($(lastword $(API_LEVELS))), there is a build warning:When running/using
Xamarin.Android.NUnitLite.dllon an API-10device/pre-API-21 device, there is a runtime error.
(1) is ignorable, -ish.
(2) is not:
Consequently, while 24158d0 gave us a green Jenkins job, the
resulting assembly is not usable when run on Android devices < API-21.
The fix? Partially revert 24158d0 so that
Xamarin.Android.NUnitLite.dllis once again built against$(firstword $(API_LEVELS)), i.e. API-10, and instead updateXamarin.Android.NUnitLite.dllso that instead of usingEnvironment.DirectoryDocuments-- which only exists in API-19+ -- weuse
Environment.DirectoryDownloadson pre-API-19 devices.Let's see if this works!