Skip to content

Commit

Permalink
[Xamarin.Android.Build.Tasks] Drop MonoPackageManager.api4.java (dotn…
Browse files Browse the repository at this point in the history
…et#2691)

Xamarin.Android and Mono are no longer capable of running on API
levels lower than 9 (if built with NDK r14) or 16 (if built with
NDK r18+).  This commit drops the version of `MonoPackageManager`
targeting API levels < 9.

If an application with its minimum target sdk set to anything < 9 is
built it results in a compilation error when building Java code:

	error :  error: method init in class Runtime cannot be applied to given types; [C:\xms\NPlus1DaysOfMvvmCross\N-04-ValueConverters\Value.Droid\Value.Droid.csproj]
	error :	Runtime.init ( [C:\xms\NPlus1DaysOfMvvmCross\N-04-ValueConverters\Value.Droid\Value.Droid.csproj]
	error :   required: String,String[],String,String[],ClassLoader,String[],String[],String,int,String[] [C:\xms\NPlus1DaysOfMvvmCross\N-04-ValueConverters\Value.Droid\Value.Droid.csproj]
	error :   found: String,String[],String,String[],ClassLoader,String[],String[],String [C:\xms\NPlus1DaysOfMvvmCross\N-04-ValueConverters\Value.Droid\Value.Droid.csproj]
	error :   reason: actual and formal argument lists differ in length [C:\xms\NPlus1DaysOfMvvmCross\N-04-ValueConverters\Value.Droid\Value.Droid.csproj]

This is caused by the changes introduced in the runtime performance
commit b90d3ab which changed the `Runtime.init()` signature but
*only* in the version of `MonoPackageManager` targeting the currently
supported minimum SDK levels.
  • Loading branch information
grendello authored and jonpryor committed Feb 4, 2019
1 parent 32cbc8d commit 590e53c
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 98 deletions.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,7 @@ public override bool Execute ()
using (var stream = new MemoryStream ())
using (var pkgmgr = new StreamWriter (stream)) {
// Write the boilerplate from the MonoPackageManager.java resource
var packageManagerResource = minApiVersion < 9 ? "MonoPackageManager.api4.java" : "MonoPackageManager.java";
using (var template = new StreamReader (Assembly.GetExecutingAssembly ().GetManifestResourceStream (packageManagerResource))) {
using (var template = new StreamReader (Assembly.GetExecutingAssembly ().GetManifestResourceStream ("MonoPackageManager.java"))) {
string line;
while ((line = template.ReadLine ()) != null) {
pkgmgr.WriteLine (line);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -671,9 +671,6 @@
<EmbeddedResource Include="Resources\proguard_xamarin.cfg">
<LogicalName>proguard_xamarin.cfg</LogicalName>
</EmbeddedResource>
<EmbeddedResource Include="Resources\MonoPackageManager.api4.java">
<LogicalName>MonoPackageManager.api4.java</LogicalName>
</EmbeddedResource>
<EmbeddedResource Include="Resources\NotifyTimeZoneChanges.java">
<LogicalName>NotifyTimeZoneChanges.java</LogicalName>
</EmbeddedResource>
Expand Down

0 comments on commit 590e53c

Please sign in to comment.