我一直在尝试在我的项目(Android)中使用dynamodb-geo库。在阅读了互联网周围的所有可能之后,我注意到lib jar没有包含在类路径中,我做到了并且得到了codehaus Object Mapper类未找到的异常。然后我在pom中添加依赖项来添加更快的xml并更改相应的导入。之后我将它打包(mvn clean package)并将相应的jar放在我的android项目的libs文件夹中,将其设置为gradle并且" play"。
然而,我仍然得到了令人讨厌的"未找到的课程"。
dynamodb geo的pom包含:
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.8.3</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-annotations</artifactId>
<version>2.8.3</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
<version>2.8.3</version>
</dependency>
我在android中的gradle文件包含:
compile files('libs/dynamodb-geo-1.1.0.jar')
但我还是得到了:
10-17 17:27:33.134 5139-5363/com.fivesigmagames.sdghunter E/AndroidRuntime: FATAL EXCEPTION: Thread-32098
Process: com.fivesigmagames.sdghunter, PID: 5139
java.lang.NoClassDefFoundError: Failed resolution of: Lcom/fasterxml/jackson/databind/ObjectMapper;
at com.amazonaws.geo.util.GeoJsonMapper.<clinit>(GeoJsonMapper.java:26)
at com.amazonaws.geo.dynamodb.internal.DynamoDBManager.putPoint(DynamoDBManager.java:125)
at com.amazonaws.geo.GeoDataManager.putPoint(GeoDataManager.java:132)
at com.fivesigmagames.sdghunter.repository.aws.AWSShareItemRepository$1.run(AWSShareItemRepository.java:58)
at java.lang.Thread.run(Thread.java:818)
Caused by: java.lang.ClassNotFoundException: Didn't find class "com.fasterxml.jackson.databind.ObjectMapper" on path: DexPathList[[dex file "/data/data/com.fivesigmagames.sdghunter/files/instant-run/dex/slice-unity-classes_bf479e7b8b71b5703bea6af2dcab41a7dfc4e91a-classes.dex", dex file "/data/data/com.fivesigmagames.sdghunter/files/instant-run/dex/slice-support-annotations-24.2.1_7a5f3f7e74247119444f4d43b2c522de9eab70fb-classes.dex", dex file "/data/data/com.fivesigmagames.sdghunter/files/instant-run/dex/slice-slice_9-classes.dex", dex file "/data/data/com.fivesigmagames.sdghunter/files/instant-run/dex/slice-slice_8-classes.dex", dex file "/data/data/com.fivesigmagames.sdghunter/files/instant-run/dex/slice-slice_7-classes.dex", dex file "/data/data/com.fivesigmagames.sdghunter/files/instant-run/dex/slice-slice_6-classes.dex", dex file "/data/data/com.fivesigmagames.sdghunter/files/instant-run/dex/slice-slice_5-classes.dex", dex file "/data/data/com.fivesigmagames.sdghunter/files/instant-run/dex/slice-slice_4-classes.dex", dex file "/data/data/com.fivesigmagames.sdghunter/files/instant-run/dex/slice-slice_3-classes.dex", dex file "/data/data/com.fivesigmagames.sdghunter/files/instant-run/dex/slice-slice_2-classes.dex", dex file "/data/data/com.fivesigmagames.sdghunter/files/instant-run/dex/slice-slice_1-classes.dex", dex file "/data/data/com.fivesigmagames.sdghunter/files/instant-run/dex/slice-slice_0-classes.dex", dex file "/data/data/com.fivesigmagames.sdghunter/files/instant-run/dex/slice-s2-geometry-java_4a01ca5c6a6c529340eae8f7f80c06b632fdefb5-classes.dex", dex file "/data/data/com.fivesigmagames.sdghunter/files/instant-run/dex/slice-retrofit-2.1.0_95833411f91cbb8e9410129091d258a780b3748c-classes.dex", dex file "/data/data/com.fivesigmagames.sdghunter/files/instant-run/dex/slice-okio-1.8.0_0cb7cee6746d84f62570817f36b8feb9fcf01356-classes.dex", dex file "/data/data/com.fivesigmagames.sdghunter/files/instant-run/dex/slice-okhttp-3.3.1_f8edaf579e8e4a295d221f114889d70d3e62eb9f-classes.dex", dex file "/data/data/com.fivesigmagames.sdghunter/files/instant-run/dex/slice-mapbox-java-services-1.3.1_a50eb5179d7320fcdc538c586ebd2f231b152887-classes.dex", dex file "/data/data/com.fivesigmagames.sdghunter/files/instant-run/dex/slice-logging-interceptor-3.3.1_699d973b2d0ba8bcd453fd52df4c55554a3d27f5-classes.dex", dex file "/data/data/com.fivesigmagames.sdghunter/files/instant-run/dex/slice-internal_impl-24.2.1_f38e546d683a020056b2318e9388188d85136c2f-classes.dex", dex file "/data/data/com.fivesigmagames.sdghunter/files/instant-run/dex/slice-internal_impl-24.2.1_8f4ea427bad833b1812bc9e939084c687a54e0d0-classes.dex", dex file "/data/data/com.fivesigmagames.sdghunter/files/instant-run/dex/slice-internal_impl-24.2.1_3609d9e6e631ae1ef0b5261e8250a3cf6f1193cf-classes.dex", dex file "/data/data/com.fivesigmagames.sdghunter/files/instant-run/dex/slice-internal_impl-24.2.1_280e40067a7d8e7f7f2bc98507cf0b17f26db6bf-classes.dex", dex file "/data/data/com.fivesigmagames.sdghunter/files/instant-run/dex/slice-internal_impl-24.2.1_008f1eca59ba22cef5240a40ab0f74834de26c4c-classes.dex", dex file "/data/data/com.fivesigmagames.sdghunter/files/instant-run/dex/slice-guava-r09_4880220368cf85c4cfb2f46fdedb8912a6629e2a-classes.dex", dex file "/data/data/com.fivesigmagames.sdghunter/files/instant-run/dex/slice-guava-18.0_e11ced1631feb7c9800790c98fd765d3bed1b86c-classes.dex", dex file "/data/data/com.fivesigmagames.sdghunter/files/instant-run/dex/slice-gson-2.7_792e0
如果我手动(thourgh gradle)添加三个jackson依赖项,我会得到一个&#34;重复&#34;输入错误,它不会编译。
感谢您的帮助!
答案 0 :(得分:0)
大约7个月前,我一直在努力解决这个问题。 dynamodb-geo jar与旧版本的java aws-sdk(1.5.5)有依赖关系。这个1.5.5版本使用了Jackson libs的org.codehaus包名。
后来杰克逊已经将它的包裹名称从org.codehaus修改为com.fasterxml。最新版本的java aws-sdk已更新为使用这些新的软件包名称,但dynamodb-geo仍然依赖于1.5.5。因此,您无法在较新的java aws-sdk环境中部署此旧jar。
最好的解决方案是自己为dynamodb-geo创建一个新的jar,就像你已经尝试过的那样。但是您不需要自己添加与Jackson的依赖关系,因为这些是由aws sdk提供的。您可以在github上派生aws dynamodb-geo存储库,更新pom.xml中的aws-java-sdk.version属性,修复编译错误并使用Maven构建自己的jar。
我创建了一个http://indexoutofrange.com/Neo4jStoredProceduresWindows/来完成这个。使用这个分叉,您可以轻松创建自己的jar。
我已将此问题报告给AWS,并提供了fork on Github。不幸的是,图书馆根本没有维护,这使我决定不使用它。