DynamoDbMapperException:没有注释方法吗? [英] DynamoDbMapperException: No method annotated?
问题描述
在我的Android应用中,我使用DynamoDb。我创建一个类,该类与数据库表映射。应用程序在调试中正常运行。但是,如果我导出apk并运行应用程序,则会收到DynamoDbMapperException:
In my android app, I use DynamoDb. I create a class, which is mapped with a table of database. App runs normally in debug. But if I export apk and run app, I get the DynamoDbMapperException:
Caused by: com.amazonaws.mobileconnectors.dynamodbv2.dynamodbmapper.DynamoDBMappingException: No method annotated with interface com.amazonaws.mobileconnectors.dynamodbv2.dynamodbmapper.DynamoDBHashKey for class class com.example.myclass.
我使用Eclipse和proguard导出apk。我猜想proguard会引起问题,因为没有proguard的apk可以正常工作。
这是我的Proguard配置:
I use Eclipse and proguard to export apk. I guess proguard causes the problem, because the apk without proguard works fine. Here is my Proguard config:
-keepattributes *Annotation*
-keep public class com.example.myclass
请帮助我!我不知道如何解决该问题。
Please help me! I don't know how to solve the problem.
推荐答案
您是否正在使用DynamoDB表?
Are you using a DynamoDB table?
您需要为该类添加一个哈希键,您应使用 @DynamoDBHashKey
对该字段进行注释,您是否将其意外地注释为 @DynamoDBIndexHashKey
?如果是这样,则应将其改回。
You need to have a hash key for the class, you should annotate the field with @DynamoDBHashKey
, do you accidentally annotated it as @DynamoDBIndexHashKey
? If so, you should change it back.
可以在此处找到类似的参考
A similar reference can be found here
Android Amazon DynamoDb基本操作中的错误
编辑:
尝试更改
Try chaning
-keep public class com.example.myclass
到
-keep public class com.example.myclass {
*;
}
这篇关于DynamoDbMapperException:没有注释方法吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!