-
Notifications
You must be signed in to change notification settings - Fork 536
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
Comments
Are you using If you're using If you're using 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. |
We're using Missing in 10.2.0.100 version:
|
Hmm, those look like very normal public types. I don't see any reason that they wouldn't be included in the You could try looking in the If they aren't there, then I would double check that the types really do exist in the If you can attach the |
I can confirm missing types do exist in the I'm also attaching our |
It looks like this is because this is a Kotlin library and we started honoring Kotlin visibility. If you run with
This is because the type is marked as
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 |
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) From Java Kotlin 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. |
@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: |
@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. |
@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
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 |
@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. |
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.
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.
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. |
Steps to Reproduce
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
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
The text was updated successfully, but these errors were encountered: