diff --git a/build-tools/scripts/BuildEverything.mk b/build-tools/scripts/BuildEverything.mk index 357ad09412e..288874387c2 100644 --- a/build-tools/scripts/BuildEverything.mk +++ b/build-tools/scripts/BuildEverything.mk @@ -114,8 +114,8 @@ framework-assemblies: rm -f bin/$(conf)/lib/xamarin.android/xbuild-frameworks/MonoAndroid/v1.0/Xamarin.Android.NUnitLite.dll; \ $(call MSBUILD_BINLOG,NUnitLite,$(_SLN_BUILD),$(conf)) $(MSBUILD_FLAGS) src/Xamarin.Android.NUnitLite/Xamarin.Android.NUnitLite.csproj \ /p:Configuration=$(conf) $(_MSBUILD_ARGS) \ - /p:AndroidApiLevel=$(lastword $(API_LEVELS)) /p:AndroidPlatformId=$(word $(lastword $(API_LEVELS)), $(ALL_PLATFORM_IDS)) \ - /p:AndroidFrameworkVersion=$(lastword $(FRAMEWORKS)) || exit 1; ) + /p:AndroidApiLevel=$(firstword $(API_LEVELS)) /p:AndroidPlatformId=$(word $(firstword $(API_LEVELS)), $(ALL_PLATFORM_IDS)) \ + /p:AndroidFrameworkVersion=$(firstword $(FRAMEWORKS)) || exit 1; ) _latest_stable_framework=$$($(MSBUILD) /p:DoNotLoadOSProperties=True /nologo /v:minimal /t:GetAndroidLatestStableFrameworkVersion build-tools/scripts/Info.targets | tr -d '[[:space:]]') ; \ $(foreach conf, $(CONFIGURATIONS), \ rm -f "bin/$(conf)/lib/xamarin.android/xbuild-frameworks/MonoAndroid/$$_latest_stable_framework"/Mono.Android.Export.* ; \ diff --git a/src/Xamarin.Android.NUnitLite/Gui/Instrumentations/TestSuiteInstrumentation.cs b/src/Xamarin.Android.NUnitLite/Gui/Instrumentations/TestSuiteInstrumentation.cs index 53e18dcd946..9c1d4c1eb53 100644 --- a/src/Xamarin.Android.NUnitLite/Gui/Instrumentations/TestSuiteInstrumentation.cs +++ b/src/Xamarin.Android.NUnitLite/Gui/Instrumentations/TestSuiteInstrumentation.cs @@ -103,11 +103,7 @@ public override void OnStart () string GetResultsPath () { - Java.IO.File resultsPathFile = null; -#if __ANDROID_19__ - if (((int)Build.VERSION.SdkInt) >= 19) - resultsPathFile = Context.GetExternalFilesDir (global::Android.OS.Environment.DirectoryDocuments); -#endif + Java.IO.File resultsPathFile = GetExternalFilesDir (); var usePathFile = resultsPathFile != null && resultsPathFile.Exists (); var resultsPath = usePathFile ? resultsPathFile.AbsolutePath @@ -117,6 +113,19 @@ string GetResultsPath () return Path.Combine (resultsPath, "TestResults.xml"); } + Java.IO.File GetExternalFilesDir () + { + if (((int)Build.VERSION.SdkInt) < 19) + return null; + string type = null; +#if __ANDROID_19__ + type = global::Android.OS.Environment.DirectoryDocuments; +#else // !__ANDROID_19__ + type = global::Android.OS.Environment.DirectoryDownloads; +#endif // !__ANDROID_19__ + return Context.GetExternalFilesDir (type); + } + // On some Android targets, the external storage directory is "emulated", // in which case the paths used on-device by the application are *not* // paths that can be used off-device with `adb pull`.