I'm trying to create a binding project for OpenTok.jar so I can use version 2.7 with Xamarin. My binding project is unable to build because it generates two of the same classes. SubscriberKit.DisconnectedEventArgs exists two times which I cannot seem to Transform away.
Anyone have a solution for this or tried anything like this?
The access to the solution can be found here:
https://ebbits.tnmconsult.dk:9445/downloads/agrinord.apk
The error I receive is: "Severity Code Description Project File Line Suppression State
Error CS0111 Type 'SubscriberKit.DisconnectedEventArgs' already defines a member called '.ctor' with the same parameter types OpenTokBinding'"
If got help from Xamarin and the answer was to look at the parent of the classes (the once which references them).
The proberty was found in SubscriberKit.SubscriberListener and SubscriberKit.StreamListener both had a method/ event called onDisconnect which lead to two DisconnectedEventArgs classes. So once I renamed these two event to:
- SubscriberOnDisconnected
- StreamOnDisconnected
It worked. Code for renaming was placed in Metadata.xml and looked like:
<attr path="/api/package[#name='com.opentok.android']/interface[#name='SubscriberKit.SubscriberListener']/method[#name='onDisconnected']" name="managedName">SubscriberOnDisconnected</attr>
<attr path="/api/package[#name='com.opentok.android']/interface[#name='SubscriberKit.StreamListener']/method[#name='onDisconnected']" name="managedName">StreamOnDisconnected</attr>
Related
We've been using the Navigation component in our project but have stumbled across an issue which seems unique to our project and the JetBrains Android plugin. I can't pinpoint the exact point it started happening but I noticed it after the release of AS 3.2.
The project builds fine however when editing a navigation XML things such as auto-complete and highlighting are broken and the Android Support Plugin throws this error:
java.lang.IllegalArgumentException: Multiple entries with same key: org.jetbrains.android.dom.navigation.NavigationSchema$TypeRef#0=org.jetbrains.android.dom.navigation.NavigationSchema$NavigatorKeyInfo#17d69e53 and org.jetbrains.android.dom.navigation.NavigationSchema$TypeRef#0=org.jetbrains.android.dom.navigation.NavigationSchema$NavigatorKeyInfo#442c4fde
at com.google.common.collect.ImmutableMap.conflictException(ImmutableMap.java:215)
at com.google.common.collect.ImmutableMap.checkNoConflict(ImmutableMap.java:209)
at com.google.common.collect.RegularImmutableMap.checkNoConflictInKeyBucket(RegularImmutableMap.java:147)
at com.google.common.collect.RegularImmutableMap.fromEntryArray(RegularImmutableMap.java:110)
at com.google.common.collect.ImmutableMap$Builder.build(ImmutableMap.java:393)
at org.jetbrains.android.dom.navigation.NavigationSchema.buildCacheKeys(NavigationSchema.java:488)
at org.jetbrains.android.dom.navigation.NavigationSchema.init(NavigationSchema.java:479)
at org.jetbrains.android.dom.navigation.NavigationSchema.createIfNecessary(NavigationSchema.java:389)
at org.jetbrains.android.dom.AttributeProcessingUtil.processNavAttributes(AttributeProcessingUtil.java:408)
at org.jetbrains.android.dom.AttributeProcessingUtil.processAttributes(AttributeProcessingUtil.java:596)
at org.jetbrains.android.dom.AndroidDomExtender.registerExtensions(AndroidDomExtender.java:57)
at org.jetbrains.android.dom.AndroidDomExtender.registerExtensions(AndroidDomExtender.java:29)
at com.intellij.util.xml.reflect.DomExtenderEP.extend(DomExtenderEP.java:83)
at com.intellij.util.xml.impl.DynamicGenericInfo.runDomExtenders(DynamicGenericInfo.java:134)
at com.intellij.util.xml.impl.DynamicGenericInfo.lambda$checkInitialized$0(DynamicGenericInfo.java:64)
at com.intellij.openapi.util.RecursionManager$2.doPreventingRecursion(RecursionManager.java:98)
at com.intellij.util.xml.impl.DynamicGenericInfo.checkInitialized(DynamicGenericInfo.java:63)
at com.intellij.util.xml.impl.DynamicGenericInfo.getAttributeChildrenDescriptions(DynamicGenericInfo.java:241)
at com.intellij.util.xml.impl.DynamicGenericInfo.processAttributeChildrenDescriptions(DynamicGenericInfo.java:254)
at com.intellij.util.xml.impl.DomSemContributor.lambda$registerSemProviders$5(DomSemContributor.java:199)
at com.intellij.semantic.SemServiceImpl$2.lambda$registerSemElementProvider$0(SemServiceImpl.java:93)
at com.intellij.semantic.SemServiceImpl.createSemElements(SemServiceImpl.java:190)
at com.intellij.semantic.SemServiceImpl.getSemElements(SemServiceImpl.java:161)
at com.intellij.semantic.SemService.getSemElement(SemService.java:37)
at com.intellij.util.xml.impl.DomManagerImpl.getDomHandler(DomManagerImpl.java:390)
at com.intellij.util.xml.impl.GenericValueReferenceProvider.getReferencesByElement(GenericValueReferenceProvider.java:47)
at com.intellij.psi.impl.source.resolve.reference.ReferenceProvidersRegistryImpl.getReferences(ReferenceProvidersRegistryImpl.java:135)
at com.intellij.psi.impl.source.resolve.reference.ReferenceProvidersRegistryImpl.mapNotEmptyReferencesFromProviders(ReferenceProvidersRegistryImpl.java:123)
at com.intellij.psi.impl.source.resolve.reference.ReferenceProvidersRegistryImpl.doGetReferencesFromProviders(ReferenceProvidersRegistryImpl.java:102)
at com.intellij.psi.impl.source.resolve.reference.ReferenceProvidersRegistry.getReferencesFromProviders(ReferenceProvidersRegistry.java:50)
at com.intellij.psi.impl.source.resolve.reference.ReferenceProvidersRegistry.getReferencesFromProviders(ReferenceProvidersRegistry.java:44)
at com.intellij.psi.impl.source.xml.XmlAttributeValueImpl.getReferences(XmlAttributeValueImpl.java:110)
at com.intellij.codeInsight.daemon.impl.analysis.XmlHighlightVisitor.checkReferences(XmlHighlightVisitor.java:439)
at com.intellij.codeInsight.daemon.impl.analysis.XmlHighlightVisitor.visitXmlAttributeValue(XmlHighlightVisitor.java:406)
at com.intellij.psi.impl.source.xml.XmlAttributeValueImpl.accept(XmlAttributeValueImpl.java:61)
at com.intellij.codeInsight.daemon.impl.analysis.XmlHighlightVisitor.visit(XmlHighlightVisitor.java:587)
at com.intellij.codeInsight.daemon.impl.GeneralHighlightingPass.runVisitors(GeneralHighlightingPass.java:353)
at com.intellij.codeInsight.daemon.impl.GeneralHighlightingPass.lambda$collectHighlights$5(GeneralHighlightingPass.java:286)
at com.intellij.codeInsight.daemon.impl.GeneralHighlightingPass.analyzeByVisitors(GeneralHighlightingPass.java:313)
at com.intellij.codeInsight.daemon.impl.GeneralHighlightingPass.lambda$analyzeByVisitors$6(GeneralHighlightingPass.java:316)
at com.intellij.codeInsight.daemon.impl.analysis.XmlHighlightVisitor.analyze(XmlHighlightVisitor.java:597)
at com.intellij.codeInsight.daemon.impl.GeneralHighlightingPass.analyzeByVisitors(GeneralHighlightingPass.java:316)
at com.intellij.codeInsight.daemon.impl.GeneralHighlightingPass.lambda$analyzeByVisitors$6(GeneralHighlightingPass.java:316)
at com.intellij.codeInsight.daemon.impl.DefaultHighlightVisitor.analyze(DefaultHighlightVisitor.java:71)
at com.intellij.codeInsight.daemon.impl.GeneralHighlightingPass.analyzeByVisitors(GeneralHighlightingPass.java:316)
at com.intellij.codeInsight.daemon.impl.GeneralHighlightingPass.collectHighlights(GeneralHighlightingPass.java:283)
at com.intellij.codeInsight.daemon.impl.GeneralHighlightingPass.collectInformationWithProgress(GeneralHighlightingPass.java:227)
at com.intellij.codeInsight.daemon.impl.ProgressableTextEditorHighlightingPass.doCollectInformation(ProgressableTextEditorHighlightingPass.java:84)
at com.intellij.codeHighlighting.TextEditorHighlightingPass.collectInformation(TextEditorHighlightingPass.java:69)
at com.intellij.codeInsight.daemon.impl.PassExecutorService$ScheduledPass.lambda$null$1(PassExecutorService.java:423)
at com.intellij.openapi.application.impl.ApplicationImpl.tryRunReadAction(ApplicationImpl.java:1171)
at com.intellij.codeInsight.daemon.impl.PassExecutorService$ScheduledPass.lambda$doRun$2(PassExecutorService.java:416)
at com.intellij.openapi.progress.impl.CoreProgressManager.registerIndicatorAndRun(CoreProgressManager.java:582)
at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:532)
at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:87)
at com.intellij.codeInsight.daemon.impl.PassExecutorService$ScheduledPass.doRun(PassExecutorService.java:415)
at com.intellij.codeInsight.daemon.impl.PassExecutorService$ScheduledPass.lambda$run$0(PassExecutorService.java:391)
at com.intellij.openapi.application.impl.ReadMostlyRWLock.executeByImpatientReader(ReadMostlyRWLock.java:147)
at com.intellij.openapi.application.impl.ApplicationImpl.executeByImpatientReader(ApplicationImpl.java:222)
at com.intellij.codeInsight.daemon.impl.PassExecutorService$ScheduledPass.run(PassExecutorService.java:389)
at com.intellij.concurrency.JobLauncherImpl$VoidForkJoinTask$1.exec(JobLauncherImpl.java:161)
at java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:289)
at java.util.concurrent.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1056)
at java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1692)
at java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:157)
We're running the latest version of the navigation component (2.0.0-rc2) and and I've tried all the usual fixes (Invalidate Caches & Restart etc). I've tried using navigation in fresh projects and it seems to work without this error being thrown.
I have tried removing all nav XMLs from our project and then adding in a completely blank XML but it still throws the error. I delved into the source of the plugin and it seems this occurs when the plugin is initially processing the nav file for the design view which doesn't make sense if it's throwing it for a fresh nav file.
I'm currently at a loss as to why this may be happening and any ideas would be greatly appreciated!
The short answer:
I fixed it by moving an anonymous class which extended androidx.navigation.Navigator to a separate class and adding the annotation #Navigator.Name(String name) with a unique name.
If you are also experiencing this issue check that in your project or its dependencies if there are any classes inheriting the Navigator class which are either missing the #Navigator.Name(String name) annotation or using non-unique strings as the name parameter. fragment and activity cannot be used as they are used already within the API.
Further info:
After further delving into the Android Support plugin source code to understand what's going on I've managed to solve the issue on our project.
When initiating the IDE functionality in the Android Support Plugin it goes through your project and any dependencies looking for any class which inherits the Navigator class and gives it a tag for the purpose of managing it in the XML files and design view. This tag is based on an annotation #Navigator.Name(String name). If no annotation is present a default value is used.
These tags have to be unique as they are used as the keys for building an immutable map of tags to navigator types. In our project we had an anonymous class which was extending Navigator class and had no annotation.
There is also an anonymous class extending Navigator within the navigation component source, specifically within the NavDeepLinkBuilder class. As there is only a single default value for the tags any other class inheriting Navigator with no annotation being present in your project or its dependencies will cause this issue.
I'm trying to bind an android SDK for voice chat (zoom sdk).
They have two .aar files (zoomcoomonlib.aar and zoomsdk.aar)
I know I have to create separate binding project for each .aar and then reference them.
While binding zoomsdk.aar I'm getting the below error
The type `Com.Zipow.Videobox.Onedrive.ErrorEventArgs' already contains a definition for `P0' (CS0102) (B14)
In the .aar file I navigated to the package com.zipow.videobox.onedrive; to the interface IODFoldLoaderListener
And below are the contents of it
So it seems parameter String var1 of method onError is causing the issue.
And xamarin studio generated obj/debug/api.xml confirms it (below screenshot) that onError will have first parameter named p0:
So in this scenario I change the metadata.xml to give this parameter a meaningful name.
Like below screenshot:
But even after doing that I am getting same error. That error didn't resolve.
Moreover now if I see the obj/debug/api/.xml file I see the contents for the class IODFoldLoaderListener remains the same.
So changing the metadata.xml has no effect it seems.
Your definition needs to be changed quite a bit. Here is an example that solves the same problem:
<attr path="/api/package[#name='com.emarsys.mobileengage.inbox']/interface[#name='ResetBadgeCountResultListener']/method[#name='onError' and count(parameter)=1 and parameter[1][#type='java.lang.Exception']]" name="argsType">ResetBadgeCountResultListenerOnErrorArgs</attr>
Please note the /interface and argsType items here as your initial definition is incorrect. You would then change the parameters to strings instead of java.lang.Exception from my example.
I am trying to create a binding library for android AndTinder library. But I am getting the following error
Error CS0507: 'Com.Andtinder.View.SimpleCardStackAdapter.GetCardView(int, Com.Andtinder.Model.CardModel, Android.Views.View, Android.Views.ViewGroup)': cannot change access modifiers when overriding 'protected' inherited member 'Com.Andtinder.View.CardStackAdapter.GetCardView(int, Com.Andtinder.Model.CardModel, Android.Views.View, Android.Views.ViewGroup)' (CS0507)
To fix the above error , I added the following line to Metadata.xml
<attr path="/api/package[#name='Com.AndTinder.View']/class[#name='CardStackAdapter']/method[#name='GetCardView']" name="visibility">protected</attr>
But this has not fixed. I would appreciate if someone could give me hints on how to fix this error
The base class is protected. So you want to fix this by changing the C# version to protected as well.
Based on the package: package com.andtinder.view;
And the MethodName getCardView: https://github.com/kikoso/Swipeable-Cards/blob/master/AndTinder/src/main/java/com/andtinder/view/CardStackAdapter.java#L69
<attr path="/api/package[#name='com.andtinder.view']/class[#name='CardStackAdapter']/method[#name='getCardView']" name="visibility">protected</attr>
Overall it seems like you just need to ensure your case sensitivity and this should work!
I'm using AndroidAnnotations in an Android Studio gradle project. I currently get error output from AA during compilation that says:
cannot find symbol class MyActivity_
The error output does not prevent building the application - its not really a compile error because the class is there, it seems that it is just an unfortunate timing issue with the compilation process.
Is there anything I can do to avoid these false-positive errors from AA? When there are "fake" errors shown every time I compile, its very easy to miss the real errors.
I had same error. To solve it I have revert my last changes and it has worked again.
I think it was either wrong optimized import(you must import generated classes eg. xxx_) or I injected layout by id what was not existed in the layout xml
Update
I figured it. My problem was what I had use private mofidier instead of proteced in
#ViewById(R.id.list)
private ListView list;
Try to see if you missed to fix some errors in the class MainActivity or in someone of his Bean member that you have annoted.
The problem doesn't have to be in MainActivty, but it is probably because of a private modifier which is used with Android Anotations (in injection, method declaration etc) somewhere in your code
I'm having trouble trying to port Card.IO to Xamarin Android. Since I am using C# instead of Java, I don't know what to do with the .so files and the .jar files.
I tried to follow some of the steps posted here : card.io Mono for Android (Xamarin Studio) but I am getting the following two build errors that I don't know how to solve.
Here's What I've done so far
Create a new Android Java Bindings Library Project
Add the .jar and .so files from Card.IO project, with the existing folder structure. So there is four subfolders under the /libs folder, and then a single jar under /libs.
Add the following to Transforms/EnumMethods.xml to resolve a compiler error:
<mapping jni-class="io/card/payment/CardIOActivity">
<method jni-name="onActivityResult" parameter="p1" clr-enum-type="Android.App.Result" />
</mapping>
Add a reference to the above Library in my main application.
And then I am faced with these build errors :
The type or namespace name 'IN' does not exist in the namespace
'IO.Card.Payment' (are you missing an assembly reference?)
'A': member names cannot be the same as their enclosing type
Update
The first error is on this line :
public sealed partial class CardIOActivity : global::Android.App.Activity, global::IO.Card.Payment.IN {
The second error seems to be on this line :
public static global::System.Collections.IList A {
Any help is useful, thanks!
i've spent like 10 hours yday to get card io working with my xamarin application... after long long battles i managed to see what i wanted... i did not see the above error about 2 interfaces, i've had an issue with 'a' field in 'A' class and there as an error telling that "IN" interface does not exist (this is an interface, so no problem with double base class should be shown there, that's odd).
not sure if all my steps are necessary to make it working but (surprise, surprise) i was to tired to clean that up and check which chagnes were really essencial. lots of problems are cause by the code obfuscation of the card io jar.
nevermind, back to the topic:
create new binding project, add the jar as embeded jar, add the .so files as embided native libraries (use the existing structure)
open EnumMethods.xml and add there a mapping:
<mapping jni-class="io/card/payment/CardIOActivity">
<method jni-name="onActivityResult" parameter="p1" clr-enum-type="Android.App.Result" />
</mapping>
(this changes int to enum type used by .net xamarin in the onActivityResult method (which is overloaded by one of the classes in card.io.jar)
3. open Metadata.xml and add below nodes (some might be unnecessary):
<attr path="/api/package[#name='io.card.payment']/class[#name='A']/field[#name='a']" name="managedName">AProp</attr>
<attr path="/api/package[#name='io.card.payment']/class[#name='M']" name="visibility">public</attr>
<attr path="/api/package[#name='io.card.payment']/class[#name='M']" name="name">Mcl</attr>
<attr path="/api/package[#name='io.card.payment']/interface[#name='N']" name="visibility">public</attr>
<attr path="/api/package[#name='io.card.payment']/interface[#name='N']" name="name">Nifc</attr>
<attr path="/api/package[#name='io.card.payment']/class[#name='L']" name="visibility">public</attr>
<attr path="/api/package[#name='io.card.payment']/class[#name='L']/field[#name='a']" name="managedName">aProp</attr>
<attr path="/api/package[#name='io.card.payment']/class[#name='L']/method[#name='a']" name="managedName">aMethod</attr>
<attr path="/api/package[#name='io.card.payment']/class[#name='L']" name="name">Lcl</attr>
above nodes change some visibilities to public (most needed) and change some names of classes or iterfaces (not sure if needed, but it was useful to me at some point)
add reference to the binding project in the main one.
open AndroidManifest.xml in the main project and add there:
<activity android:name="io.card.payment.CardIOActivity" android:configChanges="keyboardHidden|orientation" />
<activity android:name="io.card.payment.DataEntryActivity" android:screenOrientation="portrait"/>
nodes should be added under application node (which is a child of main node - manifest)
now you should be able to invoke the CardIOActivity and use what you want (invoking and using is available and seems to be described well in the examples provided by the creators)
one more hint, nothing big, but when i finally succeeded in getting the library working i missed it... to get result as CreditResult object in OnActivityResult method use java cast:
var scanResult = data.GetParcelableExtra(CardIOActivity.ExtraScanResult).JavaCast();
ordinary c# cast won't work.
if you have any problems let me know, perhaps i missed something (especially that i'm not yet xamarin expert).
good luck!
ps: answer placed #xamarin forum too
EDIT:
Completet solution with binding, checked and working uploded to github:
https://github.com/wiadran/card.io.xamarin.binding.git