Hi,
I managed to generate a binding library for my Android java library.
When i reference it though within my clean Android App i cannot get the App to compile.
The errors i am getting are because of the autogenerated (by Xamarin) XXXImplementor classes.
For example in some cases where my java code defined listener interfaces i.e
public interface MyListener {}
The output binding dll contains two extra classes called MyListenerInvoker and
MyListenerImplementor.
When compiling the Android App that references that dll though this is the error i am getting:
C:\Users\Anargyros\Documents\Projects\TestAndroidBinding\AndroidApp\obj\Debug\android\src\mono\com\path\to\listener\MyListenerImplementor.java(38,38): Error: package com.path.to.listener does not exist com.path.to.listener.MyListener
Any ideas how can i workaround this problem?
Thank you.
Posts
I am attaching 2 screenshots that highlight the issue![]()
The problem is that the
.jar
that containscom.*.android.io.HorizontalPager.OnScreenSwitchListener
isn't present on thejavac
command line, sojavac
reports compilation errors when compiling the Android Callable Wrappers.Please change the Build action of your
.jar
in your Binding project toEmbeddedJar
. This will add the.jar
to thejavac
command line, allowing the Android Callable Wrappers to compile.Awesomeness!! It worked.
You've added
android-support-v4.jar
to your project twice. Remove one of the references.Note:
Mono.Android.Support.v*.dll
embedsandroid-support-v*.jar
, so if you reference any of the support libraries you'll already get a set of those types.Now that i try to run the Android App i get this error :
C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(3,3): Error MSB4018: The "BuildApk" task failed unexpectedly.
System.ArgumentException: An item with the same key has already been added.
at System.ThrowHelper.ThrowArgumentException(ExceptionResource resource)
at System.Collections.Generic.Dictionary`2.Insert(TKey key, TValue value, Boolean add)
at Ionic.Zip.ZipFile._InternalAddEntry(ZipEntry ze)
at Ionic.Zip.ZipFile.AddFile(String fileName, String directoryPathInArchive)
at Xamarin.Android.Tasks.BuildApk.AddNativeLibrary(ZipFile apk, String path, String abi)
at Xamarin.Android.Tasks.BuildApk.AddNativeLibraries(ZipFile apk)
at Xamarin.Android.Tasks.BuildApk.Execute()
at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
at Microsoft.Build.BackEnd.TaskBuilder.d__20.MoveNext() (MSB4018) (AndroidApp)
It seems this is because i have also included the native libs twice.Once in the binding project and once in the App project.