Hi,

I wasn't aware that GeoTools uses the Java "SPI" nor what SPI means. I found
information about SPI and i'm not really sure that the Android platform can
handle that (for example, the package javax.security is handled by Android
but javax.security.auth.spi is not). I'm looking for more information about
that.

By the way, i've found information that may be useful :
Android uses the Dalvik virtual machine. The architecture of this VM is a
registry, not a stack one like the Java VM.
Applications developed for Android must be compiled in Dalvik executables
(.dex) with the dx tool. It compiles .java and .class and then convert
.class in .dex. So the .dex file is the equivalent to .jar but for Android.
Thus, the Dalvik Bytecode is different from the Java Bytecode.

So i guess when i import .jar files into my Android project, they are turned
into .dex files (or i'm wrong somehow ?).
Moreover, the Dalvik VM doesn't use JIT compilation.

So this may explain why i have deferences between a compilation on a Java
classic project that uses GeoTools and an Android one.

Now about what "doesn't work" means to me :

I have errors while using the application i created with GeoTools
attributes, but not while typing the code.
Here is an example of a code that seems correct, but throws me an error
while using the application :

Map<String, Serializable> pParams = new HashMap<String, Serializable>();

DataStore pDS = null;
try {
     pParams.put("ServeurPrincipal", new URI(endPoint));
     pDS = DataStoreFinder.getDataStore(pParams); // <-- Error here
} catch (URISyntaxException e) {
     e.printStackTrace();

} catch (IOException e) {
     e.printStackTrace();
}


The error is :

ERROR/AndroidRuntime(262): java.lang.
NoClassDefFoundError: org.geotools.data.wfs.WFSDataStoreFactory

Some explanation about the code:
I want to get data from a WFS server that can be reach through the
"endPoint" URL (String).
Before i can iterate the data, i have an exception on the getDataStore
function.
The endPoint URL is something like "
http://privateServer/arcgis/services/monPortail/prototype_mobile/MapServer/WFSServer?TYPENAME=monPortail&request=getFeature&service=WFS&version=1.1.0<http://privateserver/arcgis/services/monPortail/prototype_mobile/MapServer/WFSServer?TYPENAME=monPortail&request=getFeature&service=WFS&version=1.1.0>
"

At this point, i included in the project those .jar files :
- gt-api
- gt-data
- gt-epsg-hsql
- gt-main
- gt-opengis
- gt-wfs
- gt-xml

I am not able to add every .jar files listed in the geotools-2.7.0.1-bin.zip
file because when i'm doing that, i have a Heap space error although i run
Eclipse this way : C:\eclipse\eclipse.exe -vmargs -Xms512m -Xmx1024m
-XX:PermSize=128m -XX:MaxPermSize=256m _nl fr_FR

Another example with another error :

Map connectionParameters = new HashMap();

connectionParameters.put("WFSDataStoreFactory:GET_CAPABILITIES_URL", endPoint);
DataStore data = null;
// Step 2 - connection
try {
    data = DataStoreFinder.getDataStore( connectionParameters ); //
<-- Error here

} catch (IOException e) {
    e.printStackTrace();
}


Returned error : ERROR/AndroidRuntime(313): Caused by:
java.lang.NoClassDefFoundError: org.geotools.util.logging.Logging

Another one :

Map params = new HashMap();
    params.put(WFSDataStoreFactory.URL.key, endPoint); // <-- Error here


Here, endPoint is an URL type variable.
The error reported is : ERROR/AndroidRuntime(364):
java.lang.NoClassDefFoundError: org.geotools.data.wfs.WFSDataStoreFactory

Finally, the last test :

WFSDataStoreFactory f = new WFSDataStoreFactory(); // <-- Error here


Returns : ERROR/AndroidRuntime(417): java.lang.NoClassDefFoundError:
org.geotools.data.wfs.WFSDataStoreFactory

So far, i use just a selection of .jar files. When i try to import more .jar
files, i have a heap space error (eclipse.exe uses about 1150Mo of RAM),
with many messages like this in the console :

2011-04-18 10:52:43 - CRLRmap] Dx warning: Ignoring InnerClasses attribute
for an anonymous inner class
(com.ibm.icu.text.BreakIteratorFactory$1RBBreakIteratorFactory) that doesn't
come with an
associated EnclosingMethod attribute. This class was probably produced by a
compiler that did not target the modern .class file format. The recommended
solution is to recompile the class from source, using an up-to-date compiler
and without specifying any "-target" type options. The consequence of
ignoring
this warning is that reflective operations on this class will incorrectly
indicate that it is *not* an inner class.

For now i don't know what to do with this indication.

I hope i gave you enough to have a clue about what is possible to do to use
GeoTools correctly with Android.

If you need any additional information or want me to test some procedures,
please let me know so i can perform tests or improvements about my use of
GeoTools.

Regards,

Rémi Belzanti
[email protected]

2011/4/16 Jody Garnett <[email protected]>

>  I am not aware of the limits of the andriod platform; you are aware that
> GeoTools uses the Java "SPI" system to write up each jar (so they can find
> the factories provided by the plugins). Does this mechanism work on Andriod?
>
> You will need to provide some more details on what "doesn't work" means?
>
> --
> Jody Garnett
>
> On Saturday, 16 April 2011 at 4:53 PM, Rémi Belzanti wrote:
>
> Hi,
>
> I'm looking for information about how to use GeoTools with Android system.
> I'm not sure this is here i can ask questions about that, so don't hesitate
> to redirect me to an appropriate place.
>
> I am using Eclipse on Windows XP. I downloaded the GeoTools 2 zip file and
> started to add some .jar files to my project.
> The particularity of my project is that this is an Android one.
>
> I am developing an Android application that would allow me to show on a map
> (google map) some features (points but not only) so i tried to use GeoTools
> to do that (concretely, my goal is to display features given to my by a WFS
> server).
>
> Today, with the version 2.7.0.1, it appears that GeoTools doesn't work with
> an Android project. To have the capacity of creating an Android project in
> Eclipse, you have to download and install the Android SDK package.
> First i thought i was wrong with the add of .jar files or something, but
> when i create a new "classic" java project, it appears that i can use
> GeoTools efficiently.
>
> So my question is, is there any Android version of GeoTools or is there any
> particular configuration that i need to do to use GeoTools within Android
> applications ?
>
> I can give you more information about the error messages i have in return
> of a code that works on "classic" java project, and about all i've tried to
> do with the configuration or add of .jar files.
>
> Thanks in advance.
>
> Best regards,
>
> Remi
> zepi30gmail.com
>
> ------------------------------------------------------------------------------
> Benefiting from Server Virtualization: Beyond Initial Workload
> Consolidation -- Increasing the use of server virtualization is a top
> priority.Virtualization can reduce costs, simplify management, and improve
> application availability and disaster protection. Learn more about boosting
>
> the value of server virtualization. http://p.sf.net/sfu/vmware-sfdev2dev
> _______________________________________________
> Geotools-gt2-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users
>
>
>
------------------------------------------------------------------------------
Benefiting from Server Virtualization: Beyond Initial Workload 
Consolidation -- Increasing the use of server virtualization is a top
priority.Virtualization can reduce costs, simplify management, and improve 
application availability and disaster protection. Learn more about boosting 
the value of server virtualization. http://p.sf.net/sfu/vmware-sfdev2dev
_______________________________________________
Geotools-gt2-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users

Reply via email to