xamarin.android绑定发现超过16个参数

时间:2017-08-02 08:01:53

标签: android xamarin binding xamarin.android

绑定项目: https://1drv.ms/u/s!AiLsd2NKfovHm-sbwI-iFUTFI1Z-HQ

使用vs构建它之后,它将显示错误:

找到超过16个参数,超出了参数的最大数量......

在此处构建输出:

1>------ Rebuild All started: Project: BaiduLBSAndroidSDKBindingV_4_3_2, Configuration: Debug Any CPU ------
1>JARTOXML : Java HotSpot(TM) 64-Bit Server VM warning : ignoring option UseSplitVerifier; support was removed in 8.0
1>BINDINGSGENERATOR : warning BG8D00: More than 16 parameters were found, which goes beyond the maximum number of parameters. (in method Init in managed type Com.Baidu.Platform.Comjni.Map.Basemap.JNIBaseMap)
1>BINDINGSGENERATOR : warning BG8103: Class Com.Baidu.Mapapi.Map.WeightedLatLng has invalid base type com.baidu.mapapi.map.l.a.
1>BINDINGSGENERATOR : warning BG8801: Invalid parameter type java.util.Collection<com.baidu.mapapi.map.WeightedLatLng> in method WeightedData in managed type Com.Baidu.Mapapi.Map.HeatMap.Builder.
1>D:\TempApps\BaiduLBSAndroidSDKBindingV_4_3_2\BaiduLBSAndroidSDKBindingV_4_3_2\obj\Debug\generated\src\Com.Baidu.Platform.Comapi.Map.E.cs(1274,19,1274,30): error CS0111: Type 'E' already defines a member called 'GetCHandler' with the same parameter types
1>D:\TempApps\BaiduLBSAndroidSDKBindingV_4_3_2\BaiduLBSAndroidSDKBindingV_4_3_2\obj\Debug\generated\src\Com.Baidu.Platform.Comapi.Map.E.cs(1281,15,1281,18): error CS0111: Type 'E' already defines a member called 'n_C' with the same parameter types
1>D:\TempApps\BaiduLBSAndroidSDKBindingV_4_3_2\BaiduLBSAndroidSDKBindingV_4_3_2\obj\Debug\generated\src\Com.Baidu.Platform.Comapi.Map.E.cs(1291,30,1291,31): error CS0111: Type 'E' already defines a member called 'C' with the same parameter types
1>D:\TempApps\BaiduLBSAndroidSDKBindingV_4_3_2\BaiduLBSAndroidSDKBindingV_4_3_2\obj\Debug\generated\src\Com.Baidu.Platform.Comapi.Map.E.cs(1378,19,1378,30): error CS0111: Type 'E' already defines a member called 'GetDHandler' with the same parameter types
1>D:\TempApps\BaiduLBSAndroidSDKBindingV_4_3_2\BaiduLBSAndroidSDKBindingV_4_3_2\obj\Debug\generated\src\Com.Baidu.Platform.Comapi.Map.E.cs(1385,15,1385,18): error CS0111: Type 'E' already defines a member called 'n_D' with the same parameter types
1>D:\TempApps\BaiduLBSAndroidSDKBindingV_4_3_2\BaiduLBSAndroidSDKBindingV_4_3_2\obj\Debug\generated\src\Com.Baidu.Platform.Comapi.Map.E.cs(1395,30,1395,31): error CS0111: Type 'E' already defines a member called 'D' with the same parameter types
1>D:\TempApps\BaiduLBSAndroidSDKBindingV_4_3_2\BaiduLBSAndroidSDKBindingV_4_3_2\obj\Debug\generated\src\Com.Baidu.Platform.Comapi.Map.E.cs(1552,19,1552,30): error CS0111: Type 'E' already defines a member called 'GetGHandler' with the same parameter types
1>D:\TempApps\BaiduLBSAndroidSDKBindingV_4_3_2\BaiduLBSAndroidSDKBindingV_4_3_2\obj\Debug\generated\src\Com.Baidu.Platform.Comapi.Map.E.cs(1559,15,1559,18): error CS0111: Type 'E' already defines a member called 'n_G' with the same parameter types
1>D:\TempApps\BaiduLBSAndroidSDKBindingV_4_3_2\BaiduLBSAndroidSDKBindingV_4_3_2\obj\Debug\generated\src\Com.Baidu.Platform.Comapi.Map.E.cs(1569,30,1569,31): error CS0111: Type 'E' already defines a member called 'G' with the same parameter types
1>D:\TempApps\BaiduLBSAndroidSDKBindingV_4_3_2\BaiduLBSAndroidSDKBindingV_4_3_2\obj\Debug\generated\src\Com.Baidu.Platform.Comapi.Map.E.cs(1620,19,1620,30): error CS0111: Type 'E' already defines a member called 'GetHHandler' with the same parameter types
1>D:\TempApps\BaiduLBSAndroidSDKBindingV_4_3_2\BaiduLBSAndroidSDKBindingV_4_3_2\obj\Debug\generated\src\Com.Baidu.Platform.Comapi.Map.E.cs(1627,17,1627,20): error CS0111: Type 'E' already defines a member called 'n_H' with the same parameter types
1>D:\TempApps\BaiduLBSAndroidSDKBindingV_4_3_2\BaiduLBSAndroidSDKBindingV_4_3_2\obj\Debug\generated\src\Com.Baidu.Platform.Comapi.Map.E.cs(1637,32,1637,33): error CS0111: Type 'E' already defines a member called 'H' with the same parameter types
1>D:\TempApps\BaiduLBSAndroidSDKBindingV_4_3_2\BaiduLBSAndroidSDKBindingV_4_3_2\obj\Debug\generated\src\Com.Baidu.Platform.Comapi.Map.E.cs(1688,19,1688,30): error CS0111: Type 'E' already defines a member called 'GetIHandler' with the same parameter types
1>D:\TempApps\BaiduLBSAndroidSDKBindingV_4_3_2\BaiduLBSAndroidSDKBindingV_4_3_2\obj\Debug\generated\src\Com.Baidu.Platform.Comapi.Map.E.cs(1695,15,1695,18): error CS0111: Type 'E' already defines a member called 'n_I' with the same parameter types
1>D:\TempApps\BaiduLBSAndroidSDKBindingV_4_3_2\BaiduLBSAndroidSDKBindingV_4_3_2\obj\Debug\generated\src\Com.Baidu.Platform.Comapi.Map.E.cs(1705,30,1705,31): error CS0111: Type 'E' already defines a member called 'I' with the same parameter types
1>D:\TempApps\BaiduLBSAndroidSDKBindingV_4_3_2\BaiduLBSAndroidSDKBindingV_4_3_2\obj\Debug\generated\src\Com.Baidu.Platform.Comapi.Map.E.cs(1756,19,1756,30): error CS0111: Type 'E' already defines a member called 'GetJHandler' with the same parameter types
1>D:\TempApps\BaiduLBSAndroidSDKBindingV_4_3_2\BaiduLBSAndroidSDKBindingV_4_3_2\obj\Debug\generated\src\Com.Baidu.Platform.Comapi.Map.E.cs(1763,15,1763,18): error CS0111: Type 'E' already defines a member called 'n_J' with the same parameter types
1>D:\TempApps\BaiduLBSAndroidSDKBindingV_4_3_2\BaiduLBSAndroidSDKBindingV_4_3_2\obj\Debug\generated\src\Com.Baidu.Platform.Comapi.Map.E.cs(1773,30,1773,31): error CS0111: Type 'E' already defines a member called 'J' with the same parameter types
========== Rebuild All: 0 succeeded, 1 failed, 0 skipped ==========

1 个答案:

答案 0 :(得分:1)

我认为在这种情况下正确的方法是在Android Studio中创建一个包装器jar,然后绑定到少于16个参数的包装器。 16个参数已经具有足够的代码气味。绑定生成器实际上验证了这一点:

https://github.com/xamarin/java.interop/blob/master/tools/generator/MethodBase.cs#L194-L196

我认为限制来自Func和Action代表

Why don't Funcs accept more than 16 arguments?

https://msdn.microsoft.com/en-us/library/dd402862(v=vs.110).aspx

另一种方法是直接使用JNI:

https://developer.xamarin.com/guides/android/advanced_topics/java_integration_overview/working_with_jni/

EX:

https://gist.github.com/mattleibow/2a7379294b8d59b6726891412b58445c

https://gist.github.com/mattleibow/f1cef8feed89f5d540b4d31cfc36b259