Xamarin Java Binding Library - Sinch - java

I am having issues creating a java binding library in Xamarin from the Sinch Android API. It seems like its not linking all the class files contained in the jar file.
obj\Debug\generated\src\Com.Sinch.Android.Rtc.Internal.Client.ConfigRefresher.cs(9,87,9,121): error CS0234: The type or namespace name 'UserAgentMethodInvocationScheduler' does not exist in the namespace 'Com.Sinch.Android.Rtc.Internal.Client' (are you missing an assembly reference?)
obj\Debug\generated\src\Com.Sinch.Android.Rtc.Internal.Client.HouseKeeper.cs(9,83,9,117): error CS0234: The type or namespace name 'UserAgentMethodInvocationScheduler' does not exist in the namespace 'Com.Sinch.Android.Rtc.Internal.Client' (are you missing an assembly reference?)
obj\Debug\generated\src\Com.Rebtel.Repackaged.Com.Google.Gson.Internal.Bind.TypeAdapters.cs(942,25,942,30): error CS0111: Type 'Com.Rebtel.Repackaged.Com.Google.Gson.Internal.Bind.TypeAdapters.EnumTypeAdapter' already defines a member called 'Write' with the same parameter types
I am using the 3.4.1 Android API here:
https://www.sinch.com/downloads/

I am using sinch binding from https://github.com/NAXAM/sinch-verification-android-binding.
Point to be noted: if you directly add reference from above GitHub link into your project you will get lot of compile time error .
Use Nuget package instead
Install-Package Naxam.SinchVerification.Droid
It works fine .

Related

LibGDX GWT/HTML with Kotlin: "No source code is available for type <XYZ>, did you forget to inherit a required module?"

I generated a simple libGDX project with no dependencies. When I tried to build it as HTML app with Gradle (./gradlew html:dist), I get the following error message:
Tracing compile failure path for type 'xjcl.downgradius.client.HtmlLauncher'
[ERROR] Errors in 'file:/home/jan/Dropbox/py/AndroidStudioProjects/Downgradius_Android/html/src/xjcl/downgradius/client/HtmlLauncher.java'
[ERROR] Line 49: No source code is available for type xjcl.downgradius.DowngradiusGame; did you forget to inherit a required module?
I think the problem is caused by me using Kotlin in this project, and libGDX being intended for Java development. I observed that when I made a new main Game class in Java, that class was found by GWT, but not the Kotlin classes it imports.
I know Kotlin does some re-packaging (for example, if you put funA and funB in file Foo, they will be re-packaged as part of a new FooKt package, I think), but it should be able to find it as
it is declared in the right package (xjcl.downgradius)
it is declared as the only class in its file
I get no IDE warnings about importing it from Java.
I also tried converting Kotlin to Java code but the resulting Java code was full of errors.
Your assumptions are correct. GWT compiler works on Java sources. The error message it gives you is correct: There are no Java source code files to be found, you say it yourself that you used Kotlin.
If you want to use GWT, convert to correct Java source code.

Referencing Xamarin AAR bindings project causes circular reference build error

I am creating Xamarin bindings on a AAR file in Visual Studio. I have created the bindings in Visual Studio using auto-generated code in an Android Bindings Library (Xamarin) project template. The bindings project compiles without errors and the only warnings in the build output relate to this specific issue: "The member '...' does not hide an accessible member. The new keyword is not required."
The problem is when I try to reference the bindings project. I created a blank Xamarin Android app project, called AndroidTest, which and ran fine. I then added a reference to the binding project to Android test. I added no code in AndroidTest that references the binding. When I build the AndroidTest project, I get the following error:
Error The "LinkAssemblies" task failed unexpectedly.
System.IO.FileNotFoundException: Could not load assembly 'AndroidTest, Version=0.0.0.0, Culture=neutral, PublicKeyToken='. Perhaps it doesn't exist in the Mono for Android profile?
File name: 'AndroidTest.dll'
at Java.Interop.Tools.Cecil.DirectoryAssemblyResolver.Resolve(AssemblyNameReference reference, ReaderParameters parameters)
at Java.Interop.Tools.Cecil.DirectoryAssemblyResolver.GetAssembly(String fileName)
at Xamarin.Android.Tasks.LinkAssemblies.Execute(DirectoryAssemblyResolver res)
at Xamarin.Android.Tasks.LinkAssemblies.Execute()
at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
at Microsoft.Build.BackEnd.TaskBuilder.<ExecuteInstantiatedTask>d__26.MoveNext() AndroidTest
The bindings project has no reference to AndroidTest, and there are no other projects in the solution. How do I resolve this error?

Xamarin Java Library Binding

I'm trying to create a Java Binding Library for Xamarin.Android.
I have created library with several errors, but i have handled them.
Problem exists when I'm trying to use this library in Xamarin.Android project.
I'm trying to port FreeFLow library
This is my application build result (posted only one of ~30 similar errors):
Error 1 package com.comcast.freeflow.core.AbsLayoutContainer does not exist
com.comcast.freeflow.core.AbsLayoutContainer.OnItemClickListener
And this error leads to .java file, which starts with:
public class AbsLayoutContainer_OnItemClickListenerImplementor
extends java.lang.Object
implements
mono.android.IGCUserPeer,
com.comcast.freeflow.core.AbsLayoutContainer.OnItemClickListener

How to override a java library in plugin development environment

I develop an application in a "special" plugin-development environment.
This environment needs to include some java libraries by default so that the created plugin-application can be exported and used successfully.
The problem is now that the plugin-environment comes with an old "javax.mail" library. It is not supported to override this library in the environment.
Of course it is possible to include the newer javax.mail library into my plugin-application but the library is not recognized and the old library is used.
Question:
Is it possible to force a Java Application to use a special included library which is using the same package and class names like a "native" library from a "plugin-environment"?
What I have tried:
I tried to rename the package files within the custom library "javax.mail" to "javax_external.mail" and to use something like this in my application:
javax_external.mail.Session session = javax_external.mail.Session.getDefaultInstance(props);
But I get the error: Type mismatch: cannot convert from javax.mail.Session to javax.mail.Session

No class found exception while using json-lib in android

I am taking the input from the web, which is an Xml file and converting into a Json data using the library json-lib . I have created a user library and added the following jars into it:-
json-lib-2.3-jdk15.jar
commons-collections.jar
commons-lang.jar
commons-logging.jar
commons-beanutils.jar
ezmorph-1.0.6.jar
xom-1.1.jar
But still gives the following error:-
08-04 13:58:31.642: ERROR/dalvikvm(484): Could not find class 'net.sf.json.xml.XMLSerializer$CustomElement', referenced from method net.sf.json.xml.XMLSerializer.addNameSpaceToElement
Can anyone help me out in resolving this issue.
Either you have a sdk level / jdk level conflict. I mean dalvik can't get the byte code of the CustomElement class of your librairy as it is compiled with to recent features for your SDK like annotations for instance.
Or there is a conflicting librairy json-lib in some other of your jars or lib folders.
(the 3 first comments are not relevant, it's just the way inner classes are compiled, using a $)
Regards,
Stéphane
Since android already support json org.json a different json library may conflict. (You can download the jar here)
Try to use this library instead of an external library on android.
BTW: You can also use this library if you need on any java code (not only android)

Categories

Resources