在我的 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 基本操作错误
尝试改变
-keep public class com.example.myclass
到
-keep public class com.example.myclass {
*;
}
这篇关于DynamoDbMapperException:没有方法注释?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!