DynamoDbMapperException: No method annotated?

我们两清 提交于 2019-12-02 13:18:32

问题


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.

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.


回答1:


Are you using a DynamoDB table?

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 error in basic action

Edit: Try chaning

-keep public class com.example.myclass

to

-keep public class com.example.myclass {
    *;
}


来源:https://stackoverflow.com/questions/32521563/dynamodbmapperexception-no-method-annotated

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!