在geotools库上构建的Android App缺少本机Java库 [英] Android App build on geotools library missing native java libs

查看:74
本文介绍了在geotools库上构建的Android App缺少本机Java库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用eclipse在Android应用程序中使用geotools(当前为8.0-M3,也可能是2.7.3)库.(Win7专业版,4GB内存)但是构建过程崩溃,并且出现以下错误

I want to use geotools(8.0-M3 currently, could be also 2.7.3) library in an Android app, using eclipse. (win7 prof, 4gb ram) But the build process crash, and i get following error

未处理的事件循环异常Java堆空间

Unhandled event loop exception Java heap space

java堆空间问题应该可以解决,但似乎还有更多问题.(3GB应该足够了,不是吗?)

The java heap space problem should be solveable, but it seems there is more. (3gb should be enough, isn't it?)

我的最终目标是能够通过OGC网络要素服务"和网络地图服务"在geoserver上请求postgres postgis数据库.

My final target is to be able to request a postgres postgis db on geoserver by OGC "web feature service" and "web map service".

我已经将eclipse ini设置为

I already set the eclipse ini to

-launcher.XXMaxPermSize128m--launcher.defaultActionopenFile -vmargs-Xms40m-Xmx3700m

--launcher.XXMaxPermSize 128m --launcher.defaultAction openFile -vmargs -Xms40m -Xmx3700m

Geotools所需要的不仅仅是Android库(与jre6(1.6.0_24)比较).

Geotools require more than android libs (in compare with jre6 (1.6.0_24)) provide.

->因此,我将jre6文件夹中的整个jars加jts-1.8.jar以及geotools jars复制到一个单独的(win)文件夹中.(Maven(本例中未使用!)本身加载jts-1.1.3 lib,有什么区别吗?)整个jar文件夹的大小接近80Mb.

-> So I copy the whole jars from jre6 folder plus jts-1.8.jar plus the geotools jars into a seperate (win) folder. (Maven(not in use in this case!) by itself load jts-1.1.3 lib, does it make any difference?) The whole jar folder has a size of nearly 80Mb.

->在eclipse android项目结构中创建一个新文件夹.

-> Create a new folder in eclipse android project struture.

->将win文件夹中的jar文件导入eclipse

-> import the jar files from the win folder into eclipse

->将jar添加到项目构建路径(应该将java移植到dx)(经过长时间(几天)的试用,这是我知道的唯一途径,可以为该应用程序提供所有必要的类.至少eclipse不会标记任何缺失的内容.

-> add the jars to the project build path (which should port java to dx) (After a long time (days) of trial thats the only way i know, to provide all neccessary classes to the app. At least eclipse doesn't mark anything missing).

在编译完成eclipse控制台输出后:

After the compilation crased the eclipse console output:

Dx警告:忽略匿名内部类的InnerClasses属性....

Dx warning: Ignoring InnerClasses attribute for an anonymous inner class.....

几个班级.可能是因为jre lib.

for several classes. Probably because of the jre lib.

我还有哪些其他选项可为我的android项目中的geotools提供必要的Java库?还是您对我在下面提到的试验有任何想法?

What other options to provide geotools the necessary java libs in my android project do i have? Or do you have any idea of the trials i mentioned below?

PS:Android书籍建议从jar文件中仅复制缺少的类(及其依赖项Haha).....(我最好将它们写成新的)

PS: Android books recommend to copy just the missing classes (and their dependencies Haha) out of the jar files..... (i will probably better write them new)

我已经尝试使用maven插件.这在使用geotools的纯Java项目中效果很好,或者只要我不使用geotools就可以处理一个android项目.如果maven包含使用geotools的android项目,则lib会由maven加载,但android会说类似手动修改R类"的内容.(我无法还原或重新创建的内容)

I already tried using the maven plugin. Which works well in a pure java project using geotools or as it take care of an android project as long i don't use geotools. If maven include an android project using geotools the libs are loaded by maven but then android say something like "R class modified manually"... (what i can't revert, or recreate)

是否有一种方法可以将Eclipse项目中的Maven依赖库(应该包含我需要的内容)复制出来.(我以为我可以将jars从win存储库文件夹中复制出来,但这还可以复制到很多其他jars中.)

Is there a way to copy the maven dependecy library (which should consist of what i need) out of the eclipse project. (I thought i could copy the jars out of the win repository folder, but that include also to much others jars).

Android提供了一个"Java本机接口",允许使用C ++或其他库.是否可以解决缺少/交叉库的问题(我还没有JNI的经验)?

Android provide a "Java Native Interface" which allows to use C++ or other libs. Would it be an option to surround the porblem of missing/crossing libs (I have no experience of JNI yet)?

该应用代码很短,如果可以帮助您将其粘贴.

The app code is pretty short, if it help you i can paste it.

推荐答案

我还有哪些其他选项可以为我的android项目提供geotools所需的Java库?

What other options to provide geotools the necessary java libs in my android project do i have?

如果您需要标准Java发行版中的类而不是Android中的类,那么除了重新编写geotool以避免需要这些类之外,您就不走运了.

If you need classes that are part of a standard Java distribution but are not in Android, you are out of luck, other than to rewrite geotools to avoid needing those classes.

如果您需要其他第三方Java库中的类,请将这些第三方Java库添加到您的项目中.

If you need classes that are part of other third-party Java libraries, add those third-party Java libraries to your project.

通过对geotools的简要检查,我怀疑需要对其进行实质性的重写才能在Android上运行.

From a brief examination of geotools, I suspect that it will need to be substantially rewritten to run on Android.

PS:Android书籍建议从jar文件中仅复制缺少的类(及其依赖项Haha)

PS: Android books recommend to copy just the missing classes (and their dependencies Haha) out of the jar files

我的书没有.任何建议这样做的作者都需要检查自己的头脑.

My books do not. Any author advising this needs to have their head examined.

这篇关于在geotools库上构建的Android App缺少本机Java库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆