Embeddinator-4000 icon indicating copy to clipboard operation
Embeddinator-4000 copied to clipboard

Updating Xamarin.Android version results into Embeddination errors

Open emysa341 opened this issue 6 years ago • 2 comments

Steps to Reproduce

  1. Use latest version or any version greater than v8.0.0.37 of Xamarin.Android and perform Embeddination on a simple class.
  2. Also, you might need to correct the folder structure of Xamarin.Android, according to Embeddination needs. I wanted to upload mine but its quite bigger than 10MB's. Get it from here and correct the folder structure.

Latest-folder-structure:

  • Xamarin.Android -- include -- lib --- xamarin.android ---- xbuild ---- xbuild-frameworks

Folder-structure-Embeddination-needs:

  • Xamarin.Android -- include -- lib ---- xbuild ---- xbuild-frameworks

Expected Behavior

Embedination shouldn't fail.

Actual Behavior

Embedination fails.

Environment

MacOS, VS for Mac.

using System;

namespace Testembedination
{
    public class TEmbeded : Java.Lang.Object
    {
        public string test { get; set; }

    }
}


Build Logs

error MSB4018: The "GenerateJavaStubs" task failed unexpectedly.
/Users/xamarindev/sts-vasapp/Native/Android/EmbedinatedFramework/GenerateJavaStubs.proj(17,5): error MSB4018: System.NullReferenceException: Object reference not set to an instance of an object
/Users/xamarindev/sts-vasapp/Native/Android/EmbedinatedFramework/GenerateJavaStubs.proj(17,5): error MSB4018:   at Xamarin.Android.Tasks.ManifestDocument.Merge (System.Collections.Generic.List`1[T] subclasses, System.Collections.Generic.List`1[T] selectedWhitelistAssemblies, System.String applicationClass, System.Boolean embed, System.String bundledWearApplicationName, System.Collections.Generic.IEnumerable`1[T] mergedManifestDocuments) [0x00320] in <420d87f47a0d49a8b9818d1b84d19295>:0 
/Users/xamarindev/sts-vasapp/Native/Android/EmbedinatedFramework/GenerateJavaStubs.proj(17,5): error MSB4018:   at Xamarin.Android.Tasks.GenerateJavaStubs.Run (Java.Interop.Tools.Cecil.DirectoryAssemblyResolver res) [0x0047d] in <420d87f47a0d49a8b9818d1b84d19295>:0 
/Users/xamarindev/sts-vasapp/Native/Android/EmbedinatedFramework/GenerateJavaStubs.proj(17,5): error MSB4018:   at Xamarin.Android.Tasks.GenerateJavaStubs.Execute () [0x00223] in <420d87f47a0d49a8b9818d1b84d19295>:0 
/Users/xamarindev/sts-vasapp/Native/Android/EmbedinatedFramework/GenerateJavaStubs.proj(17,5): error MSB4018:   at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute () [0x00023] in <99064ce461714f6a83a1f24370e1d7b8>:0 
/Users/xamarindev/sts-vasapp/Native/Android/EmbedinatedFramework/GenerateJavaStubs.proj(17,5): error MSB4018:   at Microsoft.Build.BackEnd.TaskBuilder+<ExecuteInstantiatedTask>d__26.MoveNext () [0x00212] in <99064ce461714f6a83a1f24370e1d7b8>:0 

Example Project (If Possible)

TestEmbedination.zip TestComand.bat.zip

Updating to latest version of Xamarin.Android can fix many problems like I posted issue here. If someone here can support me to update the Xamarin.Android version to latest, I can contribute in updating the cake script to support the newer versions of Xamarin.Android. Currently the script needs few refractions for downloading and unzipping the new version of Xamarin.Android correctly. If you try to update the Xamarin.Android version using cake script, the build will fail since the folder structure is changed.

emysa341 avatar Apr 24 '18 14:04 emysa341

@emysa341 this is something we've been needing to do for a while now, I've been having to focus on Xamarin.Android itself lately.

The problem with updating the version of Xamarin.Android, is there is usually changes in the MSBuild tasks Embeddinator is using. The only good way to fix that is to add specific Xamarin.Android.Embeddinator.targets (or similar) to Xamarin.Android itself and rely on those. Not something I've gotten around to yet.

You are originally trying to fix #655 , we need to track down the change in Xamarin.Android that fixed it. Do you know the version number or PR number that fixed it in Xamarin.Android? Java.Interop?

I might be able to make a small bump for Xamarin.Android in Embeddinator to fix this.

jonathanpeppers avatar Apr 24 '18 14:04 jonathanpeppers

@jonathanpeppers I am not sure in which VN they fixed it. I assumed it from your comment on a previous issue (which I am also facing, at the moment using a workaround by using JavaList) that updating Xamarin.Android can resolve many issued related to Embeddination. I will explore at Xamarin.Android github's, I will report if I manage to find it.

emysa341 avatar Apr 24 '18 14:04 emysa341