Quantcast
Channel: Recent Threads — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 204402

Help wrapping third party jar for Mono for Android

$
0
0

I am trying to wrap the ESRI ArcGIS map sdk for android for use in Mono for Android. I have successfully wrapped the iOS version using MonoTouch. However, doing the same thing for Android seems to be MUCH harder. Here are the issues I have run into and solved:

Trying to directly wrap the ArcGIS jar was a nightmare. It is very large and complicated that generated hundreds of warnings and errors in MonoDevelop as a binding project. I thought of a clever idea to use containment and write my own third party jar containing my own MapView class that "contains" an ESRI map view component. That way I only have to wrap my own very small third party jar and use the ArcGIS jar as a reference jar. Any functionality I need from the real ESRI map component, I just delegate from my own mapView class. This allows me to only wrap the functionality that I need. It seems like it might work and have made great progress. In addition to the ArcGIS jar being a reference jar, it also relies on two other reference jars. That means I have 1 jar to be wrapped, my own, and three reference jars. I submitted a separate email to you guys explaining a possible bug in the mono for android build scripts where more than 1 reference jar caused the same android identifier to be used for all of them causing a duplicate error message. See my other email for details. I worked around this by unzipping all 3 reference jars and rezipping into a single reference jar. Hopefully, you can fix this bug. Not only does the ArcGIS third party component jar require 2 other reference jars, but it also makes use of a native .so library. I saw the android simulator trying to load the library in the LogCat. I added the .so to the project and set its build action to AndroidNativeLibrary. That fixed that issue. I thought I would finally get success, but I have run into something that stumps me. It looks like the ESRI ArcGIS jar is obfuscated such that the Dalvik VM cannot understand it when run from mono for android. Obviously, it works fine in pure java mode. The LogCat shows the errors below when trying to find classes. What can I do about this issue? I wonder if my solution to issue #2 above where I unzipped the ArcGIS jar and rezipped joining in other jars is the cause of this problem? I don't think so as I unzipped my combined jar and it looks like it has all the necessary parts. Also, I wouldn't have gotten as far as I did where it tried to load the native library if this combined jar was bad.

01-19 02:39:54.419: E/mono(1507): WARNING: The runtime version supported by this application is unavailable.
01-19 02:39:54.430: E/mono(1507): Using default runtime: v2.0.50727
01-19 02:39:54.599: W/monodroid-gc(1507): GREF GC Threshold: 1800
01-19 02:39:56.719: W/dalvikvm(1507): Unable to resolve superclass of Lcom/esri/core/geometry/MultiPath; (709)
01-19 02:39:56.719: W/dalvikvm(1507): Link of class 'Lcom/esri/core/geometry/MultiPath;' failed
01-19 02:39:56.719: E/dalvikvm(1507): Could not find class 'com.esri.core.geometry.MultiPath', referenced from method com.esri.android.map.MapSurface.a
01-19 02:39:56.719: W/dalvikvm(1507): VFY: unable to resolve instanceof 585 (Lcom/esri/core/geometry/MultiPath;) in Lcom/esri/android/map/MapSurface;
01-19 02:39:56.719: D/dalvikvm(1507): VFY: replacing opcode 0x20 at 0x00e3
01-19 02:39:56.730: W/dalvikvm(1507): Unable to resolve superclass of Lcom/esri/core/geometry/MultiPath; (709)
01-19 02:39:56.730: W/dalvikvm(1507): Link of class 'Lcom/esri/core/geometry/MultiPath;' failed
01-19 02:39:56.730: W/dalvikvm(1507): Unable to resolve superclass of Lcom/esri/core/geometry/Polygon; (585)
01-19 02:39:56.730: W/dalvikvm(1507): Link of class 'Lcom/esri/core/geometry/Polygon;' failed
01-19 02:39:56.730: E/dalvikvm(1507): Could not find class 'com.esri.core.geometry.Polygon', referenced from method com.esri.android.map.MapSurface.h
01-19 02:39:56.740: W/dalvikvm(1507): VFY: unable to resolve new-instance 638 (Lcom/esri/core/geometry/Polygon;) in Lcom/esri/android/map/MapSurface;
01-19 02:39:56.740: D/dalvikvm(1507): VFY: replacing opcode 0x22 at 0x0018
01-19 02:39:56.740: W/dalvikvm(1507): Unable to resolve superclass of Lcom/esri/core/geometry/MultiPath; (709)
01-19 02:39:56.740: W/dalvikvm(1507): Link of class 'Lcom/esri/core/geometry/MultiPath;' failed
01-19 02:39:56.740: W/dalvikvm(1507): Unable to resolve superclass of Lcom/esri/core/geometry/Polygon; (585)
01-19 02:39:56.740: W/dalvikvm(1507): Link of class 'Lcom/esri/core/geometry/Polygon;' failed
01-19 02:39:56.740: W/dalvikvm(1507): VFY: unable to find class referenced in signature (Lcom/esri/core/geometry/Polygon;)
01-19 02:39:56.760: W/dalvikvm(1507): Unable to resolve superclass of Lcom/esri/core/geometry/MultiPath; (709)
01-19 02:39:56.760: W/dalvikvm(1507): Link of class 'Lcom/esri/core/geometry/MultiPath;' failed
01-19 02:39:56.760: W/dalvikvm(1507): Unable to resolve superclass of Lcom/esri/core/geometry/Polygon; (585)
01-19 02:39:56.760: W/dalvikvm(1507): Link of class 'Lcom/esri/core/geometry/Polygon;' failed
01-19 02:39:56.760: D/dalvikvm(1507): DexOpt: unable to opt direct call 0x0d9a at 0x1a in Lcom/esri/android/map/MapSurface;.h
01-19 02:39:56.790: D/dalvikvm(1507): Trying to load lib /data/data/Test.Test/lib/libGLMapCore.so 0x41492bb0
01-19 02:39:57.130: D/dalvikvm(1507): Added shared lib /data/data/Test.Test/lib/libGLMapCore.so 0x41492bb0
01-19 02:39:57.140: W/ApplicationContext(1507): Unable to create external cache directory
01-19 02:39:57.330: E/dalvikvm(1507): Could not find class 'com.esri.core.geometry.J', referenced from method com.esri.core.geometry.Point.<init>
01-19 02:39:57.330: W/dalvikvm(1507): VFY: unable to resolve new-instance 574 (Lcom/esri/core/geometry/J;) in Lcom/esri/core/geometry/Point;
01-19 02:39:57.330: D/dalvikvm(1507): VFY: replacing opcode 0x22 at 0x0009
01-19 02:39:57.330: E/dalvikvm(1507): Could not find class 'com.esri.core.geometry.J', referenced from method com.esri.core.geometry.Point.i
01-19 02:39:57.340: W/dalvikvm(1507): VFY: unable to resolve new-instance 574 (Lcom/esri/core/geometry/J;) in Lcom/esri/core/geometry/Point;
01-19 02:39:57.340: D/dalvikvm(1507): VFY: replacing opcode 0x22 at 0x000f
01-19 02:39:57.340: W/dalvikvm(1507): VFY: unable to find class referenced in signature (Lcom/esri/core/geometry/J;)
01-19 02:39:57.340: W/dalvikvm(1507): VFY: unable to resolve instance field 1109
01-19 02:39:57.340: D/dalvikvm(1507): VFY: replacing opcode 0x53 at 0x000a
01-19 02:39:57.340: W/dalvikvm(1507): VFY: unable to resolve instance field 1107
01-19 02:39:57.350: D/dalvikvm(1507): VFY: replacing opcode 0x53 at 0x0020
01-19 02:39:57.350: W/dalvikvm(1507): VFY: unable to find class referenced in signature (Lcom/esri/core/geometry/J;)
01-19 02:39:57.350: W/dalvikvm(1507): VFY: unable to find class referenced in signature (Lcom/esri/core/geometry/J;)
01-19 02:39:57.350: W/dalvikvm(1507): VFY: unable to find class referenced in signature (Lcom/esri/core/geometry/J;)
01-19 02:39:57.350: W/dalvikvm(1507): VFY: unable to find class referenced in signature (Lcom/esri/core/geometry/J;)
01-19 02:39:57.350: W/dalvikvm(1507): VFY: unable to find class referenced in signature (Lcom/esri/core/geometry/i;)
01-19 02:39:57.359: I/dalvikvm(1507): Could not find method com.esri.core.geometry.i.a, referenced from method com.esri.core.geometry.Point.a
01-19 02:39:57.359: W/dalvikvm(1507): VFY: unable to resolve virtual method 4112: Lcom/esri/core/geometry/
--------------------------------------------------------

Viewing all articles
Browse latest Browse all 204402

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>