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 to AAR library 'com.sunmi printerlibrary' gives lots of 'Class has invalid base type' errors #6352

Closed
HansOlavS opened this issue Sep 30, 2021 · 8 comments
Assignees
Labels
Area: Bindings Issues in Java Library Binding projects. needs-triage Issues that need to be assigned.

Comments

@HansOlavS
Copy link

HansOlavS commented Sep 30, 2021

Error Message or Issue

warning BG8103: Class 'Com.Sunmi.Peripheral.Printer.InnerLcdCallback' has invalid base type 'com.sunmi.peripheral.printer.ILcdCallback.Stub'.

(There's also lots of other classes with invalid base types...)

Version Information

N/A

Other Helpful Info

printerlibrary-1.0.14.aar.zip

Please note that the aar file is just renamed to aar.zip - it's not actually a zip file!

@HansOlavS HansOlavS added Area: Bindings Issues in Java Library Binding projects. needs-triage Issues that need to be assigned. labels Sep 30, 2021
@HansOlavS
Copy link
Author

I'm not sure why all my version info disappeared, but here it is:

Microsoft Visual Studio Community 2019
Version 16.11.3
VisualStudio.16.Release/16.11.3+31702.278
Microsoft .NET Framework
Version 4.8.04084

Installed Version: Community

ADL Tools Service Provider 1.0
This package contains services used by Data Lake tools

ASA Service Provider 1.0

ASP.NET and Web Tools 2019 16.11.75.64347
ASP.NET and Web Tools 2019

ASP.NET Web Frameworks and Tools 2019 16.11.75.64347
For additional information, visit https://www.asp.net/

Azure App Service Tools v3.0.0 16.11.75.64347
Azure App Service Tools v3.0.0

Azure Data Lake Node 1.0
This package contains the Data Lake integration nodes for Server Explorer.

Azure Data Lake Tools for Visual Studio 2.6.1000.0
Microsoft Azure Data Lake Tools for Visual Studio

Azure Functions and Web Jobs Tools 16.11.75.64347
Azure Functions and Web Jobs Tools

Azure Stream Analytics Tools for Visual Studio 2.6.1000.0
Microsoft Azure Stream Analytics Tools for Visual Studio

C# Tools 3.11.0-4.21403.6+ae1fff344d46976624e68ae17164e0607ab68b10
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.

ConvertToDevExtremeCommand Extension 1.0
ConvertToDevExtremeCommand Visual Studio Extension Detailed Info

DevExpress Reporting Extension 1.0
A Visual Studio extension that invokes the Report Designer editor for report definition REPX files.

DevExpress Reporting Tools Extension 1.0
Extends Visual Studio with tools required for the Report Designer editor.

DevExpress.DeploymentTool 1.0
A useful tool for deploying DevExpress assemblies.

Extensibility Message Bus 1.2.6 (master@34d6af2)
Provides common messaging-based MEF services for loosely coupled Visual Studio extension components communication and integration.

Fabric.DiagnosticEvents 1.0
Fabric Diagnostic Events

IntelliCode Extension 1.0
IntelliCode Visual Studio Extension Detailed Info

Microsoft Azure HDInsight Azure Node 2.6.1000.0
HDInsight Node under Azure Node

Microsoft Azure Hive Query Language Service 2.6.1000.0
Language service for Hive query

Microsoft Azure Service Fabric Tools for Visual Studio 16.10
Microsoft Azure Service Fabric Tools for Visual Studio

Microsoft Azure Stream Analytics Language Service 2.6.1000.0
Language service for Azure Stream Analytics

Microsoft Azure Stream Analytics Node 1.0
Azure Stream Analytics Node under Azure Node

Microsoft Azure Tools for Visual Studio 2.9
Support for Azure Cloud Services projects

Microsoft Continuous Delivery Tools for Visual Studio 0.4
Simplifying the configuration of Azure DevOps pipelines from within the Visual Studio IDE.

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

Microsoft Library Manager 2.1.113+g422d40002e.RR
Install client-side libraries easily to any web project

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

Microsoft Visual Studio Tools for Containers 1.2
Develop, run, validate your ASP.NET Core applications in the target environment. F5 your application directly into a container with debugging, or CTRL + F5 to edit & refresh your app without having to rebuild the container.

Mono Debugging for Visual Studio 16.10.15 (552afdf)
Support for debugging Mono processes with Visual Studio.

NuGet Package Manager 5.11.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

Razor (ASP.NET Core) 16.1.0.2122504+13c05c96ea6bdbe550bd88b0bf6cdddf8cde1725
Provides languages services for ASP.NET Core Razor.

SQL Server Data Tools 16.0.62107.28140
Microsoft SQL Server Data Tools

ToolWindowHostedEditor 1.0
Hosting json editor into a tool window

TypeScript Tools 16.0.30526.2002
TypeScript Tools for Microsoft Visual Studio

Visual Basic Tools 3.11.0-4.21403.6+ae1fff344d46976624e68ae17164e0607ab68b10
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 16.11.0-beta.21322.6+488cc578cafcd261d90d748d8aaa7b8b091232dc
Microsoft Visual F# Tools

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

Visual Studio Container Tools Extensions 1.0
View, manage, and diagnose containers within Visual Studio.

Visual Studio Tools for Containers 1.0
Visual Studio Tools for Containers

Visual Studio Tools for Kubernetes 1.0
Visual Studio Tools for Kubernetes

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.11.000.175 (d16-11@e140e23)
Visual Studio extension to enable development for Xamarin.iOS and Xamarin.Android.

Xamarin Designer 16.11.0.17 (remotes/origin/11e0001f0b17269345e80b58fb3adf1ba4efe2cd@11e0001f0)
Visual Studio extension to enable Xamarin Designer tools in Visual Studio.

Xamarin Templates 16.10.5 (355b57a)
Templates for building iOS, Android, and Windows apps with Xamarin and Xamarin.Forms.

Xamarin.Android SDK 11.4.0.5 (d16-11/7776c9f)
Xamarin.Android Reference Assemblies and MSBuild support.
Mono: c633fe9
Java.Interop: xamarin/java.interop/d16-11@48766c0
ProGuard: Guardsquare/proguard@912d149
SQLite: xamarin/sqlite@85460d3
Xamarin.Android Tools: xamarin/xamarin-android-tools/d16-11@683f375

Xamarin.iOS and Xamarin.Mac SDK 14.20.0.25 (3b53e529b)
Xamarin.iOS and Xamarin.Mac Reference Assemblies and MSBuild support.

@jpobst
Copy link
Contributor

jpobst commented Sep 30, 2021

This means there is something wrong trying to bind the com.sunmi.peripheral.printer.ILcdCallback.Stub type, which Com.Sunmi.Peripheral.Printer.InnerLcdCallback depends on.

There is a lot of information about debugging this issue here: https://github.com/xamarin/java.interop/wiki/Troubleshooting-Android-Bindings-Issues.

You will need to examine the diagnostic build log and find the message telling you what issue it is hitting binding com.sunmi.peripheral.printer.ILcdCallback.Stub.

@HansOlavS
Copy link
Author

Thanks, I'll try that and update this issue if I'm able to resolve it or not.

@HansOlavS
Copy link
Author

HansOlavS commented Sep 30, 2021

Thanks a lot @jpobst!, I got that fixed 😊
I can see that the classes I need are marked with visibility="" in the api.xml file. I've fixed those with <attr> tags in the Metadata.xml file, but now I'm stuck with these warnings:

  • Com.Sunmi.Peripheral.Printer.ICallback.cs(120,30,120,40): warning CS0114: 'CallbackStub.OnTransact(int, Parcel, Parcel, int)' hides inherited member 'Binder.OnTransact(int, Parcel, Parcel?, int)'. To make the current member override that implementation, add the override keyword. Otherwise add the new keyword.
  • Com.Sunmi.Peripheral.Printer.ISunmiPrinterService.cs(2157,30,2157,40): warning CS0114: 'SunmiPrinterServiceStub.OnTransact(int, Parcel, Parcel, int)' hides inherited member 'Binder.OnTransact(int, Parcel, Parcel?, int)'. To make the current member override that implementation, add the override keyword. Otherwise add the new keyword.
  • ILcdCallback.cs(120,30,120,40): warning CS0114: 'LcdCallbackStub.OnTransact(int, Parcel, Parcel, int)' hides inherited member 'Binder.OnTransact(int, Parcel, Parcel?, int)'. To make the current member override that implementation, add the override keyword. Otherwise add the new keyword.
  • ITax.cs(120,30,120,40): warning CS0114: 'TaxStub.OnTransact(int, Parcel, Parcel, int)' hides inherited member 'Binder.OnTransact(int, Parcel, Parcel?, int)'. To make the current member override that implementation, add the override keyword. Otherwise add the new keyword.

Any easy way to fix that via Metadata.xml or otherwise? Or maybe it's not really an issue at all and I can ignore it? 🤔

@jpobst
Copy link
Contributor

jpobst commented Sep 30, 2021

They are warnings, so you can ignore them if you want.

We added this metadata to allow you to fix them, but I don't think it ever got properly documented: dotnet/java-interop#701

@HansOlavS
Copy link
Author

Thanks again, @jpobst! I tried to use that but I got this error:

  • 'SunmiPrinterServiceStub.OnTransact(int, Parcel, Parcel, int)': cannot change access modifiers when overriding 'protected' inherited member 'Binder.OnTransact(int, Parcel, Parcel?, int)'

Hopefully this will work just fine with the warnings. I'll give it the good old college try! Thanks for the excellent help!

@jpobst
Copy link
Contributor

jpobst commented Sep 30, 2021

You would probably need to change the visibility to protected to match the base method.

Glad you got it working!

@HansOlavS
Copy link
Author

@jpobst Just for the record: You were right, setting the visibility to protected made everything work as a charm! Peace out!

Thanks so much for the extremely helpful tips and lightning speed! 🙏

@ghost ghost locked as resolved and limited conversation to collaborators Jun 2, 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. needs-triage Issues that need to be assigned.
Projects
None yet
Development

No branches or pull requests

2 participants