Embeddinator-4000
Embeddinator-4000 copied to clipboard
Constructor with parameters result into errors during Android Embeddination.
Steps to Reproduce
- Pass a parameter in a class constructor with export attribute, class inherits from Java.Lang.Object with register attribute.
Expected Behavior
Embeddination shouldn't fail.
Actual Behavior
Embeddination fails.
Environment
MacOs, Latest Visual Studio.
using System;
using Java.Interop;
using Android.Runtime;
namespace Testembedination
{
[Register("testembedination.TEmbeded")]
public class TEmbeded : Java.Lang.Object
{
[Export("tEmbeded")]
public TEmbeded(int k)
{
}
}
}
Build Logs
TEmbeded.java:20: error: constructor Object in class Object cannot be applied to given types;
super (p0);
^
required: no arguments
found: int
reason: actual and formal argument lists differ in length
Note: ../../../../Native/Android/EmbedinatedFramework/src/testembedination/TEmbeded.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
1 error Failed to compile generated code.
Example Project (If Possible)
Hi everyone!
I had the same issue (was incorrect register attribute), after I fixed it, the library was successfully compiled, sample:
https://github.com/wcoder/xamarin-embedding-starter-kit/blob/master/dotnet/DotNet.AndroidLibrary/XActivity.cs