Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Binding project fails to build with latest Xamarin.Android version 10.2 #4661

Closed
adydecki opened this issue May 7, 2020 · 11 comments
Closed
Assignees
Labels
Area: Bindings Issues in Java Library Binding projects. need-info Issues that need more information from the author.

Comments

@adydecki
Copy link

adydecki commented May 7, 2020

Steps to Reproduce

  1. I have a .jar file which builds okay with Xamarin.Android 10.0.x version
  2. The same .jar file fails to build on latest Xamarin.Android 10.2.0.100 version.

Expected Behavior

The same .jar file builds okay regardless of the Xamarin.Android version.

Actual Behavior

On Xamarin.Android 10.2 some classes from .jar file does not show up in api.xml file during 'exporting JAR to XML' build step and thus missing classes cause compilation errors. The same .jar file works fine with Xamarin.Android 10.0 version. There are no logs related to that missing classes, they just don't show up in api.xml file.

Version Information

Microsoft Visual Studio Community 2019
Version 16.5.4
VisualStudio.16.Release/16.5.4+30011.22
Microsoft .NET Framework
Version 4.8.03752

Installed Version: Community

Visual C++ 2019 00435-60000-00000-AA532 Microsoft Visual C++ 2019

ASP.NET and Web Tools 2019 16.5.236.49856
ASP.NET and Web Tools 2019

Azure App Service Tools v3.0.0 16.5.236.49856
Azure App Service Tools v3.0.0

C# Tools 3.5.0-beta4-20153-05+20b9af913f1b8ce0a62f72bea9e75e4aa3cf6b0e
C# components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used.

Common Azure Tools 1.10
Provides common services for use by Azure Mobile Services and Microsoft Azure Tools.

Extensibility Message Bus 1.2.0 (d16-2@8b56e20)
Provides common messaging-based MEF services for loosely coupled Visual Studio extension components communication and integration.

IntelliCode Extension 1.0
IntelliCode Visual Studio Extension Detailed Info

Microsoft JVM Debugger 1.0
Provides support for connecting the Visual Studio debugger to JDWP compatible Java Virtual Machines

Microsoft MI-Based Debugger 1.0
Provides support for connecting Visual Studio to MI compatible debuggers

Microsoft Visual C++ Wizards 1.0
Microsoft Visual C++ Wizards

Microsoft Visual Studio VC Package 1.0
Microsoft Visual Studio VC Package

Mono Debugging for Visual Studio 16.5.514 (c4f36a9)
Support for debugging Mono processes with Visual Studio.

NuGet Package Manager 5.5.0
NuGet Package Manager in Visual Studio. For more information about NuGet, visit https://docs.nuget.org/

ProjectServicesPackage Extension 1.0
ProjectServicesPackage Visual Studio Extension Detailed Info

Sandcastle Help File Builder SHFB
Visual Studio integration for the Sandcastle Help File Builder.
https://github.com/EWSoftware/SHFB

Test Adapter for Boost.Test 1.0
Enables Visual Studio's testing tools with unit tests written for Boost.Test. The use terms and Third Party Notices are available in the extension installation directory.

Test Adapter for Google Test 1.0
Enables Visual Studio's testing tools with unit tests written for Google Test. The use terms and Third Party Notices are available in the extension installation directory.

Visual Basic Tools 3.5.0-beta4-20153-05+20b9af913f1b8ce0a62f72bea9e75e4aa3cf6b0e
Visual Basic components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used.

Visual F# Tools 10.8.0.0 for F# 4.7 16.5.0-beta.20181.6+85af456066acd4e76d2bc7821b44a325e46f2fca
Microsoft Visual F# Tools 10.8.0.0 for F# 4.7

Visual Studio Code Debug Adapter Host Package 1.0
Interop layer for hosting Visual Studio Code debug adapters in Visual Studio

Visual Studio Tools for CMake 1.0
Visual Studio Tools for CMake

VisualStudio.DeviceLog 1.0
Information about my package

VisualStudio.Foo 1.0
Information about my package

VisualStudio.Mac 1.0
Mac Extension for Visual Studio

Xamarin 16.5.000.533 (d16-5@9152e1b)
Visual Studio extension to enable development for Xamarin.iOS and Xamarin.Android.

Xamarin Designer 16.5.0.470 (remotes/origin/d16-5@681de3fd6)
Visual Studio extension to enable Xamarin Designer tools in Visual Studio.

Xamarin Templates 16.5.49 (0904f41)
Templates for building iOS, Android, and Windows apps with Xamarin and Xamarin.Forms.

Xamarin.Android SDK 10.2.0.100 (d16-5/988c811)
Xamarin.Android Reference Assemblies and MSBuild support.
Mono: c0c5c78
Java.Interop: xamarin/java.interop/d16-5@fc18c54
ProGuard: xamarin/proguard@905836d
SQLite: xamarin/sqlite@46204c4
Xamarin.Android Tools: xamarin/xamarin-android-tools/d16-5@9f4ed4b

Xamarin.iOS and Xamarin.Mac SDK 13.16.0.13 (b75deaf)
Xamarin.iOS and Xamarin.Mac Reference Assemblies and MSBuild support.

Log File

@adydecki adydecki added the Area: Bindings Issues in Java Library Binding projects. label May 7, 2020
@jpobst
Copy link
Contributor

jpobst commented May 7, 2020

Are you using jar2xml or class-parse? (Look in your project properties.)

If you're using jar2xml I can't imagine anything should have changed. It's been deprecated for several years and the code hasn't been modified since 2016.

If you're using class-parse the only thing I can think of that might have changed was if the Java types/methods were private and we stopped emitting them, or if this is a Kotlin library and we stopped emitting private Kotlin types/methods.

If you can post the snippet of XML from your 10.0 version that is missing in the 10.2 version maybe we can see if anything looks weird about it.

@jpobst jpobst added the need-info Issues that need more information from the author. label May 7, 2020
@grendello grendello added this to the Under Consideration milestone May 11, 2020
@adydecki
Copy link
Author

adydecki commented May 11, 2020

We're using class-parse. Attached are two snippets of api.xml that are completely missing in latest 10.2.0.100. There are more missing types, I'm pasting missing snippets related to Camera class that is causing compilation issues.

Missing in 10.2.0.100 version:
1)

<class abstract="false" deprecated="not deprecated" extends="java.lang.Object" extends-generic-aware="java.lang.Object" jni-extends="Ljava/lang/Object;" final="true" name="Camera" static="false" visibility="public" jni-signature="Lcom/scandit/datacapture/core/source/Camera;">
      <implements name="com.scandit.datacapture.core.source.AndroidCameraProxy" name-generic-aware="com.scandit.datacapture.core.source.AndroidCameraProxy" jni-type="Lcom/scandit/datacapture/core/source/AndroidCameraProxy;">
      </implements>
      <implements name="com.scandit.datacapture.core.source.FrameSource" name-generic-aware="com.scandit.datacapture.core.source.FrameSource" jni-type="Lcom/scandit/datacapture/core/source/FrameSource;">
      </implements>
      <constructor deprecated="not deprecated" final="false" name="Camera" jni-signature="(Lcom/scandit/datacapture/core/internal/sdk/source/NativeAndroidCamera;)V" bridge="false" static="false" type="com.scandit.datacapture.core.source.Camera" synthetic="false" visibility="public">
        <parameter name="impl" type="com.scandit.datacapture.core.internal.sdk.source.NativeAndroidCamera" jni-type="Lcom/scandit/datacapture/core/internal/sdk/source/NativeAndroidCamera;">
        </parameter>
      </constructor>
      <method abstract="false" deprecated="not deprecated" final="true" name="_applySettings" jni-signature="(Lcom/scandit/datacapture/core/source/CameraSettings;)Lcom/scandit/datacapture/core/internal/sdk/common/async/NativeWrappedFuture;" bridge="false" native="false" return="com.scandit.datacapture.core.internal.sdk.common.async.NativeWrappedFuture" jni-return="Lcom/scandit/datacapture/core/internal/sdk/common/async/NativeWrappedFuture;" static="false" synchronized="false" synthetic="false" visibility="public">
        <parameter name="settings" type="com.scandit.datacapture.core.source.CameraSettings" jni-type="Lcom/scandit/datacapture/core/source/CameraSettings;">
        </parameter>
      </method>
      <method abstract="false" deprecated="not deprecated" final="true" name="_applyTorchState" jni-signature="(Lcom/scandit/datacapture/core/source/TorchState;)V" bridge="false" native="false" return="void" jni-return="V" static="false" synchronized="false" synthetic="false" visibility="public">
        <parameter name="torchState" type="com.scandit.datacapture.core.source.TorchState" jni-type="Lcom/scandit/datacapture/core/source/TorchState;">
        </parameter>
      </method>
      <method abstract="false" deprecated="not deprecated" final="true" name="_frameSource" jni-signature="()Lcom/scandit/datacapture/core/source/FrameSource;" bridge="false" native="false" return="com.scandit.datacapture.core.source.FrameSource" jni-return="Lcom/scandit/datacapture/core/source/FrameSource;" static="false" synchronized="false" synthetic="false" visibility="public">
      </method>
      <method abstract="false" deprecated="not deprecated" final="true" name="_frameSourceImpl" jni-signature="()Lcom/scandit/datacapture/core/internal/module/source/NativeFrameSource;" bridge="false" native="false" return="com.scandit.datacapture.core.internal.module.source.NativeFrameSource" jni-return="Lcom/scandit/datacapture/core/internal/module/source/NativeFrameSource;" static="false" synchronized="false" synthetic="false" visibility="public">
      </method>
      <method abstract="false" deprecated="not deprecated" final="true" name="_impl" jni-signature="()Lcom/scandit/datacapture/core/internal/sdk/source/NativeAndroidCamera;" bridge="false" native="false" return="com.scandit.datacapture.core.internal.sdk.source.NativeAndroidCamera" jni-return="Lcom/scandit/datacapture/core/internal/sdk/source/NativeAndroidCamera;" static="false" synchronized="false" synthetic="false" visibility="public">
      </method>
      <method abstract="false" deprecated="not deprecated" final="true" name="_setFrameSource" jni-signature="(Lcom/scandit/datacapture/core/source/FrameSource;)V" bridge="false" native="false" return="void" jni-return="V" static="false" synchronized="false" synthetic="false" visibility="public">
        <parameter name="frameSource" type="com.scandit.datacapture.core.source.FrameSource" jni-type="Lcom/scandit/datacapture/core/source/FrameSource;">
        </parameter>
      </method>
      <method abstract="false" deprecated="not deprecated" final="true" name="_switchToDesiredState" jni-signature="(Lcom/scandit/datacapture/core/source/FrameSourceState;)Lcom/scandit/datacapture/core/internal/sdk/common/async/NativeWrappedFuture;" bridge="false" native="false" return="com.scandit.datacapture.core.internal.sdk.common.async.NativeWrappedFuture" jni-return="Lcom/scandit/datacapture/core/internal/sdk/common/async/NativeWrappedFuture;" static="false" synchronized="false" synthetic="false" visibility="public">
        <parameter name="desiredState" type="com.scandit.datacapture.core.source.FrameSourceState" jni-type="Lcom/scandit/datacapture/core/source/FrameSourceState;">
        </parameter>
      </method>
      <method abstract="false" deprecated="not deprecated" final="true" name="addListener" jni-signature="(Lcom/scandit/datacapture/core/source/FrameSourceListener;)V" bridge="false" native="false" return="void" jni-return="V" static="false" synchronized="false" synthetic="false" visibility="public">
        <parameter name="listener" type="com.scandit.datacapture.core.source.FrameSourceListener" jni-type="Lcom/scandit/datacapture/core/source/FrameSourceListener;">
        </parameter>
      </method>
      <method abstract="false" deprecated="not deprecated" final="true" name="addTorchListener" jni-signature="(Lcom/scandit/datacapture/core/source/TorchListener;)V" bridge="false" native="false" return="void" jni-return="V" static="false" synchronized="false" synthetic="false" visibility="public">
        <parameter name="listener" type="com.scandit.datacapture.core.source.TorchListener" jni-type="Lcom/scandit/datacapture/core/source/TorchListener;">
        </parameter>
      </method>
      <method abstract="false" deprecated="not deprecated" final="true" name="applySettings" jni-signature="(Lcom/scandit/datacapture/core/source/CameraSettings;)V" bridge="false" native="false" return="void" jni-return="V" static="false" synchronized="false" synthetic="false" visibility="public">
        <parameter name="settings" type="com.scandit.datacapture.core.source.CameraSettings" jni-type="Lcom/scandit/datacapture/core/source/CameraSettings;">
        </parameter>
      </method>
      <method abstract="false" deprecated="not deprecated" final="true" name="applySettings" jni-signature="(Lcom/scandit/datacapture/core/source/CameraSettings;Ljava/lang/Runnable;)V" bridge="false" native="false" return="void" jni-return="V" static="false" synchronized="false" synthetic="false" visibility="public">
        <parameter name="settings" type="com.scandit.datacapture.core.source.CameraSettings" jni-type="Lcom/scandit/datacapture/core/source/CameraSettings;">
        </parameter>
        <parameter name="whenDone" type="java.lang.Runnable" jni-type="Ljava/lang/Runnable;">
        </parameter>
      </method>
      <method abstract="false" deprecated="not deprecated" final="true" name="fromJson" jni-signature="(Ljava/lang/String;)Lcom/scandit/datacapture/core/source/Camera;" bridge="false" native="false" return="com.scandit.datacapture.core.source.Camera" jni-return="Lcom/scandit/datacapture/core/source/Camera;" static="true" synchronized="false" synthetic="false" visibility="public">
        <parameter name="jsonData" type="java.lang.String" jni-type="Ljava/lang/String;">
        </parameter>
      </method>
      <method abstract="false" deprecated="not deprecated" final="true" name="getCamera" jni-signature="(Lcom/scandit/datacapture/core/source/CameraPosition;)Lcom/scandit/datacapture/core/source/Camera;" bridge="false" native="false" return="com.scandit.datacapture.core.source.Camera" jni-return="Lcom/scandit/datacapture/core/source/Camera;" static="true" synchronized="false" synthetic="false" visibility="public">
        <parameter name="position" type="com.scandit.datacapture.core.source.CameraPosition" jni-type="Lcom/scandit/datacapture/core/source/CameraPosition;">
        </parameter>
      </method>
      <method abstract="false" deprecated="not deprecated" final="true" name="getCamera" jni-signature="(Lcom/scandit/datacapture/core/source/CameraPosition;Lcom/scandit/datacapture/core/source/CameraSettings;)Lcom/scandit/datacapture/core/source/Camera;" bridge="false" native="false" return="com.scandit.datacapture.core.source.Camera" jni-return="Lcom/scandit/datacapture/core/source/Camera;" static="true" synchronized="false" synthetic="false" visibility="public">
        <parameter name="position" type="com.scandit.datacapture.core.source.CameraPosition" jni-type="Lcom/scandit/datacapture/core/source/CameraPosition;">
        </parameter>
        <parameter name="settings" type="com.scandit.datacapture.core.source.CameraSettings" jni-type="Lcom/scandit/datacapture/core/source/CameraSettings;">
        </parameter>
      </method>
      <method abstract="false" deprecated="not deprecated" final="true" name="getCurrentState" jni-signature="()Lcom/scandit/datacapture/core/source/FrameSourceState;" bridge="false" native="false" return="com.scandit.datacapture.core.source.FrameSourceState" jni-return="Lcom/scandit/datacapture/core/source/FrameSourceState;" static="false" synchronized="false" synthetic="false" visibility="public">
      </method>
      <method abstract="false" deprecated="not deprecated" final="true" name="getDefaultCamera" jni-signature="()Lcom/scandit/datacapture/core/source/Camera;" bridge="false" native="false" return="com.scandit.datacapture.core.source.Camera" jni-return="Lcom/scandit/datacapture/core/source/Camera;" static="true" synchronized="false" synthetic="false" visibility="public">
      </method>
      <method abstract="false" deprecated="not deprecated" final="true" name="getDefaultCamera" jni-signature="(Lcom/scandit/datacapture/core/source/CameraSettings;)Lcom/scandit/datacapture/core/source/Camera;" bridge="false" native="false" return="com.scandit.datacapture.core.source.Camera" jni-return="Lcom/scandit/datacapture/core/source/Camera;" static="true" synchronized="false" synthetic="false" visibility="public">
        <parameter name="settings" type="com.scandit.datacapture.core.source.CameraSettings" jni-type="Lcom/scandit/datacapture/core/source/CameraSettings;">
        </parameter>
      </method>
      <method abstract="false" deprecated="not deprecated" final="true" name="getDesiredState" jni-signature="()Lcom/scandit/datacapture/core/source/FrameSourceState;" bridge="false" native="false" return="com.scandit.datacapture.core.source.FrameSourceState" jni-return="Lcom/scandit/datacapture/core/source/FrameSourceState;" static="false" synchronized="false" synthetic="false" visibility="public">
      </method>
      <method abstract="false" deprecated="not deprecated" final="true" name="getDesiredTorchState" jni-signature="()Lcom/scandit/datacapture/core/source/TorchState;" bridge="false" native="false" return="com.scandit.datacapture.core.source.TorchState" jni-return="Lcom/scandit/datacapture/core/source/TorchState;" static="false" synchronized="false" synthetic="false" visibility="public">
      </method>
      <method abstract="false" deprecated="not deprecated" final="true" name="getPosition" jni-signature="()Lcom/scandit/datacapture/core/source/CameraPosition;" bridge="false" native="false" return="com.scandit.datacapture.core.source.CameraPosition" jni-return="Lcom/scandit/datacapture/core/source/CameraPosition;" static="false" synchronized="false" synthetic="false" visibility="public">
      </method>
      <method abstract="false" deprecated="not deprecated" final="true" name="isTorchAvailable" jni-signature="()Z" bridge="false" native="false" return="boolean" jni-return="Z" static="false" synchronized="false" synthetic="false" visibility="public">
      </method>
      <method abstract="false" deprecated="not deprecated" final="true" name="removeListener" jni-signature="(Lcom/scandit/datacapture/core/source/FrameSourceListener;)V" bridge="false" native="false" return="void" jni-return="V" static="false" synchronized="false" synthetic="false" visibility="public">
        <parameter name="listener" type="com.scandit.datacapture.core.source.FrameSourceListener" jni-type="Lcom/scandit/datacapture/core/source/FrameSourceListener;">
        </parameter>
      </method>
      <method abstract="false" deprecated="not deprecated" final="true" name="removeTorchListener" jni-signature="(Lcom/scandit/datacapture/core/source/TorchListener;)V" bridge="false" native="false" return="void" jni-return="V" static="false" synchronized="false" synthetic="false" visibility="public">
        <parameter name="listener" type="com.scandit.datacapture.core.source.TorchListener" jni-type="Lcom/scandit/datacapture/core/source/TorchListener;">
        </parameter>
      </method>
      <method abstract="false" deprecated="not deprecated" final="true" name="setDesiredTorchState" jni-signature="(Lcom/scandit/datacapture/core/source/TorchState;)V" bridge="false" native="false" return="void" jni-return="V" static="false" synchronized="false" synthetic="false" visibility="public">
        <parameter name="value" type="com.scandit.datacapture.core.source.TorchState" jni-type="Lcom/scandit/datacapture/core/source/TorchState;">
        </parameter>
      </method>
      <method abstract="false" deprecated="not deprecated" final="true" name="switchToDesiredState" jni-signature="(Lcom/scandit/datacapture/core/source/FrameSourceState;)V" bridge="false" native="false" return="void" jni-return="V" static="false" synchronized="false" synthetic="false" visibility="public">
        <parameter name="desiredState" type="com.scandit.datacapture.core.source.FrameSourceState" jni-type="Lcom/scandit/datacapture/core/source/FrameSourceState;">
        </parameter>
      </method>
      <method abstract="false" deprecated="not deprecated" final="true" name="switchToDesiredState" jni-signature="(Lcom/scandit/datacapture/core/source/FrameSourceState;Lcom/scandit/datacapture/core/common/async/Callback;)V" bridge="false" native="false" return="void" jni-return="V" static="false" synchronized="false" synthetic="false" visibility="public">
        <parameter name="desiredState" type="com.scandit.datacapture.core.source.FrameSourceState" jni-type="Lcom/scandit/datacapture/core/source/FrameSourceState;">
        </parameter>
        <parameter name="whenDone" type="com.scandit.datacapture.core.common.async.Callback&lt;? super java.lang.Boolean&gt;" jni-type="Lcom/scandit/datacapture/core/common/async/Callback&lt;-Ljava/lang/Boolean;&gt;;">
        </parameter>
      </method>
      <method abstract="false" deprecated="not deprecated" final="true" name="updateFromJson" jni-signature="(Ljava/lang/String;)V" bridge="false" native="false" return="void" jni-return="V" static="false" synchronized="false" synthetic="false" visibility="public">
        <parameter name="jsonData" type="java.lang.String" jni-type="Ljava/lang/String;">
        </parameter>
      </method>
      <field deprecated="not deprecated" final="true" name="Companion" jni-signature="Lcom/scandit/datacapture/core/source/Camera$Companion;" static="true" transient="false" type="com.scandit.datacapture.core.source.Camera.Companion" type-generic-aware="com.scandit.datacapture.core.source.Camera.Companion" visibility="public" volatile="false">
      </field>
    </class>
<package name="com.scandit.datacapture.core.source" jni-name="com/scandit/datacapture/core/source">
    <interface abstract="true" deprecated="not deprecated" final="false" name="AndroidCameraProxy" static="false" visibility="public" jni-signature="Lcom/scandit/datacapture/core/source/AndroidCameraProxy;">

@jpobst
Copy link
Contributor

jpobst commented May 12, 2020

Hmm, those look like very normal public types. I don't see any reason that they wouldn't be included in the api.xml. The only thing I can think would be if they depend on types in other .jar files that aren't getting referenced, but that should result in some warnings.

You could try looking in the api.xml.class-parse file and see if they exist there. That would tell us at which step they are going missing.

If they aren't there, then I would double check that the types really do exist in the .jar file using a jar decompiler like jd-gui.

If you can attach the .jar file here I can also take a look at it.

@adydecki
Copy link
Author

I can confirm missing types do exist in the api.xml.class-parse file. Attached snipped code of the Camera type from that file.
<class abstract="false" deprecated="not deprecated" jni-extends="Ljava/lang/Object;" extends="java.lang.Object" extends-generic-aware="java.lang.Object" final="true" name="Camera" jni-signature="Lcom/scandit/datacapture/core/source/Camera;" source-file-name="SourceFile" static="false" visibility="public"> <implements name="com.scandit.datacapture.core.source.AndroidCameraProxy" name-generic-aware="com.scandit.datacapture.core.source.AndroidCameraProxy" jni-type="Lcom/scandit/datacapture/core/source/AndroidCameraProxy;" />

I'm also attaching our .jar file that we binds.
ScanditCaptureCore.zip

@jpobst
Copy link
Contributor

jpobst commented May 13, 2020

It looks like this is because this is a Kotlin library and we started honoring Kotlin visibility. If you run with Diagnostic logging, you will see that it cannot find AndroidCameraProxy:

Error while processing type '[Class] com.scandit.datacapture.core.source.Camera': Type 'com.scandit.datacapture.core.source.AndroidCameraProxy' was not found.

This is because the type is marked as internal in Kotlin, so it gets hidden:

Kotlin: Hiding internal class com/scandit/datacapture/core/source/AndroidCameraProxy

C# does not allow you to publicly expose an internal type (in this case it would be inheriting from an internal type). You can try changing the type to public in Kotlin and see if that fixes it.

@kimhongka
Copy link

Hi ipobst,

I am also getting this issue. My binding projects generated methods that I need on Xamarin.Android 10.1.X, but from 10.2.X it doesn't generated a few methods.

For instance, I was able get (10.1.X)
[Register("setJourneyId", "(Ljava/lang/String;)Lcom/gbgroup/idscan/bento/enterprice/RequestDocumentSend;", "")]
public unsafe RequestDocumentSend SetJourneyId(string journeyId)

From

Java
@NotNull
public final RequestDocumentSend setJourneyId(@NotNull String journeyId) {
Intrinsics.checkParameterIsNotNull(journeyId, "journeyId"); this.mJourneyId = journeyId;
return this;
}

Kotlin
@Suppress("unused")
fun setJourneyId(journeyId: String): RequestDocumentSend {
this.mJourneyId = journeyId
return this
}

But the method is NOT generated on the Xamarin.Android 10.2.X. I think it is related to the Kotlin binding part updated. That method above is not Internal. I made other binding project for other SDK. I have faced the same issue on latest Xamarin.Android.

@adydecki
Copy link
Author

@jpobst thank you for your investigation and providing the root cause for our issue. However we have more such scenarios where public class type inherits from internal interface type in Kotlin. Please also note that C# allows inheriting from internal interface types in public class types and in our case AndroidCameraProxy is an interface type and not a class as stated below:
Kotlin: Hiding internal class com/scandit/datacapture/core/source/AndroidCameraProxy
My question is, are you going to handle such scenarios in later releases? We could skip 10.2.0.100 if you're going to support it later.

@jpobst
Copy link
Contributor

jpobst commented May 14, 2020

@adydecki Good point about interfaces, they need to be resolvable. I've submitted a change that will fix this issue: dotnet/java-interop#645. Unfortunately 10.3 is already locked, but it should be in 10.4.

@jpobst
Copy link
Contributor

jpobst commented May 14, 2020

@kimhongka You will likely need to do the same digging in the log to determine why it is not being bound. If you Rebuild your project with at least detailed verbosity you'll see a log of every Kotlin fixup done, for example:

Kotlin: Hiding internal class com/scandit/datacapture/core/json/JsonValueProxyAdapter
Kotlin: Renaming parameter com/scandit/datacapture/core/data/FrameData - equals - p0 -> other
Kotlin: Hiding internal method com/scandit/datacapture/core/ui/DataCaptureView - 
Kotlin: Hiding internal getter method com/scandit/datacapture/core/ui/DataCaptureView - get_optimizesRendering$sdc_core_android_release

You'll also see the standard warnings about members being dropped and why. My guess would be that the method isn't being bound because the type RequestDocumentSend isn't being resolved, and you'll need to follow the log to figure out what the root issue is.

@jpobst
Copy link
Contributor

jpobst commented May 18, 2020

@kimhongka Another issue I was working on reminded me that there was an issue with hiding too many Kotlin getter/setters in 10.2: dotnet/java-interop#571.

This is fixed in 10.3, so you might want to try a 10.3 preview and see if it fixes your issue.

jonpryor pushed a commit to dotnet/java-interop that referenced this issue May 18, 2020
Context: dotnet/android#4661

In 439bd83, we made a change to hide Kotlin `internal` members as we
shouldn't be binding them.  However a `public class` can inherit from
an `internal interface`, so we need to emit those interfaces.

Instead, emit `internal interface` types as "package private" types;
`visibility=""` in `api.xml` parlance.  This allows us to resolve the
`interface` and thus successfully bind the `class`.  

In C#-land, the `interface` is not actually bound and the C# class
doesn't actually implement it.  This has no effect to the public API
end user, who shouldn't be seeing the `internal interface` anyways.
If a user really wants to publicly expose the `interface`, its
`visibility` can be changed via `metadata`.

***Note***: Changing the `visibility` of a type may result in
subsequent Java Callable Wrapper generation errors, if/when a
Java Callable Wrapper attempts to implement the package-private type.
jonpryor pushed a commit to dotnet/java-interop that referenced this issue May 18, 2020
Context: dotnet/android#4661

In 439bd83, we made a change to hide Kotlin `internal` members as we
shouldn't be binding them.  However a `public class` can inherit from
an `internal interface`, so we need to emit those interfaces.

Instead, emit `internal interface` types as "package private" types;
`visibility=""` in `api.xml` parlance.  This allows us to resolve the
`interface` and thus successfully bind the `class`.  

In C#-land, the `interface` is not actually bound and the C# class
doesn't actually implement it.  This has no effect to the public API
end user, who shouldn't be seeing the `internal interface` anyways.
If a user really wants to publicly expose the `interface`, its
`visibility` can be changed via `metadata`.

***Note***: Changing the `visibility` of a type may result in
subsequent Java Callable Wrapper generation errors, if/when a
Java Callable Wrapper attempts to implement the package-private type.
@jpobst
Copy link
Contributor

jpobst commented May 19, 2020

This has been fixed for 10.4 (16.7/8.7) via dotnet/java-interop#645.

I think Preview 3 is the first preview that will contain this fix.

@jpobst jpobst closed this as completed May 19, 2020
@ghost ghost locked as resolved and limited conversation to collaborators Jun 4, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Area: Bindings Issues in Java Library Binding projects. need-info Issues that need more information from the author.
Projects
None yet
Development

No branches or pull requests

4 participants