gpt4 book ai didi

android - 无法实例化坐标资源系统java.lang.NoClassDefFoundError:org.geotools.factory.Hints

转载 作者:行者123 更新时间:2023-12-03 06:08:27 27 4
gpt4 key购买 nike

我试图在我的一个项目中使用Geotools Java库,我使用Gradle和14.3版构建了它:

compile 'org.geotools:gt-shapefile:14.3'
compile 'org.geotools:gt-epsg-hsql:14.3'

基本上,任何时候我尝试实例化CoordinateResourceSystem,例如:
CoordinateReferenceSystem crs;
try {
crs = CRS.decode("epsg:4326"); //also tried DefaultGeographicCRS.WGS84_3D
} catch (FactoryException e) {
e.printStackTrace();
}

我在运行时收到此错误:
java.lang.NoClassDefFoundError: org.geotools.factory.Hints
at org.geotools.referencing.CRS.<clinit>(CRS.java:181)

到目前为止,我收到的所有建议都与启用Multidex有关,我尝试了指定的gradle组合中的每一个,但无济于事。还尝试了清洁和建筑数十次。无论我做什么,我在运行时都会收到此讨厌的错误。关于为什么会这样有任何想法吗?我可以在 jar 里看到课。

我注意到该依赖项导入了几个jar,所有的jar都具有相似的包名。这些软件包名称可能引起一些困惑吗?

在这里真是一头雾水,在弄清楚如何正确实现此代码之前,我无法继续我的项目。

编辑

这是我的logcat。表明ART如何处理某些geotools类(包括culrpit Hints类)存在某种问题。
04-20 22:41:55.308 5089-5089/com.myproject I/art: Rejecting re-init on previously-failed class java.lang.Class<org.geotools.referencing.factory.ReferencingFactory>
04-20 22:41:55.311 5089-5089/com.myproject I/art: Rejecting re-init on previously-failed class java.lang.Class<org.geotools.factory.Hints>
04-20 22:41:55.311 5089-5089/com.myproject I/art: Rejecting re-init on previously-failed class java.lang.Class<org.geotools.factory.Hints$Key>
04-20 22:41:55.319 5089-5089/com.myproject I/art: Rejecting re-init on previously-failed class java.lang.Class<org.geotools.factory.Hints>
04-20 22:41:55.324 5089-5089/com.myproject I/art: Rejecting re-init on previously-failed class java.lang.Class<org.geotools.referencing.DefaultAuthorityFactory>
04-20 22:41:55.324 5089-5089/com.myproject I/art: Rejecting re-init on previously-failed class java.lang.Class<org.geotools.referencing.DefaultAuthorityFactory>
04-20 22:41:55.325 5089-5089/com.myproject I/art: Rejecting re-init on previously-failed class java.lang.Class<org.geotools.factory.Hints>
04-20 22:41:55.326 5089-5089/com.myproject I/art: Rejecting re-init on previously-failed class java.lang.Class<org.geotools.factory.Hints$Key>
04-20 22:41:55.326 5089-5089/com.myproject I/art: Rejecting re-init on previously-failed class java.lang.Class<org.geotools.factory.Hints$Key>
04-20 22:41:55.329 5089-5089/com.myproject I/art: Rejecting re-init on previously-failed class java.lang.Class<org.geotools.factory.Hints>
04-20 22:41:55.329 5089-5089/com.myproject I/art: Rejecting re-init on previously-failed class java.lang.Class<org.geotools.referencing.factory.AbstractAuthorityFactory>
04-20 22:41:55.330 5089-5089/com.myproject I/art: Rejecting re-init on previously-failed class java.lang.Class<org.geotools.referencing.factory.AbstractAuthorityFactory>
04-20 22:41:55.330 5089-5089/com.myproject I/art: Rejecting re-init on previously-failed class java.lang.Class<org.geotools.factory.Hints>
04-20 22:41:55.339 5089-5089/com.myproject I/art: Rejecting re-init on previously-failed class java.lang.Class<org.geotools.geometry.DirectPosition2D>
04-20 22:41:55.341 5089-5089/com.myproject I/art: Rejecting re-init on previously-failed class java.lang.Class<org.geotools.factory.Hints>
04-20 22:41:55.342 5089-5089/com.myproject I/art: Rejecting re-init on previously-failed class java.lang.Class<org.geotools.factory.Hints$Key>
04-20 22:41:55.355 5089-5089/com.myproject I/art: Rejecting re-init on previously-failed class java.lang.Class<javax.media.jai.RenderedOp>
04-20 22:41:55.357 5089-5089/com.myproject I/art: Rejecting re-init on previously-failed class java.lang.Class<javax.media.jai.RenderedOp>
04-20 22:41:55.358 5089-5089/com.myproject I/art: Rejecting re-init on previously-failed class java.lang.Class<javax.media.jai.RenderedOp>
04-20 22:41:55.359 5089-5089/com.myproject I/art: Rejecting re-init on previously-failed class java.lang.Class<javax.media.jai.RenderedOp>
04-20 22:41:55.360 5089-5089/com.myproject I/art: Rejecting re-init on previously-failed class java.lang.Class<javax.media.jai.RenderedOp>
04-20 22:41:55.361 5089-5089/com.myproject I/art: Rejecting re-init on previously-failed class java.lang.Class<javax.media.jai.RenderedOp>
04-20 22:41:55.362 5089-5089/com.myproject I/art: Rejecting re-init on previously-failed class java.lang.Class<javax.media.jai.RenderedOp>
04-20 22:41:55.363 5089-5089/com.myproject I/art: Rejecting re-init on previously-failed class java.lang.Class<javax.media.jai.RenderedOp>
04-20 22:41:55.363 5089-5089/com.myproject I/art: Rejecting re-init on previously-failed class java.lang.Class<javax.media.jai.RenderedOp>
04-20 22:41:55.364 5089-5089/com.myproject I/art: Rejecting re-init on previously-failed class java.lang.Class<javax.media.jai.RenderedOp>
04-20 22:41:55.365 5089-5089/com.myproject I/art: Rejecting re-init on previously-failed class java.lang.Class<javax.media.jai.RenderedOp>
04-20 22:41:55.366 5089-5089/com.myproject I/art: Rejecting re-init on previously-failed class java.lang.Class<javax.media.jai.RenderedOp>
04-20 22:41:55.367 5089-5089/com.myproject I/art: Rejecting re-init on previously-failed class java.lang.Class<javax.media.jai.RenderedOp>
04-20 22:41:55.368 5089-5089/com.myproject I/art: Rejecting re-init on previously-failed class java.lang.Class<javax.media.jai.RenderedOp>
04-20 22:41:55.371 5089-5089/com.myproject I/art: Rejecting re-init on previously-failed class java.lang.Class<javax.media.jai.RenderedOp>
04-20 22:41:55.372 5089-5089/com.myproject I/art: Rejecting re-init on previously-failed class java.lang.Class<javax.media.jai.RenderedOp>
04-20 22:41:55.374 5089-5089/com.myproject I/art: Rejecting re-init on previously-failed class java.lang.Class<javax.media.jai.RenderedOp>
04-20 22:41:55.375 5089-5089/com.myproject I/art: Rejecting re-init on previously-failed class java.lang.Class<javax.media.jai.RenderedOp>
04-20 22:41:55.376 5089-5089/com.myproject I/art: Rejecting re-init on previously-failed class java.lang.Class<javax.media.jai.RenderedOp>
04-20 22:41:55.376 5089-5089/com.myproject I/art: Rejecting re-init on previously-failed class java.lang.Class<javax.media.jai.RenderedOp>
04-20 22:41:55.377 5089-5089/com.myproject I/art: Rejecting re-init on previously-failed class java.lang.Class<javax.media.jai.RenderedOp>
04-20 22:41:55.378 5089-5089/com.myproject I/art: Rejecting re-init on previously-failed class java.lang.Class<javax.media.jai.RenderedOp>
04-20 22:41:55.378 5089-5089/com.myproject I/art: Rejecting re-init on previously-failed class java.lang.Class<javax.media.jai.RenderedOp>
04-20 22:41:55.379 5089-5089/com.myproject I/art: Rejecting re-init on previously-failed class java.lang.Class<javax.media.jai.RenderedOp>
04-20 22:41:55.379 5089-5089/com.myproject I/art: Rejecting re-init on previously-failed class java.lang.Class<javax.media.jai.RenderedOp>
04-20 22:41:55.383 5089-5089/com.myproject I/art: Rejecting re-init on previously-failed class java.lang.Class<javax.media.jai.RenderedOp>
04-20 22:41:55.384 5089-5089/com.myproject I/art: Rejecting re-init on previously-failed class java.lang.Class<javax.media.jai.RenderedOp>
04-20 22:41:55.384 5089-5089/com.myproject I/art: Rejecting re-init on previously-failed class java.lang.Class<javax.media.jai.RenderedOp>
04-20 22:41:55.389 5089-5089/com.myproject I/art: Rejecting re-init on previously-failed class java.lang.Class<javax.media.jai.RenderableOp>
04-20 22:41:55.402 5089-5089/com.myproject I/art: Rejecting re-init on previously-failed class java.lang.Class<javax.media.jai.RenderedOp>
04-20 22:41:55.406 5089-5089/com.myproject I/art: Rejecting re-init on previously-failed class java.lang.Class<javax.media.jai.RenderedOp>
04-20 22:41:55.406 5089-5089/com.myproject I/art: Rejecting re-init on previously-failed class java.lang.Class<javax.media.jai.PlanarImage>
04-20 22:41:55.408 5089-5089/com.myproject I/art: Rejecting re-init on previously-failed class java.lang.Class<javax.media.jai.RenderableOp>
04-20 22:41:55.409 5089-5089/com.myproject I/art: Rejecting re-init on previously-failed class java.lang.Class<javax.media.jai.RenderableOp>
04-20 22:41:55.410 5089-5089/com.myproject I/art: Rejecting re-init on previously-failed class java.lang.Class<javax.media.jai.RenderableOp>
04-20 22:41:55.414 5089-5089/com.myproject I/art: Rejecting re-init on previously-failed class java.lang.Class<javax.media.jai.JAI$RenderingKey>
04-20 22:41:55.414 5089-5089/com.myproject I/art: Rejecting re-init on previously-failed class java.lang.Class<org.geotools.factory.Hints>
04-20 22:41:55.414 5089-5089/com.myproject D/AndroidRuntime: Shutting down VM
04-20 22:41:55.415 5089-5089/com.myproject E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.myproject, PID: 5089
java.lang.NoClassDefFoundError: org.geotools.factory.Hints
at org.geotools.referencing.CRS.<clinit>(CRS.java:181)
at com.myproject.MotionTrackingActivity.onCreate(MotionTrackingActivity.java:122)
at android.app.Activity.performCreate(Activity.java:5231)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2160)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2246)
at android.app.ActivityThread.access$800(ActivityThread.java:136)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1197)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5030)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:609)

最佳答案

打破GeoTools引用的“通常方法”是不包含EPSG工厂或包含多个工厂。从您的问题中我看不出是您的问题。如FAQ中所述,您需要一个epsg jar ,通常是gt-epsg-hsql

您的问题被标记为Android,GeoTools使用基于SPI的工厂查找器系统提供some known issues,但我认为这不是问题。

关于android - 无法实例化坐标资源系统java.lang.NoClassDefFoundError:org.geotools.factory.Hints,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36728848/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com