Did you follow these instructions?<br><br><a href="http://trac.osgeo.org/gdal/wiki/GdalOgrInJavaBuildInstructionsUnix">http://trac.osgeo.org/gdal/wiki/GdalOgrInJavaBuildInstructionsUnix</a><br><br>this command must work:<br>
<br><pre class="wiki">java -classpath `pwd`/gdal.jar:`pwd`:`pwd`/build/apps gdalinfo<br></pre>as the instruction are saying:<br>
<i>With luck you will see the gdalinfo usage message.
</i><br><br>and try to see a gdalinfo of a file<br><br>--Nikos Hatzopoulos<br><br><div class="gmail_quote">On Thu, Aug 11, 2011 at 3:21 PM, Jim Pendleton <span dir="ltr"><<a href="mailto:jimp@ittvis.com">jimp@ittvis.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;"><br>
Even,<br>
<br>
Thanks for the suggestion, but if I've implemented your<br>
suggestion properly, it has not solved the underlying problem.<br>
<div class="im"><br>
>I'm not sure how you've compiled the gdal_warp.cpp, but if you didn't<br>
>use the provided swig/java/GNUmakefile, there's one point you must be<br>
>very careful that is mentionned at the bottom of that makefile :<br>
<br>
</div>To create a .so file from source in Android, you generally use the<br>
ndk-build utility along with one or more Android.mk and Application.mk<br>
files. I execute the standard make/make install from<br>
within the swig/java directory, then I compile and link gdal_wrap.cpp<br>
within the context of a separate ndk-build process.<br>
<br>
Android NDK Release 6 uses GNU Make 3.81 as its build utility.<br>
<br>
The compiler in my case is arm-linux-androideabi-g++ (GCC) 4.4.3.<br>
<br>
The loader is GNU ld (GNU Binutils) 2.19.<br>
<div class="im"><br>
># Do not remove -fno-strict-aliasing while SWIG generates weird code<br>
>in upcast methods<br>
># See <a href="http://trac.osgeo.org/gdal/changeset/16006" target="_blank">http://trac.osgeo.org/gdal/changeset/16006</a><br>
<br>
>That would be a plausible cause for the crash, since in your<br>
>particular case the GetMetadataItem() method is in the MajorObject<br>
>class, so the Dataset object needs to call the SWIGDatasetUpcast()<br>
>method...<br>
<br>
</div>Indeed I was lacking the -fno-strict-aliasing switch in the C++ flags in<br>
my<br>
Android.mk file.<br>
<br>
However, I've added this switch to both LOCAL_CFLAGS and LOCAL_CPPFLAGS<br>
for the libgdaljni.so build and I continue to get the error during<br>
execution.<br>
<br>
To add some more info to my original message, the actual error comes<br>
from<br>
within Java_org_gdal_gdal_gdalJNI_MajorObject_1GetMetadataItem_1_1SWIG10<br>
in<br>
gdal_wrap.cpp on the call to jenv->GetStringUTFChars(jarg2, 0). First a<br>
JNI<br>
warning is issued, then the access violation appears to occur before<br>
that<br>
function can return, or at least before a debug statement I've added<br>
after<br>
the call can send its output to the Android LogCat output.<br>
<br>
The error that's issued is related to jarg2 which is supposed to be a<br>
jstring, versus the jarg1 argument you mentioned which requires the<br>
upcast to GDALMajorObjectShadow.<br>
<br>
I think I'll need to further debug the pointers that are being passed<br>
down to the *GetMetadataItem*1SWIG10* function. None of them look<br>
outrageous at first glance.<br>
<br>
Again, there's every reason to believe I'm missing something that's<br>
otherwise obvious to the experts so please feel free to continue<br>
sending ideas my way!<br>
<div><div></div><div class="h5"><br>
Jim P.<br>
_______________________________________________<br>
gdal-dev mailing list<br>
<a href="mailto:gdal-dev@lists.osgeo.org">gdal-dev@lists.osgeo.org</a><br>
<a href="http://lists.osgeo.org/mailman/listinfo/gdal-dev" target="_blank">http://lists.osgeo.org/mailman/listinfo/gdal-dev</a><br>
</div></div></blockquote></div><br>