Bug 14820 - Unhandled exception in Xamarin.Android.Binder.CodeGenerator
Summary: Unhandled exception in Xamarin.Android.Binder.CodeGenerator
Status: RESOLVED FIXED
Alias: None
Product: Android
Classification: Xamarin
Component: Bindings ()
Version: 4.8.x
Hardware: Macintosh Mac OS
: --- normal
Target Milestone: ---
Assignee: Atsushi Eno
URL:
Depends on:
Blocks:
 
Reported: 2013-09-17 20:51 UTC by Jon Goldberger [MSFT]
Modified: 2014-04-21 03:18 UTC (History)
2 users (show)

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


Attachments
test Project (1.70 MB, application/zip)
2013-09-17 20:51 UTC, Jon Goldberger [MSFT]
Details
API xml file (413.11 KB, text/xml)
2013-09-17 20:52 UTC, Jon Goldberger [MSFT]
Details
2 projects. First: Xamarin android binding project, which is failing. Second: Java android project that can consume the jar with no errors. (2.33 MB, application/octet-stream)
2013-09-30 10:00 UTC, Clipster Exel
Details


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:
Status:
RESOLVED FIXED

Description Jon Goldberger [MSFT] 2013-09-17 20:51:55 UTC
Created attachment 4918 [details]
test Project

We are busy with a project where we want to bind a third-party android library (jar). 
After setup and including a bunch of extra 'reference' jars we get an unhandled exception from the Xamarin androidbinding generator. 
I also see some warnings that we need to fix through metadata changes, But something tells me this will not fix the unhandled exception. 

Hopefully you can help us with this. For reference I included the debug output underneath my signature below. 
I also included the generated api.xml as an attachment for your reference.

==========================================================================================================
Build output:

Building: esperantoxl.service.appear.droid (Debug)

Build started 09/16/2013 11:42:27.
__________________________________________________
Project "/Users/zeno/ProjectsV6/mobicloud/flexworker-mobile/esperantoxl.service.appear.droid/esperantoxl.service.appear.droid.csproj" (Build target(s)):

Target _ResolveMonoAndroidSdks:
MonoAndroid Tools: /Library/Frameworks/Xamarin.Android.framework/Versions/Current/lib/mandroid/
MonoAndroid Framework: /Library/Frameworks/Xamarin.Android.framework/Versions/Current/lib/mandroid/platforms/android-8;/Library/Frameworks/Xamarin.Android.framework/Versions/Current/lib/mono/2.1
Android SDK: /Users/zeno/Library/Developer/Xamarin/android-sdk-mac_x86/
Java SDK: /usr/
Android Platform API level: 8
TargetFrameworkVersion: v2.2

Target ResolveLibraryProjects:
No input files were specified for target ResolveLibraryProjects, skipping.

Target ExportJarToXml:
Skipping target "ExportJarToXml" because its outputs are up-to-date.

Target PrepareForBuild:
Configuration: Debug Platform: AnyCPU

Target GenerateBindings:
RemovedDirectories: 
obj/Debug/generated/
TransformFiles:
Transforms/EnumFields.xml
Transforms/EnumMethods.xml
Transforms/Metadata.xml
ReferencedManagedLibraries:
/Library/Frameworks/Xamarin.Android.framework/Versions/Current/lib/mono/2.1/System.dll
/Library/Frameworks/Xamarin.Android.framework/Versions/Current/lib/mono/2.1/System.Xml.dll
/Library/Frameworks/Xamarin.Android.framework/Versions/Current/lib/mandroid/platforms/android-8/Mono.Android.dll
/Library/Frameworks/Xamarin.Android.framework/Versions/Current/lib/mono/2.1/System.Core.dll
Adding transform file Transforms/EnumFields.xml as enumfields.
Adding transform file Transforms/EnumMethods.xml as enummethods.
Adding transform file Transforms/Metadata.xml as metadata.
Tool /Library/Frameworks/Xamarin.Android.framework/Versions/Current/bin/generator execution started with arguments: obj/Debug/api.xml --csdir=obj/Debug/generated/src --enumdir=obj/Debug/generated/enums --enummetadata=obj/Debug/generated/metadata --assembly=esperantoxl.service.appear.droid --ref=/Library/Frameworks/Xamarin.Android.framework/Versions/Current/lib/mono/2.1/mscorlib.dll --ref=/Library/Frameworks/Xamarin.Android.framework/Versions/Current/lib/mono/2.1/System.dll --ref=/Library/Frameworks/Xamarin.Android.framework/Versions/Current/lib/mono/2.1/System.Xml.dll --ref=/Library/Frameworks/Xamarin.Android.framework/Versions/Current/lib/mandroid/platforms/android-8/Mono.Android.dll --ref=/Library/Frameworks/Xamarin.Android.framework/Versions/Current/lib/mono/2.1/System.Core.dll --enumfields=Transforms/EnumFields.xml --enummethods=Transforms/EnumMethods.xml --fixup=Transforms/Metadata.xml --api-level=8 --global --public 
resolving assembly /Library/Frameworks/Xamarin.Android.framework/Versions/Current/lib/mono/2.1/mscorlib.dll
resolving assembly /Library/Frameworks/Xamarin.Android.framework/Versions/Current/lib/mono/2.1/System.dll
resolving assembly /Library/Frameworks/Xamarin.Android.framework/Versions/Current/lib/mono/2.1/System.Xml.dll
resolving assembly /Library/Frameworks/Xamarin.Android.framework/Versions/Current/lib/mandroid/platforms/android-8/Mono.Android.dll
resolving assembly /Library/Frameworks/Xamarin.Android.framework/Versions/Current/lib/mono/2.1/System.Core.dll
: warning BG8102: Class Com.Appearnetworks.Aiq.Authentication.LogoutService has unknown base type android.app.IntentService
: warning BG8C00: For type Com.Appearnetworks.Aiq.Location.LocationUpdatesListener, base interface com.google.android.gms.common.GooglePlayServicesClient.ConnectionCallbacks does not exist.
: warning BG8C00: For type Com.Appearnetworks.Aiq.Location.LocationUpdatesListener, base interface com.google.android.gms.common.GooglePlayServicesClient.OnConnectionFailedListener does not exist.
: warning BG8C00: For type Com.Appearnetworks.Aiq.Location.LocationUpdatesListener, base interface com.google.android.gms.location.LocationListener does not exist.
: warning BG8800: Unknown parameter type com.google.android.gms.common.ConnectionResult
found in method OnConnectionFailed
in type Com.Appearnetworks.Aiq.Location.LocationUpdatesListener
: warning BG8102: Class Com.Appearnetworks.Aiq.Push.GCMReceiver has unknown base type com.google.android.gcm.GCMBroadcastReceiver
: warning BG8102: Class Com.Appearnetworks.Aiq.Push.GCMService has unknown base type com.google.android.gcm.GCMBaseIntentService
: warning BG8102: Class Com.Appearnetworks.Aiq.Push.PushRegistrationService has unknown base type android.app.IntentService
: warning BG8102: Class Com.Appearnetworks.Aiq.UI.Web.WebViewActivityBase has unknown base type android.support.v4.app.FragmentActivity
: warning BG8102: Class Com.Appearnetworks.Aiq.Utils.Mail has unknown base type javax.mail.Authenticator
: warning BG8C00: For type Com.Appearnetworks.Aiq.Location.LocationUpdatesListener, base interface com.google.android.gms.common.GooglePlayServicesClient.ConnectionCallbacks does not exist.
: warning BG8C00: For type Com.Appearnetworks.Aiq.Location.LocationUpdatesListener, base interface com.google.android.gms.common.GooglePlayServicesClient.OnConnectionFailedListener does not exist.
: warning BG8C00: For type Com.Appearnetworks.Aiq.Location.LocationUpdatesListener, base interface com.google.android.gms.location.LocationListener does not exist.
: warning BG8401: Skipping Com.Appearnetworks.Aiq.Context.Providers.AppsContextProvider.ProviderName, due to a duplicate field, method or nested type name
: warning BG8401: Skipping Com.Appearnetworks.Aiq.Context.Providers.DeviceContextProvider.ProviderName, due to a duplicate field, method or nested type name
: warning BG8401: Skipping Com.Appearnetworks.Aiq.Context.Providers.LocationContextProvider.ProviderName, due to a duplicate field, method or nested type name
: warning BG8401: Skipping Com.Appearnetworks.Aiq.Context.Providers.UptimeProvider.ProviderName, due to a duplicate field, method or nested type name
: warning BG8401: Skipping Com.Appearnetworks.Aiq.Jsapi.Bridge.Controller, due to a duplicate field, method or nested type name

Unhandled Exception:
System.NullReferenceException: Object reference not set to an instance of an object
at MonoDroid.Generation.ClassGen.Generate (System.IO.StreamWriter sw, System.String indent, MonoDroid.Generation.CodeGenerationOptions opt, MonoDroid.Generation.GenerationInfo gen_info) [0x00000] in <filename unknown>:0 
at MonoDroid.Generation.ClassGen.Generate (MonoDroid.Generation.CodeGenerationOptions opt, MonoDroid.Generation.GenerationInfo gen_info) [0x00000] in <filename unknown>:0 
at Xamarin.Android.Binder.CodeGenerator.Run (Xamarin.Android.Binder.CodeGeneratorOptions options) [0x00000] in <filename unknown>:0 
at Xamarin.Android.Binder.CodeGenerator.Main (System.String[] args) [0x00000] in <filename unknown>:0 
[ERROR] FATAL UNHANDLED EXCEPTION: System.NullReferenceException: Object reference not set to an instance of an object
at MonoDroid.Generation.ClassGen.Generate (System.IO.StreamWriter sw, System.String indent, MonoDroid.Generation.CodeGenerationOptions opt, MonoDroid.Generation.GenerationInfo gen_info) [0x00000] in <filename unknown>:0 
at MonoDroid.Generation.ClassGen.Generate (MonoDroid.Generation.CodeGenerationOptions opt, MonoDroid.Generation.GenerationInfo gen_info) [0x00000] in <filename unknown>:0 
at Xamarin.Android.Binder.CodeGenerator.Run (Xamarin.Android.Binder.CodeGeneratorOptions options) [0x00000] in <filename unknown>:0 
at Xamarin.Android.Binder.CodeGenerator.Main (System.String[] args) [0x00000] in <filename unknown>:0 
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Bindings.targets: error : Tool exited with code: 1. Output: resolving assembly /Library/Frameworks/Xamarin.Android.framework/Versions/Current/lib/mono/2.1/mscorlib.dll
resolving assembly /Library/Frameworks/Xamarin.Android.framework/Versions/Current/lib/mono/2.1/System.dll
resolving assembly /Library/Frameworks/Xamarin.Android.framework/Versions/Current/lib/mono/2.1/System.Xml.dll
resolving assembly /Library/Frameworks/Xamarin.Android.framework/Versions/Current/lib/mandroid/platforms/android-8/Mono.Android.dll
resolving assembly /Library/Frameworks/Xamarin.Android.framework/Versions/Current/lib/mono/2.1/System.Core.dll
warning BG8102: Class Com.Appearnetworks.Aiq.Authentication.LogoutService has unknown base type android.app.IntentService
warning BG8C00: For type Com.Appearnetworks.Aiq.Location.LocationUpdatesListener, base interface com.google.android.gms.common.GooglePlayServicesClient.ConnectionCallbacks does not exist.
warning BG8C00: For type Com.Appearnetworks.Aiq.Location.LocationUpdatesListener, base interface com.google.android.gms.common.GooglePlayServicesClient.OnConnectionFailedListener does not exist.
warning BG8C00: For type Com.Appearnetworks.Aiq.Location.LocationUpdatesListener, base interface com.google.android.gms.location.LocationListener does not exist.
warning BG8800: Unknown parameter type com.google.android.gms.common.ConnectionResult
found in method OnConnectionFailed
in type Com.Appearnetworks.Aiq.Location.LocationUpdatesListener
warning BG8102: Class Com.Appearnetworks.Aiq.Push.GCMReceiver has unknown base type com.google.android.gcm.GCMBroadcastReceiver
warning BG8102: Class Com.Appearnetworks.Aiq.Push.GCMService has unknown base type com.google.android.gcm.GCMBaseIntentService
warning BG8102: Class Com.Appearnetworks.Aiq.Push.PushRegistrationService has unknown base type android.app.IntentService
warning BG8102: Class Com.Appearnetworks.Aiq.UI.Web.WebViewActivityBase has unknown base type android.support.v4.app.FragmentActivity
warning BG8102: Class Com.Appearnetworks.Aiq.Utils.Mail has unknown base type javax.mail.Authenticator
warning BG8C00: For type Com.Appearnetworks.Aiq.Location.LocationUpdatesListener, base interface com.google.android.gms.common.GooglePlayServicesClient.ConnectionCallbacks does not exist.
warning BG8C00: For type Com.Appearnetworks.Aiq.Location.LocationUpdatesListener, base interface com.google.android.gms.common.GooglePlayServicesClient.OnConnectionFailedListener does not exist.
warning BG8C00: For type Com.Appearnetworks.Aiq.Location.LocationUpdatesListener, base interface com.google.android.gms.location.LocationListener does not exist.
warning BG8401: Skipping Com.Appearnetworks.Aiq.Context.Providers.AppsContextProvider.ProviderName, due to a duplicate field, method or nested type name
warning BG8401: Skipping Com.Appearnetworks.Aiq.Context.Providers.DeviceContextProvider.ProviderName, due to a duplicate field, method or nested type name
warning BG8401: Skipping Com.Appearnetworks.Aiq.Context.Providers.LocationContextProvider.ProviderName, due to a duplicate field, method or nested type name
warning BG8401: Skipping Com.Appearnetworks.Aiq.Context.Providers.UptimeProvider.ProviderName, due to a duplicate field, method or nested type name
warning BG8401: Skipping Com.Appearnetworks.Aiq.Jsapi.Bridge.Controller, due to a duplicate field, method or nested type name

Unhandled Exception:
System.NullReferenceException: Object reference not set to an instance of an object
at MonoDroid.Generation.ClassGen.Generate (System.IO.StreamWriter sw, System.String indent, MonoDroid.Generation.CodeGenerationOptions opt, MonoDroid.Generation.GenerationInfo gen_info) [0x00000] in <filename unknown>:0 
at MonoDroid.Generation.ClassGen.Generate (MonoDroid.Generation.CodeGenerationOptions opt, MonoDroid.Generation.GenerationInfo gen_info) [0x00000] in <filename unknown>:0 
at Xamarin.Android.Binder.CodeGenerator.Run (Xamarin.Android.Binder.CodeGeneratorOptions options) [0x00000] in <filename unknown>:0 
at Xamarin.Android.Binder.CodeGenerator.Main (System.String[] args) [0x00000] in <filename unknown>:0 
[ERROR] FATAL UNHANDLED EXCEPTION: System.NullReferenceException: Object reference not set to an instance of an object
at MonoDroid.Generation.ClassGen.Generate (System.IO.StreamWriter sw, System.String indent, MonoDroid.Generation.CodeGenerationOptions opt, MonoDroid.Generation.GenerationInfo gen_info) [0x00000] in <filename unknown>:0 
at MonoDroid.Generation.ClassGen.Generate (MonoDroid.Generation.CodeGenerationOptions opt, MonoDroid.Generation.GenerationInfo gen_info) [0x00000] in <filename unknown>:0 
at Xamarin.Android.Binder.CodeGenerator.Run (Xamarin.Android.Binder.CodeGeneratorOptions options) [0x00000] in <filename unknown>:0 
at Xamarin.Android.Binder.CodeGenerator.Main (System.String[] args) [0x00000] in <filename unknown>:0 

Task "BindingsGenerator" execution -- FAILED
Done building target "GenerateBindings" in project "/Users/zeno/ProjectsV6/mobicloud/flexworker-mobile/esperantoxl.service.appear.droid/esperantoxl.service.appear.droid.csproj".-- FAILED

Done building project "/Users/zeno/ProjectsV6/mobicloud/flexworker-mobile/esperantoxl.service.appear.droid/esperantoxl.service.appear.droid.csproj".-- FAILED

Build FAILED.

Warnings:

/Users/zeno/ProjectsV6/mobicloud/flexworker-mobile/esperantoxl.service.appear.droid/esperantoxl.service.appear.droid.csproj (Build) ->
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Bindings.targets (GenerateBindings target) ->

: warning BG8102: Class Com.Appearnetworks.Aiq.Authentication.LogoutService has unknown base type android.app.IntentService
: warning BG8C00: For type Com.Appearnetworks.Aiq.Location.LocationUpdatesListener, base interface com.google.android.gms.common.GooglePlayServicesClient.ConnectionCallbacks does not exist.
: warning BG8C00: For type Com.Appearnetworks.Aiq.Location.LocationUpdatesListener, base interface com.google.android.gms.common.GooglePlayServicesClient.OnConnectionFailedListener does not exist.
: warning BG8C00: For type Com.Appearnetworks.Aiq.Location.LocationUpdatesListener, base interface com.google.android.gms.location.LocationListener does not exist.
: warning BG8800: Unknown parameter type com.google.android.gms.common.ConnectionResult
: warning BG8102: Class Com.Appearnetworks.Aiq.Push.GCMReceiver has unknown base type com.google.android.gcm.GCMBroadcastReceiver
: warning BG8102: Class Com.Appearnetworks.Aiq.Push.GCMService has unknown base type com.google.android.gcm.GCMBaseIntentService
: warning BG8102: Class Com.Appearnetworks.Aiq.Push.PushRegistrationService has unknown base type android.app.IntentService
: warning BG8102: Class Com.Appearnetworks.Aiq.UI.Web.WebViewActivityBase has unknown base type android.support.v4.app.FragmentActivity
: warning BG8102: Class Com.Appearnetworks.Aiq.Utils.Mail has unknown base type javax.mail.Authenticator
: warning BG8C00: For type Com.Appearnetworks.Aiq.Location.LocationUpdatesListener, base interface com.google.android.gms.common.GooglePlayServicesClient.ConnectionCallbacks does not exist.
: warning BG8C00: For type Com.Appearnetworks.Aiq.Location.LocationUpdatesListener, base interface com.google.android.gms.common.GooglePlayServicesClient.OnConnectionFailedListener does not exist.
: warning BG8C00: For type Com.Appearnetworks.Aiq.Location.LocationUpdatesListener, base interface com.google.android.gms.location.LocationListener does not exist.
: warning BG8401: Skipping Com.Appearnetworks.Aiq.Context.Providers.AppsContextProvider.ProviderName, due to a duplicate field, method or nested type name
: warning BG8401: Skipping Com.Appearnetworks.Aiq.Context.Providers.DeviceContextProvider.ProviderName, due to a duplicate field, method or nested type name
: warning BG8401: Skipping Com.Appearnetworks.Aiq.Context.Providers.LocationContextProvider.ProviderName, due to a duplicate field, method or nested type name
: warning BG8401: Skipping Com.Appearnetworks.Aiq.Context.Providers.UptimeProvider.ProviderName, due to a duplicate field, method or nested type name
: warning BG8401: Skipping Com.Appearnetworks.Aiq.Jsapi.Bridge.Controller, due to a duplicate field, method or nested type name

Errors:

/Users/zeno/ProjectsV6/mobicloud/flexworker-mobile/esperantoxl.service.appear.droid/esperantoxl.service.appear.droid.csproj (Build) ->
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Bindings.targets (GenerateBindings target) ->

/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Bindings.targets: error : Tool exited with code: 1. Output: resolving assembly /Library/Frameworks/Xamarin.Android.framework/Versions/Current/lib/mono/2.1/mscorlib.dll
resolving assembly /Library/Frameworks/Xamarin.Android.framework/Versions/Current/lib/mono/2.1/System.dll
resolving assembly /Library/Frameworks/Xamarin.Android.framework/Versions/Current/lib/mono/2.1/System.Xml.dll
resolving assembly /Library/Frameworks/Xamarin.Android.framework/Versions/Current/lib/mandroid/platforms/android-8/Mono.Android.dll
resolving assembly /Library/Frameworks/Xamarin.Android.framework/Versions/Current/lib/mono/2.1/System.Core.dll
warning BG8102: Class Com.Appearnetworks.Aiq.Authentication.LogoutService has unknown base type android.app.IntentService
warning BG8C00: For type Com.Appearnetworks.Aiq.Location.LocationUpdatesListener, base interface com.google.android.gms.common.GooglePlayServicesClient.ConnectionCallbacks does not exist.
warning BG8C00: For type Com.Appearnetworks.Aiq.Location.LocationUpdatesListener, base interface com.google.android.gms.common.GooglePlayServicesClient.OnConnectionFailedListener does not exist.
warning BG8C00: For type Com.Appearnetworks.Aiq.Location.LocationUpdatesListener, base interface com.google.android.gms.location.LocationListener does not exist.
warning BG8800: Unknown parameter type com.google.android.gms.common.ConnectionResult
found in method OnConnectionFailed
in type Com.Appearnetworks.Aiq.Location.LocationUpdatesListener
warning BG8102: Class Com.Appearnetworks.Aiq.Push.GCMReceiver has unknown base type com.google.android.gcm.GCMBroadcastReceiver
warning BG8102: Class Com.Appearnetworks.Aiq.Push.GCMService has unknown base type com.google.android.gcm.GCMBaseIntentService
warning BG8102: Class Com.Appearnetworks.Aiq.Push.PushRegistrationService has unknown base type android.app.IntentService
warning BG8102: Class Com.Appearnetworks.Aiq.UI.Web.WebViewActivityBase has unknown base type android.support.v4.app.FragmentActivity
warning BG8102: Class Com.Appearnetworks.Aiq.Utils.Mail has unknown base type javax.mail.Authenticator
warning BG8C00: For type Com.Appearnetworks.Aiq.Location.LocationUpdatesListener, base interface com.google.android.gms.common.GooglePlayServicesClient.ConnectionCallbacks does not exist.
warning BG8C00: For type Com.Appearnetworks.Aiq.Location.LocationUpdatesListener, base interface com.google.android.gms.common.GooglePlayServicesClient.OnConnectionFailedListener does not exist.
warning BG8C00: For type Com.Appearnetworks.Aiq.Location.LocationUpdatesListener, base interface com.google.android.gms.location.LocationListener does not exist.
warning BG8401: Skipping Com.Appearnetworks.Aiq.Context.Providers.AppsContextProvider.ProviderName, due to a duplicate field, method or nested type name
warning BG8401: Skipping Com.Appearnetworks.Aiq.Context.Providers.DeviceContextProvider.ProviderName, due to a duplicate field, method or nested type name
warning BG8401: Skipping Com.Appearnetworks.Aiq.Context.Providers.LocationContextProvider.ProviderName, due to a duplicate field, method or nested type name
warning BG8401: Skipping Com.Appearnetworks.Aiq.Context.Providers.UptimeProvider.ProviderName, due to a duplicate field, method or nested type name
warning BG8401: Skipping Com.Appearnetworks.Aiq.Jsapi.Bridge.Controller, due to a duplicate field, method or nested type name

Unhandled Exception:
System.NullReferenceException: Object reference not set to an instance of an object
at MonoDroid.Generation.ClassGen.Generate (System.IO.StreamWriter sw, System.String indent, MonoDroid.Generation.CodeGenerationOptions opt, MonoDroid.Generation.GenerationInfo gen_info) [0x00000] in <filename unknown>:0 
at MonoDroid.Generation.ClassGen.Generate (MonoDroid.Generation.CodeGenerationOptions opt, MonoDroid.Generation.GenerationInfo gen_info) [0x00000] in <filename unknown>:0 
at Xamarin.Android.Binder.CodeGenerator.Run (Xamarin.Android.Binder.CodeGeneratorOptions options) [0x00000] in <filename unknown>:0 
at Xamarin.Android.Binder.CodeGenerator.Main (System.String[] args) [0x00000] in <filename unknown>:0 
[ERROR] FATAL UNHANDLED EXCEPTION: System.NullReferenceException: Object reference not set to an instance of an object
at MonoDroid.Generation.ClassGen.Generate (System.IO.StreamWriter sw, System.String indent, MonoDroid.Generation.CodeGenerationOptions opt, MonoDroid.Generation.GenerationInfo gen_info) [0x00000] in <filename unknown>:0 
at MonoDroid.Generation.ClassGen.Generate (MonoDroid.Generation.CodeGenerationOptions opt, MonoDroid.Generation.GenerationInfo gen_info) [0x00000] in <filename unknown>:0 
at Xamarin.Android.Binder.CodeGenerator.Run (Xamarin.Android.Binder.CodeGeneratorOptions options) [0x00000] in <filename unknown>:0 
at Xamarin.Android.Binder.CodeGenerator.Main (System.String[] args) [0x00000] in <filename unknown>:0 


18 Warning(s)
1 Error(s)

Time Elapsed 00:00:03.2557240

---------------------- Done ----------------------

Build: 1 error, 18 warnings
==========================================================================================================
Version info:

Xamarin Studio
Version 4.0.12 (build 3)
Installation UUID: 3d32125c-9f2c-4e26-bc76-f06723da1fee
Runtime:
Mono 3.2.1 ((no/f3f789e)
GTK 2.24.20
GTK# (2.12.0.0)
Package version: 302010001

Apple Developer Tools
Xcode 4.6.3 (2068)
Build 4H1503

Xamarin.Mac
Xamarin.Mac: Not Installed

Xamarin.Android
Version: 4.8.2 (Business Edition)
Android SDK: /Users/zeno/Library/Developer/Xamarin/android-sdk-mac_x86
Supported Android versions:
2.1 (API level 7)
2.2 (API level 8)
2.3 (API level 10)
3.1 (API level 12)
4.0 (API level 14)
4.0.3 (API level 15)
4.2 (API level 17)
Java SDK: /usr
java version "1.7.0_09"
Java(TM) SE Runtime Environment (build 1.7.0_09-b05)
Java HotSpot(TM) 64-Bit Server VM (build 23.5-b02, mixed mode)

Xamarin.iOS
Version: 6.4.5.0 (Business Edition)
Hash: 1336a36
Branch: 
Build date: 2013-10-09 11:14:45-0400

Build Information
Release ID: 400120003
Git revision: 593d7acb1cb78ceeeb482d5133cf1fe514467e39
Build date: 2013-08-07 20:30:53+0000
Xamarin addins: 25a0858b281923e666b09259ad4746b774e0a873

Operating System
Mac OS X 10.8.4
Darwin Franz-Roberts-MacBook-Pro-3.local 12.4.0 Darwin Kernel Version 12.4.0
Wed May 1 17:57:12 PDT 2013
root:xnu-2050.24.15~1/RELEASE_X86_64 x86_64
Comment 1 Jon Goldberger [MSFT] 2013-09-17 20:52:26 UTC
Created attachment 4919 [details]
API xml file
Comment 3 Atsushi Eno 2013-09-18 06:02:25 UTC
NullReferenceException is bad, we should fix some code so that it does occur. However, the whole project is looking based on wrong premises and needs fixes, based on the principles:

- ReferenceJar cannot be used for any depending libraries that exposes corresponding Java classes in it. If your java library exposes android.support.v4.app.*Fragment, the build action for android-support-v4.jar CANNOT BE ReferenceJar or EmbeddedReferenceJar. You should add Mono.Android.Support.v4.dll as the project reference.

- The same applies to GooglePlayServices.

- For both above, you can still try to bind them by yourself, but that means you are supposed to write required metadata fixup by yourself. Using existing dll is much easier.

- There are many errors complaining that there are missing deps:
    Warning BG8C00: For type Javax.Activation.DataHandler, base interface java.awt.datatransfer.Transferable does not exist. (BG8C00) (esperantoxl.service.appear.droid)

  but THEY ARE RENAMED IN additional.jar as "myjava" !! Of course they don't exist. The class library jars are totally messed. And I cannot simply rename back to "java" not only because java tools do not accept loading the classes but also some other libraries seem to be rebuilt referencing the *renamed* libraries.

The overall experience above tells me that those java libraries don't work fine only in Java land either. For abnormal broken Java libraries any kind of unexpected error could happen.

Apart from investigating the NullReferenceException, we are not going to be able to support anything like this. To go further beyond that, we need sanitized set of jar files. -> setting NEEDINFO.

Fixing NRE aganst these complicated library set may also take longer time to be done. Simplified reproducible case could make it quicker.
Comment 4 Atsushi Eno 2013-09-18 06:15:38 UTC
The NRE issue is fixed. [master 984ce57]
Comment 5 Clipster Exel 2013-09-30 10:00:57 UTC
Created attachment 5019 [details]
2 projects. First: Xamarin android binding project, which is failing. Second: Java android project that can consume the jar with no errors.

Tested with the latest alpha release of xamarin.android but still getting the same error.

The jar also seems to be ok, since it can be added to an android java project without any problems.

but when trying to add this same jar in the xamarin project, it fails to build because of the generator.exe that gets an unhandled/nullreference exception.

Hopefully you can reproduce the same error with these projects.
Comment 6 Atsushi Eno 2013-10-02 05:22:26 UTC
You have to fix those "build failures" by yourself as it is documented.
http://docs.xamarin.com/guides/android/advanced_topics/java_integration_overview/binding_a_java_library_%28.jar%29
Comment 7 Clipster Exel 2013-10-02 08:31:53 UTC
Hi Atsushi Eno,

The only error I get in this project is that the generator still gets an unhandeled exception. (because of some nullreferenceexception at MonoDroid.Generation.ClassGen.Generate() ). I do get 7 warnings, but that should not stop the build, right?

Even following the tutorial won't fix that. Could you point me the right direction where to look, because besides the nullreference, I don't get any logging in the build log.

Thanks
Comment 8 Atsushi Eno 2013-10-03 04:09:33 UTC
Oh, yes you are right. Then, please wait for some update that contains the fix (comment #4). Then with the fixed version you will still see build errors that some fix in the project's Metadata.xml is required (explained in the URL in comment #6).
Comment 9 Atsushi Eno 2014-04-21 03:18:29 UTC
There should be stable releases that contain this fix, so I'm closing this bug.