Now that I’ve successfully created a first Xamarin Android Binding Library, it is time to use it in a sample application. Nothing very fancy here.
Missing method in the c# generated code
I quickly found out that one required method was missing from the generated c# code. The Java code in the Zoom website converted to c# did not compile. It couldn’t find the Initialize method.
By the way the Java sample is outdated as the method used is marked as deprecated. No need to generated c# code for deprecated Java methods. I found the correct code to be used in the SDK sample. The web site is not in sync with the SDK code, duh. In fact, it goes like the following:
ZoomSDKInitParams initParams = new ZoomSDKInitParams(); initParams.AppKey = "MyAppKey"; initParams.AppSecret = "MyAppSecret"; initParams.Domain = "zoom.us"; initParams.VideoRawDataMemoryMode = ZoomSDKRawDataMemoryMode.ZoomSDKRawDataMemoryModeStack; ZoomSDK.Instance.Initialize(this, this, initParams);
Again this other Initialize method is missing in the generated c# code !
Why on earth would that method not being generated? The answer was to be found in the build log.
After carefully examining the build output of the binding project created in part 1, I found out that The Initialize Method has not been generated because the ZoomSDKInitParams type was not found.
I quickly realised that this type was defined in another .aar file that I did not see at first. It turned out that another bindind library was needed to be referenced by the first binding library. So I was back to step one for a moment.
- Create a new Binding Library.
- Add the .aar file
- Build and solve compilation problems by adding the following Metadata.xml file
I Added this binding library as a reference to the first binding library. And My Initialize method was now correctly generated.
Now It was time to create the sample project, add both binding libraries as references. Making sure that I’m using API 29 to be able to compile.
I had to solve more errors on resources missing (primarily colors…)
I Found the resources by decompiling the .aar file, saved the xml file and added it to the android project.
I also needed to add Colors to Colors.xml and create a dimens.mxl file and put dimens in there.
Next up was several errors : multiple substitutions specified in non-positional format; did you mean to add the formatted=”false” attribute?
These error comes from embedded resources in the main .aar file for which I’ve created bindings (ZoomBindings).
I have to say that it was probably the right time to ask for the help of the community. So I asked on StackOverflow. Then pushed my preliminary work on GitHub.
One thought on “Xamarin Android Bindings – Part 2”