Bug 9271 - Using a java binding project still requires JAR to be added to application project.
Summary: Using a java binding project still requires JAR to be added to application pr...
Alias: None
Product: Android
Classification: Xamarin
Component: Bindings ()
Version: 4.4.x
Hardware: PC Mac OS
: --- major
Target Milestone: ---
Assignee: Atsushi Eno
Depends on:
Reported: 2013-01-04 12:19 UTC by Tom Opgenorth
Modified: 2013-01-11 12:14 UTC (History)
2 users (show)

Is this bug a regression?: ---
Last known good build:

Build output from step #5, after the .JAR files are removed from OSMDroidTest (113.03 KB, text/plain)
2013-01-04 12:19 UTC, Tom Opgenorth

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.

Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:

Description Tom Opgenorth 2013-01-04 12:19:50 UTC
Created attachment 3162 [details]
Build output from step #5, after the .JAR files are removed from OSMDroidTest

(First mention of this was via the forums.xamarin.com: http://forums.xamarin.com/discussion/713/using-a-java-binding-library-still-requires-jar-to-be-added-to-application-project)

Starting in Mono for Android 4.2.8, it was no longer necessary to add the .JAR file to a Mono for Android Application project when referencing a Java Binding Library. Mono for Android 4.4.54 seems to have regressed on this point - on must add the .JAR files to the Mono for Android application project again.

Steps to duplicate:

1. Ensure that Mono for Android 4.4.54 is installed.

2. Get the OSMDroidBinding sample from https://github.com/xamarin/monodroid-samples/tree/master/OsmDroidBindingExample

3. Compile the project. The project will compile. This is the first problem - the project should not compile, there should be an error because the .JAR files from the binding project are included in the Mono for Android application

4. Remove the two .JAR files from the project OSMDroidTest. 

5. Rebuild all. There will be 8 build errors. The build output has been attached as a .txt file to this bug.

6. Add the .JAR files back to OSMDroidTest. The solution will now build.
Comment 1 Atsushi Eno 2013-01-04 15:28:32 UTC
that applies only if you use EmbeddedReferenceJar.

You use ReferenceJar: https://github.com/xamarin/monodroid-samples/blob/master/OsmDroidBindingExample/OsmDroidBinding/OsmDroid.csproj#L59
Comment 2 Steve Williams 2013-01-04 19:17:23 UTC
My binding project uses InputJar and ReferenceJar.  I need to add the input jar to the application as well in order to get the application to build.  I have not used EmbeddedReferenceJar anywhere.
Comment 3 Atsushi Eno 2013-01-04 23:33:33 UTC
To make sure - you'll have to use EmbeddedJar to replace InputJar.
Comment 4 Steve Williams 2013-01-05 05:57:37 UTC
Atsushi, perhaps the documentation should be updated to reflect that vital change?  

All it says right now is that as of 4.2.8 the jar no longer needs to be added to the application project, and to set the jar to InputJar.  It should also mention that you need to change the binding library project to use EmbeddedJar instead of InputJar. And perhaps a note about not using EmbeddedReferenceJar because that causes errors.

Ok, so changing the binding library project to use EmbeddedJar instead of InputJar appears to fix the issue.  Still very confusing for people following the documentation.
Comment 5 Atsushi Eno 2013-01-05 12:24:38 UTC
I agree, and topgenorth is the man in the docs team to take care of it ;-) Though you don't *need* to change InputJar, it works as it used to do.
Comment 6 Tom Opgenorth 2013-01-11 12:14:51 UTC
Docs are updated to reflect this change.